From f96ddfba0316ae0e5c0998d020213a149ef950d4 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 19 Dec 2023 18:17:14 +0100 Subject: [PATCH] Fixes #36999 - Drop libvirt CPU model option for VM creation 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. --- app/models/compute_resources/foreman/model/libvirt.rb | 3 --- .../compute_resources_vms/form/libvirt/_base.html.erb | 1 - bundler.d/libvirt.rb | 2 +- lib/fog_extensions/libvirt/server.rb | 8 -------- 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/app/models/compute_resources/foreman/model/libvirt.rb b/app/models/compute_resources/foreman/model/libvirt.rb index ee2cbc38fec4..81ea35ec8274 100644 --- a/app/models/compute_resources/foreman/model/libvirt.rb +++ b/app/models/compute_resources/foreman/model/libvirt.rb @@ -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 } diff --git a/app/views/compute_resources_vms/form/libvirt/_base.html.erb b/app/views/compute_resources_vms/form/libvirt/_base.html.erb index d6378df16b18..ff89e988221f 100644 --- a/app/views/compute_resources_vms/form/libvirt/_base.html.erb +++ b/app/views/compute_resources_vms/form/libvirt/_base.html.erb @@ -3,7 +3,6 @@
<%= counter_f(f, :cpus, label: _('CPUs'), disabled: !new_vm, recommended_max_value: compute_resource.max_cpu_count) %>
-<%= 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) %> <% checked = params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:start] || '1' %> diff --git a/bundler.d/libvirt.rb b/bundler.d/libvirt.rb index 9a77139a6c7c..80b3f8c5a129 100644 --- a/bundler.d/libvirt.rb +++ b/bundler.d/libvirt.rb @@ -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 diff --git a/lib/fog_extensions/libvirt/server.rb b/lib/fog_extensions/libvirt/server.rb index c3c0898d1533..fb319f46275d 100644 --- a/lib/fog_extensions/libvirt/server.rb +++ b/lib/fog_extensions/libvirt/server.rb @@ -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