Skip to content

Commit

Permalink
Set the default machine type to q35 on i686 and x86_64
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ekohl committed Oct 19, 2023
1 parent 7a3a46b commit 39b13b0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/fog/libvirt/models/compute/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -291,7 +292,6 @@ def to_xml
xml.features do
xml.acpi
xml.apic
xml.pae
end

unless cpu.empty?
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/libvirt/models/compute/server_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
xml = server.to_xml
xml.match?(/<disk type="block" device="disk">/) && xml.match?(%r{<source dev="/dev/sda"/>})
end
test("with q35 machine type on x86_64") { server.to_xml.match?(%r{<type arch="x86_64" machine="q35">hvm</type>}) }
end
end
end

0 comments on commit 39b13b0

Please sign in to comment.