Skip to content

Commit

Permalink
Fixes #36999 - Drop libvirt CPU model option for VM creation
Browse files Browse the repository at this point in the history
Since fog-libvirt 0.12.0 the default CPU model was some abstract type
with a low compatibility level. Since 0.12.0 it defaults to CPU
passthrough, as recommended by qemu if live migration is not required
(https://www.qemu.org/docs/master/system/qemu-cpu-models.html). That's
not something we support today, so it should be safe to drop the CPU
model selection.
  • Loading branch information
ekohl committed Apr 10, 2024
1 parent a9d585e commit 8097b38
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 13 deletions.
3 changes: 0 additions & 3 deletions app/models/compute_resources/foreman/model/libvirt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ class Libvirt < ComputeResource

ALLOWED_DISPLAY_TYPES = %w(vnc spice)

# 'custom' is not implemented. This needs extra UI.
CPU_MODES = %w(default host-model host-passthrough)

validates :url, :format => { :with => URI::DEFAULT_PARSER.make_regexp }, :presence => true
validates :display_type, :inclusion => { :in => ALLOWED_DISPLAY_TYPES }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<div id="cpus_input">
<%= counter_f(f, :cpus, label: _('CPUs'), disabled: !new_vm, recommended_max_value: compute_resource.max_cpu_count) %>
</div>
<%= select_f f, :cpu_mode, Foreman::Model::Libvirt::CPU_MODES, :to_s, :to_s, { }, :label => _("CPU mode"), :label_size => "col-md-2" %>
<%= byte_size_f(f, :memory, disabled: !new_vm, label: _('Memory'), recommended_max_value: compute_resource.max_memory.to_i) %>
<!--TODO # Move to a helper-->
<% checked = params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:start] || '1' %>
Expand Down
2 changes: 1 addition & 1 deletion bundler.d/libvirt.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
group :libvirt do
gem 'fog-libvirt', '>= 0.9.0'
gem 'fog-libvirt', '>= 0.12.0'
gem 'ruby-libvirt', '~> 0.5', :require => 'libvirt'
end
8 changes: 0 additions & 8 deletions lib/fog_extensions/libvirt/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ def to_s
name
end

def cpu_mode
attributes[:cpu][:mode]
end

def cpu_mode=(cpumode)
attributes[:cpu][:mode] = (cpumode == 'default') ? nil : cpumode
end

def nics_attributes=(attrs)
end

Expand Down

0 comments on commit 8097b38

Please sign in to comment.