From 39b13b06577c39470104344758033f90d398cd1f Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 3 Jul 2023 20:16:01 +0200 Subject: [PATCH] Set the default machine type to q35 on i686 and x86_64 The pc type has been deprecated and on EL9 it's even unsupported. The type on aarch64 is virt, so there we continue to rely on the default. --- lib/fog/libvirt/models/compute/server.rb | 10 +++++++--- tests/libvirt/models/compute/server_tests.rb | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/fog/libvirt/models/compute/server.rb b/lib/fog/libvirt/models/compute/server.rb index 90f2555..5c3e6b9 100644 --- a/lib/fog/libvirt/models/compute/server.rb +++ b/lib/fog/libvirt/models/compute/server.rb @@ -282,7 +282,8 @@ def to_xml xml.vcpu(cpus) xml.os do - xml.type(os_type, :arch => arch) + type = xml.type(os_type, :arch => arch) + type[:machine] = "q35" if ["i686", "x86_64"].include?(arch) boot_order.each do |dev| xml.boot(:dev => dev) @@ -291,7 +292,6 @@ def to_xml xml.features do xml.acpi xml.apic - xml.pae end unless cpu.empty? @@ -308,7 +308,11 @@ def to_xml end end - xml.clock(:offset => "utc") + xml.clock(:offset => "utc") do + xml.timer(:name => "rtc", :tickpolicy => "catchup") + xml.timer(:name => "pit", :tickpolicy => "delay") + xml.timer(:name => "hpet", :present => "no") + end xml.devices do ceph_args = read_ceph_args diff --git a/tests/libvirt/models/compute/server_tests.rb b/tests/libvirt/models/compute/server_tests.rb index 61419b8..6983cbb 100644 --- a/tests/libvirt/models/compute/server_tests.rb +++ b/tests/libvirt/models/compute/server_tests.rb @@ -77,6 +77,7 @@ xml = server.to_xml xml.match?(//) && xml.match?(%r{}) end + test("with q35 machine type on x86_64") { server.to_xml.match?(%r{hvm}) } end end end