Don't assume the guest machine type to be of 'pc'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
Background
----------
QEMU supports two main variants of "machine type" (a virtual chipset)
for x86 hosts: (a) 'pc', which corresponds to Intel's 'i440FX' chipset
-- that is 22 years old, and is based on PCI and IDE; and (b) 'q35',
which corresponds to Intel's 82Q35 chipset, relatively modern; still, 11
years old. (For AArch64 hosts, the machine type is called: 'virt'.)
The 'q35' machine type provides some advanced features by default:
native PCIe hotplug (which is faster than ACPI-based hotplug, which
older 'pc' machine type uses), IOMMU, faster SATA emulation, Secure Boot
and so forth. (Details: https:/
Proposed change
---------------
QEMU plans to change the default machine type to 'q35', so that they can
get rid of the legacy machine type 'pc'. Nova should be prepared to not
break when that happens. (Refer the "What will break?" section below.)
How does Nova handle machine types today?
-------
By default, Nova does not hard-code any machine type for x86 arch; but for non-x86 architectures, Nova *does* assume the machine type to be of 'pc' — which is the bug we're aiming to fix here.
(NB: For x86, Nova just uses whatever libvirt provides it by default — this is not desirable in the long term, and will be addressed, to pick the guest machine type based on the its capabilities, as part of a separate blueprint / specification.)
Nova allows configuring machine type in two ways:
(1) Disk image metadata property, so that when you boot a guest from
that disk image, it gets the configured machine type:
$ openstack image set \
(2) Per-Compute host configuration file, so that _all_ guests launched
on that host gets the configured machine type:
[libvirt]
...
What will break?
----------------
From a discussion with libvirt and QEMU developers (thanks: Eduardo
Habkost, Daniel Berrangé), management applications like Nova will
break _only_ if we have a code pattern like:
if guest_machine_type == q35:
... do something 'q35' related ...
else:
... do something 'pc' related ...
As the above code pattern assumes that not providing a machine type will
result in 'pc'. So we should avoid such a pattern.
Auditing the Nova code[+], we precisely have the above pattern when
configuring PCIe ports (from nova/virt/
_get_guest_config() function):
[...]
# Add PCIe root port controllers for PCI Express machines
# but only if their amount is configured
if (CONF.libvirt.
[...]
The above code is assuming when 'guest.
have 'pc' machine type -- which is _not_ going to be valid in the
future.
To fix this, Nova needs to make sure 'guest.
[*] http://
Allow to configure amount of PCIe ports
tags: | added: libvirt |
description: | updated |
description: | updated |
Changed in nova: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
Changed in nova: | |
assignee: | nobody → Kashyap Chamarthy (kashyapc) |
summary: |
- Gracefully handle when QEMU switches its default machine to 'q35' + Gracefully handle when QEMU switches its default machine type to 'q35' |
description: | updated |
summary: |
- Gracefully handle when QEMU switches its default machine type to 'q35' + Don't assume the guest machine type to be of 'pc' |
Changed in nova: | |
assignee: | Kashyap Chamarthy (kashyapc) → nobody |
Related to this problem, upstream libvirt has merged this patch:
https:/ /www.redhat. com/archives/ libvir- list/2018- August/ msg00135. html -- "qemu: ensure
"pc" machine is always used as default if available"