diff --git a/doc/source/user/flavors.rst b/doc/source/user/flavors.rst index 3e24fc0072d9..740a4edee025 100644 --- a/doc/source/user/flavors.rst +++ b/doc/source/user/flavors.rst @@ -706,10 +706,14 @@ Hiding hypervisor signature As of the 18.0.0 Rocky release, this is only supported by the libvirt driver. + Prior to the 21.0.0 Ussuri release, this was called + ``hide_hypervisor_id``. An alias is provided to provide backwards + compatibility. + .. code:: console $ openstack flavor set FLAVOR-NAME \ - --property hide_hypervisor_id=VALUE + --property hw:hide_hypervisor_id=VALUE Where: diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 3b131f4da71e..4fec9db3862b 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -4445,6 +4445,19 @@ class LibvirtConnTestCase(test.NoDBTestCase, self._test_get_guest_config_windows_hyperv() def test_get_guest_config_windows_hyperv_all_hide_flv(self): + # Similar to test_get_guest_config_windows_hyperv_feature2 + # but also test hiding the HyperV signature with the flavor + # extra_spec "hw:hide_hypervisor_id" + flavor_hide_id = fake_flavor.fake_flavor_obj(self.context, + extra_specs={"hw:hide_hypervisor_id": "true"}, + expected_attrs={"extra_specs"}) + # this works for kvm (the default, tested below) and qemu + self.flags(virt_type='qemu', group='libvirt') + + self._test_get_guest_config_windows_hyperv( + flavor=flavor_hide_id, hvid_hidden=True) + + def test_get_guest_config_windows_hyperv_all_hide_flv_old(self): # Similar to test_get_guest_config_windows_hyperv_feature2 # but also test hiding the HyperV signature with the flavor # extra_spec "hide_hypervisor_id" @@ -4471,10 +4484,10 @@ class LibvirtConnTestCase(test.NoDBTestCase, def test_get_guest_config_windows_hyperv_all_hide_flv_img(self): # Similar to test_get_guest_config_windows_hyperv_feature2 # but also test hiding the HyperV signature with both the flavor - # extra_spec "hide_hypervisor_id" and the image property + # extra_spec "hw:hide_hypervisor_id" and the image property # "img_hide_hypervisor_id" flavor_hide_id = fake_flavor.fake_flavor_obj(self.context, - extra_specs={"hide_hypervisor_id": "true"}, + extra_specs={"hw:hide_hypervisor_id": "true"}, expected_attrs={"extra_specs"}) self.flags(virt_type='qemu', group='libvirt') @@ -6518,7 +6531,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, self): # Input to the test: flavor extra_specs flavor_hide_id = fake_flavor.fake_flavor_obj(self.context, - extra_specs={"hide_hypervisor_id": "true"}, + extra_specs={"hw:hide_hypervisor_id": "true"}, expected_attrs={"extra_specs"}) self.flags(virt_type='kvm', group='libvirt') @@ -6544,7 +6557,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, # Input to the test: image metadata (true) and flavor # extra_specs (true) flavor_hide_id = fake_flavor.fake_flavor_obj(self.context, - extra_specs={"hide_hypervisor_id": "true"}, + extra_specs={"hw:hide_hypervisor_id": "true"}, expected_attrs={"extra_specs"}) image_meta = objects.ImageMeta.from_dict({ "disk_format": "raw", @@ -6571,7 +6584,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, # Input to the test: image metadata (false) and flavor # extra_specs (true) flavor_hide_id = fake_flavor.fake_flavor_obj(self.context, - extra_specs={"hide_hypervisor_id": "true"}, + extra_specs={"hw:hide_hypervisor_id": "true"}, expected_attrs={"extra_specs"}) image_meta = objects.ImageMeta.from_dict({ "disk_format": "raw", @@ -6596,7 +6609,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, # Input to the test: image metadata (true) and flavor # extra_specs (false) flavor_hide_id = fake_flavor.fake_flavor_obj(self.context, - extra_specs={"hide_hypervisor_id": "false"}, + extra_specs={"hw:hide_hypervisor_id": "false"}, expected_attrs={"extra_specs"}) image_meta = objects.ImageMeta.from_dict({ "disk_format": "raw", @@ -6643,7 +6656,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, def test_get_guest_config_without_hiding_hypervisor_id_flavor_extra_specs( self): flavor_hide_id = fake_flavor.fake_flavor_obj(self.context, - extra_specs={"hide_hypervisor_id": "false"}, + extra_specs={"hw:hide_hypervisor_id": "false"}, expected_attrs={"extra_specs"}) self.flags(virt_type='qemu', group='libvirt') diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index f4df91e4940d..aead8470b299 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -5126,7 +5126,9 @@ class LibvirtDriver(driver.ComputeDriver): flavor): hide_hypervisor_id = (strutils.bool_from_string( flavor.extra_specs.get('hide_hypervisor_id')) or - image_meta.properties.get('img_hide_hypervisor_id')) + strutils.bool_from_string( + flavor.extra_specs.get('hw:hide_hypervisor_id')) or + image_meta.properties.get('img_hide_hypervisor_id')) if virt_type == "xen": # PAE only makes sense in X86 diff --git a/releasenotes/notes/bug-1841932-c871ac7b3b05d67e.yaml b/releasenotes/notes/bug-1841932-c871ac7b3b05d67e.yaml new file mode 100644 index 000000000000..d54be4f03a94 --- /dev/null +++ b/releasenotes/notes/bug-1841932-c871ac7b3b05d67e.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Add support for the ``hw:hide_hypervisor_id`` extra spec. This is an + alias for the ``hide_hypervisor_id`` extra spec, which was not + compatible with the ``AggregateInstanceExtraSpecsFilter`` scheduler + filter. See + `bug 1841932 `_ for more + details.