hyperv: Configures chassis asset tags for VMs.
The Msvm_VirtualSystemSettingData object associated with a VM has a
field named "ChassisAssetTag". The value set in this field is reflected
in Linux VMs in /sys/class/dmi/id/chassis-asset-tag. This value is
checked by cloud-init in order to figure out if it is currently running
inside an OpenStack VM.
The verification above has been introduced in cloud-init [1] in order to
avoid costly metadata probes that aren't needed in non-OpenStack VMs.
Setting the ChassisAssetTag will allow us to pass these checks. The
value we are setting is similar to what libvirt is setting in the
LibvirtConfigGuestSysinfo.
[1] 1efa8a0a03
Partially-Fixes: #1895976
Change-Id: Ib9f605f68c79ff41d3959c7a1662a9e644fde946
Depends-On: 33e6c07dab4b46442bf0fbb838d59516112899b9
This commit is contained in:
parent
e7021d221a
commit
32a46037e9
@ -30,6 +30,7 @@ from nova import exception
|
||||
from nova import objects
|
||||
from nova.objects import fields
|
||||
from nova import utils
|
||||
from nova import version
|
||||
from nova.virt import configdrive
|
||||
from nova.virt import event as virtevent
|
||||
from nova.virt import hardware
|
||||
@ -470,7 +471,8 @@ class VMOps(object):
|
||||
dynamic_memory_ratio,
|
||||
configuration_root_dir=instance_path,
|
||||
host_shutdown_action=host_shutdown_action,
|
||||
vnuma_enabled=vnuma_enabled)
|
||||
vnuma_enabled=vnuma_enabled,
|
||||
chassis_asset_tag=version.product_string())
|
||||
|
||||
self._set_instance_disk_qos_specs(instance, is_resize)
|
||||
self._attach_pci_devices(instance, is_resize)
|
||||
|
@ -722,6 +722,7 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
|
||||
mock_update_vm_resources.assert_called_once_with(
|
||||
mock_instance, mock.sentinel.vm_gen, mock.sentinel.image_meta)
|
||||
|
||||
@mock.patch.object(vmops.version, 'product_string')
|
||||
@mock.patch.object(vmops.VMOps, '_attach_pci_devices')
|
||||
@mock.patch.object(vmops.VMOps, '_set_instance_disk_qos_specs')
|
||||
@mock.patch.object(vmops.VMOps, '_get_instance_dynamic_memory_ratio')
|
||||
@ -732,6 +733,7 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
|
||||
mock_get_dynamic_memory_ratio,
|
||||
mock_set_qos_specs,
|
||||
mock_attach_pci_devices,
|
||||
mock_product_string,
|
||||
pci_requests=None,
|
||||
instance_automatic_shutdown=False):
|
||||
self.flags(instance_automatic_shutdown=instance_automatic_shutdown,
|
||||
@ -768,7 +770,8 @@ class VMOpsTestCase(test_base.HyperVBaseTestCase):
|
||||
dynamic_memory_ratio,
|
||||
configuration_root_dir=mock.sentinel.instance_path,
|
||||
host_shutdown_action=host_shutdown_action,
|
||||
vnuma_enabled=True)
|
||||
vnuma_enabled=True,
|
||||
chassis_asset_tag=mock_product_string.return_value)
|
||||
mock_set_qos_specs.assert_called_once_with(mock_instance,
|
||||
mock.sentinel.is_resize)
|
||||
mock_attach_pci_devices.assert_called_once_with(
|
||||
|
@ -33,7 +33,7 @@ netifaces==0.10.6
|
||||
openstackdocstheme==2.2.1
|
||||
os-brick==2.2.0
|
||||
os-client-config==1.29.0
|
||||
os-win==3.0.0
|
||||
os-win==5.2.0
|
||||
oslo.concurrency==3.26.0
|
||||
oslo.config==5.2.0
|
||||
oslo.context==2.20.0
|
||||
|
@ -6,7 +6,7 @@ pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||
Babel!=2.4.0,>=2.3.4 # BSD
|
||||
|
||||
os-brick>=2.2.0 # Apache-2.0
|
||||
os-win>=3.0.0 # Apache-2.0
|
||||
os-win>=5.2.0 # Apache-2.0
|
||||
oslo.config>=5.2.0 # Apache-2.0
|
||||
oslo.log>=3.36.0 # Apache-2.0
|
||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
|
Loading…
Reference in New Issue
Block a user