From 298054e6406d32ff23568358355fb4419fcd3132 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 20 Feb 2020 14:44:05 +0000 Subject: [PATCH] trivial: Update '_get_foo_traits' docstrings These stated they could return None but that wasn't true. Correct this. Change-Id: I3bbeedef70e4b94225e1a042cf4e59fb12bcaa92 Signed-off-by: Stephen Finucane --- nova/virt/libvirt/driver.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index 956ef895bc..4a857a6840 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -10359,7 +10359,7 @@ class LibvirtDriver(driver.ComputeDriver): """Get CPU-related traits to be set and unset on the host's resource provider. - :return: A dict of trait names mapped to boolean values or None. + :return: A dict of trait names mapped to boolean values. """ traits = self._get_cpu_feature_traits() traits[ot.HW_CPU_X86_AMD_SEV] = self._host.supports_amd_sev @@ -10368,16 +10368,19 @@ class LibvirtDriver(driver.ComputeDriver): return traits def _get_cpu_feature_traits(self): - """Get CPU traits of VMs based on guest CPU model config: - 1. if mode is 'host-model' or 'host-passthrough', use host's - CPU features. - 2. if mode is None, choose a default CPU model based on CPU - architecture. - 3. if mode is 'custom', use cpu_models to generate CPU features. + """Get CPU traits of VMs based on guest CPU model config. + + 1. If mode is 'host-model' or 'host-passthrough', use host's + CPU features. + 2. If mode is None, choose a default CPU model based on CPU + architecture. + 3. If mode is 'custom', use cpu_models to generate CPU features. + The code also accounts for cpu_model_extra_flags configuration when cpu_mode is 'host-model', 'host-passthrough' or 'custom', this ensures user specified CPU feature flags to be included. - :return: A dict of trait names mapped to boolean values or None. + + :return: A dict of trait names mapped to boolean values. """ cpu = self._get_guest_cpu_model_config() if not cpu: