@@ -6807,38 +6807,28 @@ def _guest_needs_pcie(self, guest):
6807
6807
"""
6808
6808
caps = self._host.get_capabilities()
6809
6809
6810
- # TODO(kchamart) In the third 'if' conditional below, for 'x86'
6811
- # arch, we're assuming: when 'os_mach_type' is 'None', you'll
6812
- # have "pc" machine type. That assumption, although it is
6813
- # correct for the "forseeable future", it will be invalid when
6814
- # libvirt / QEMU changes the default machine types.
6815
- #
6816
- # From libvirt 4.7.0 onwards (September 2018), it will ensure
6817
- # that *if* 'pc' is available, it will be used as the default --
6818
- # to not break existing applications. (Refer:
6819
- # https://libvirt.org/git/?p=libvirt.git;a=commit;h=26cfb1a3
6820
- # --"qemu: ensure default machine types don't change if QEMU
6821
- # changes").
6822
- #
6823
- # But even if libvirt (>=v4.7.0) handled the default case,
6824
- # relying on such assumptions is not robust. Instead we should
6825
- # get the default machine type for a given architecture reliably
6826
- # -- by Nova setting it explicitly (we already do it for Arm /
6827
- # AArch64 & s390x). A part of this bug is being tracked here:
6828
- # https://bugs.launchpad.net/nova/+bug/1780138).
6829
-
6830
6810
# Add PCIe root port controllers for PCI Express machines
6831
6811
# but only if their amount is configured
6832
6812
6833
6813
if not CONF.libvirt.num_pcie_ports:
6834
6814
return False
6835
- if (caps.host.cpu.arch == fields.Architecture.AARCH64 and
6836
- guest.os_mach_type.startswith('virt')):
6815
+
6816
+ # Only certain architectures and machine types can handle PCIe ports;
6817
+ # the latter will be handled by libvirt.utils.get_machine_type
6818
+
6819
+ if (
6820
+ caps.host.cpu.arch == fields.Architecture.AARCH64 and
6821
+ guest.os_mach_type.startswith('virt')
6822
+ ):
6837
6823
return True
6838
- if (caps.host.cpu.arch == fields.Architecture.X86_64 and
6839
- guest.os_mach_type is not None and
6840
- 'q35' in guest.os_mach_type):
6824
+
6825
+ if (
6826
+ caps.host.cpu.arch == fields.Architecture.X86_64 and
6827
+ guest.os_mach_type is not None and
6828
+ 'q35' in guest.os_mach_type
6829
+ ):
6841
6830
return True
6831
+
6842
6832
return False
6843
6833
6844
6834
def _get_guest_config(self, instance, network_info, image_meta,
0 commit comments