Skip to content

Commit bcb96f3

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "libvirt: Remove unnecessary TODO"
2 parents 9d8a8d8 + f08b71f commit bcb96f3

File tree

1 file changed

+15
-25
lines changed

1 file changed

+15
-25
lines changed

nova/virt/libvirt/driver.py

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6807,38 +6807,28 @@ def _guest_needs_pcie(self, guest):
68076807
"""
68086808
caps = self._host.get_capabilities()
68096809

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-
68306810
# Add PCIe root port controllers for PCI Express machines
68316811
# but only if their amount is configured
68326812

68336813
if not CONF.libvirt.num_pcie_ports:
68346814
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+
):
68376823
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+
):
68416830
return True
6831+
68426832
return False
68436833

68446834
def _get_guest_config(self, instance, network_info, image_meta,

0 commit comments

Comments
 (0)