replace the "hide_hypervisor_id" to "hw:hide_hypervisor_id"
When we use the flavor extra_specs "hide_hypervisor_id" in
AggregateInstanceExtraSpecsFilter, then will retrun False.
So we need correct the extra_specs.
Change-Id: I9d8d8c3a30cf6da7e8fb48374347e069ab075df2
Closes-Bug: 1841932
(cherry picked from commit bf488a8630
)
This commit is contained in:
parent
36eefd9c0e
commit
9d28d7ec80
|
@ -738,10 +738,14 @@ Hiding hypervisor signature
|
||||||
As of the 18.0.0 Rocky release, this is only supported by the libvirt
|
As of the 18.0.0 Rocky release, this is only supported by the libvirt
|
||||||
driver.
|
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
|
.. code:: console
|
||||||
|
|
||||||
$ openstack flavor set FLAVOR-NAME \
|
$ openstack flavor set FLAVOR-NAME \
|
||||||
--property hide_hypervisor_id=VALUE
|
--property hw:hide_hypervisor_id=VALUE
|
||||||
|
|
||||||
Where:
|
Where:
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,20 @@ realtime_validators = [
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
hide_hypervisor_id_validator = [
|
||||||
|
base.ExtraSpecValidator(
|
||||||
|
name='hw:hide_hypervisor_id',
|
||||||
|
description=(
|
||||||
|
'Determine whether the hypervisor ID should be hidden from the '
|
||||||
|
'guest. Only supported by the libvirt driver.'
|
||||||
|
),
|
||||||
|
value={
|
||||||
|
'type': bool,
|
||||||
|
'description': 'Whether to hide the hypervisor ID.',
|
||||||
|
},
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
cpu_policy_validators = [
|
cpu_policy_validators = [
|
||||||
base.ExtraSpecValidator(
|
base.ExtraSpecValidator(
|
||||||
name='hw:cpu_policy',
|
name='hw:cpu_policy',
|
||||||
|
@ -362,6 +376,7 @@ feature_flag_validators = [
|
||||||
def register():
|
def register():
|
||||||
return (
|
return (
|
||||||
realtime_validators +
|
realtime_validators +
|
||||||
|
hide_hypervisor_id_validator +
|
||||||
cpu_policy_validators +
|
cpu_policy_validators +
|
||||||
hugepage_validators +
|
hugepage_validators +
|
||||||
numa_validators +
|
numa_validators +
|
||||||
|
|
|
@ -17,19 +17,23 @@
|
||||||
from nova.api.validation.extra_specs import base
|
from nova.api.validation.extra_specs import base
|
||||||
|
|
||||||
|
|
||||||
# TODO(stephenfin): These should be moved to a namespace
|
|
||||||
EXTRA_SPEC_VALIDATORS = [
|
EXTRA_SPEC_VALIDATORS = [
|
||||||
base.ExtraSpecValidator(
|
base.ExtraSpecValidator(
|
||||||
name='hide_hypervisor_id',
|
name='hide_hypervisor_id',
|
||||||
description=(
|
description=(
|
||||||
'Determine whether the hypervisor ID should be hidden from the '
|
'Determine whether the hypervisor ID should be hidden from the '
|
||||||
'guest. Only supported by the libvirt driver.'
|
'guest. Only supported by the libvirt driver. This extra spec is '
|
||||||
|
'not compatible with the AggregateInstanceExtraSpecsFilter '
|
||||||
|
'scheduler filter. The ``hw:hide_hypervisor_id`` extra spec '
|
||||||
|
'should be used instead.'
|
||||||
),
|
),
|
||||||
value={
|
value={
|
||||||
'type': bool,
|
'type': bool,
|
||||||
'description': 'Whether to hide the hypervisor ID.',
|
'description': 'Whether to hide the hypervisor ID.',
|
||||||
},
|
},
|
||||||
|
deprecated=True,
|
||||||
),
|
),
|
||||||
|
# TODO(stephenfin): This should be moved to a namespace
|
||||||
base.ExtraSpecValidator(
|
base.ExtraSpecValidator(
|
||||||
name='group_policy',
|
name='group_policy',
|
||||||
description=(
|
description=(
|
||||||
|
|
|
@ -297,6 +297,7 @@ class FlavorsExtraSpecsTestV21(test.TestCase):
|
||||||
def test_create_valid_specs(self, mock_flavor_extra_specs):
|
def test_create_valid_specs(self, mock_flavor_extra_specs):
|
||||||
valid_specs = {
|
valid_specs = {
|
||||||
'hide_hypervisor_id': 'true',
|
'hide_hypervisor_id': 'true',
|
||||||
|
'hw:hide_hypervisor_id': 'true',
|
||||||
'hw:numa_nodes': '1',
|
'hw:numa_nodes': '1',
|
||||||
'hw:numa_cpus.0': '0-3,8-9,11,10',
|
'hw:numa_cpus.0': '0-3,8-9,11,10',
|
||||||
'resources:VCPU': '4',
|
'resources:VCPU': '4',
|
||||||
|
|
|
@ -4522,6 +4522,19 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
self._test_get_guest_config_windows_hyperv()
|
self._test_get_guest_config_windows_hyperv()
|
||||||
|
|
||||||
def test_get_guest_config_windows_hyperv_all_hide_flv(self):
|
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
|
# Similar to test_get_guest_config_windows_hyperv_feature2
|
||||||
# but also test hiding the HyperV signature with the flavor
|
# but also test hiding the HyperV signature with the flavor
|
||||||
# extra_spec "hide_hypervisor_id"
|
# extra_spec "hide_hypervisor_id"
|
||||||
|
@ -4548,10 +4561,10 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
def test_get_guest_config_windows_hyperv_all_hide_flv_img(self):
|
def test_get_guest_config_windows_hyperv_all_hide_flv_img(self):
|
||||||
# Similar to test_get_guest_config_windows_hyperv_feature2
|
# Similar to test_get_guest_config_windows_hyperv_feature2
|
||||||
# but also test hiding the HyperV signature with both the flavor
|
# 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"
|
# "img_hide_hypervisor_id"
|
||||||
flavor_hide_id = fake_flavor.fake_flavor_obj(self.context,
|
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"})
|
expected_attrs={"extra_specs"})
|
||||||
self.flags(virt_type='qemu', group='libvirt')
|
self.flags(virt_type='qemu', group='libvirt')
|
||||||
|
|
||||||
|
@ -6624,7 +6637,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
self):
|
self):
|
||||||
# Input to the test: flavor extra_specs
|
# Input to the test: flavor extra_specs
|
||||||
flavor_hide_id = fake_flavor.fake_flavor_obj(self.context,
|
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"})
|
expected_attrs={"extra_specs"})
|
||||||
|
|
||||||
self.flags(virt_type='kvm', group='libvirt')
|
self.flags(virt_type='kvm', group='libvirt')
|
||||||
|
@ -6650,7 +6663,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
# Input to the test: image metadata (true) and flavor
|
# Input to the test: image metadata (true) and flavor
|
||||||
# extra_specs (true)
|
# extra_specs (true)
|
||||||
flavor_hide_id = fake_flavor.fake_flavor_obj(self.context,
|
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"})
|
expected_attrs={"extra_specs"})
|
||||||
image_meta = objects.ImageMeta.from_dict({
|
image_meta = objects.ImageMeta.from_dict({
|
||||||
"disk_format": "raw",
|
"disk_format": "raw",
|
||||||
|
@ -6677,7 +6690,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
# Input to the test: image metadata (false) and flavor
|
# Input to the test: image metadata (false) and flavor
|
||||||
# extra_specs (true)
|
# extra_specs (true)
|
||||||
flavor_hide_id = fake_flavor.fake_flavor_obj(self.context,
|
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"})
|
expected_attrs={"extra_specs"})
|
||||||
image_meta = objects.ImageMeta.from_dict({
|
image_meta = objects.ImageMeta.from_dict({
|
||||||
"disk_format": "raw",
|
"disk_format": "raw",
|
||||||
|
@ -6702,7 +6715,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
# Input to the test: image metadata (true) and flavor
|
# Input to the test: image metadata (true) and flavor
|
||||||
# extra_specs (false)
|
# extra_specs (false)
|
||||||
flavor_hide_id = fake_flavor.fake_flavor_obj(self.context,
|
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"})
|
expected_attrs={"extra_specs"})
|
||||||
image_meta = objects.ImageMeta.from_dict({
|
image_meta = objects.ImageMeta.from_dict({
|
||||||
"disk_format": "raw",
|
"disk_format": "raw",
|
||||||
|
@ -6749,7 +6762,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
||||||
def test_get_guest_config_without_hiding_hypervisor_id_flavor_extra_specs(
|
def test_get_guest_config_without_hiding_hypervisor_id_flavor_extra_specs(
|
||||||
self):
|
self):
|
||||||
flavor_hide_id = fake_flavor.fake_flavor_obj(self.context,
|
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"})
|
expected_attrs={"extra_specs"})
|
||||||
|
|
||||||
self.flags(virt_type='qemu', group='libvirt')
|
self.flags(virt_type='qemu', group='libvirt')
|
||||||
|
|
|
@ -5284,6 +5284,8 @@ class LibvirtDriver(driver.ComputeDriver):
|
||||||
flavor):
|
flavor):
|
||||||
hide_hypervisor_id = (strutils.bool_from_string(
|
hide_hypervisor_id = (strutils.bool_from_string(
|
||||||
flavor.extra_specs.get('hide_hypervisor_id')) or
|
flavor.extra_specs.get('hide_hypervisor_id')) or
|
||||||
|
strutils.bool_from_string(
|
||||||
|
flavor.extra_specs.get('hw:hide_hypervisor_id')) or
|
||||||
image_meta.properties.get('img_hide_hypervisor_id'))
|
image_meta.properties.get('img_hide_hypervisor_id'))
|
||||||
|
|
||||||
if virt_type == "xen":
|
if virt_type == "xen":
|
||||||
|
|
|
@ -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 <https://bugs.launchpad.net/nova/+bug/1841932>`_ for more
|
||||||
|
details.
|
Loading…
Reference in New Issue