Merge "Add hw_firmware_stateless image property"
This commit is contained in:
commit
a0450d28f7
@ -4,5 +4,5 @@
|
||||
"hw_architecture": "x86_64"
|
||||
},
|
||||
"nova_object.name": "ImageMetaPropsPayload",
|
||||
"nova_object.version": "1.13"
|
||||
"nova_object.version": "1.14"
|
||||
}
|
||||
|
@ -131,7 +131,8 @@ class ImageMetaPropsPayload(base.NotificationPayloadBase):
|
||||
# Version 1.11: Added 'hw_locked_memory' field
|
||||
# Version 1.12: Added 'hw_viommu_model' field
|
||||
# Version 1.13: Added 'hw_virtio_packed_ring' field
|
||||
VERSION = '1.13'
|
||||
# Version 1.14: Added 'hw_firmware_stateless' field
|
||||
VERSION = '1.14'
|
||||
|
||||
# NOTE(efried): This logic currently relies on all of the fields of
|
||||
# ImageMetaProps being initialized with no arguments. See the docstring.
|
||||
|
@ -196,14 +196,17 @@ class ImageMetaProps(base.NovaObject):
|
||||
# Version 1.36: Added 'hw_maxphysaddr_mode' and
|
||||
# 'hw_maxphysaddr_bits' field
|
||||
# Version 1.37: Added 'hw_ephemeral_encryption_secret_uuid' field
|
||||
# Version 1.38: Added 'hw_firmware_stateless' field
|
||||
# NOTE(efried): When bumping this version, the version of
|
||||
# ImageMetaPropsPayload must also be bumped. See its docstring for details.
|
||||
VERSION = '1.37'
|
||||
VERSION = '1.38'
|
||||
|
||||
def obj_make_compatible(self, primitive, target_version):
|
||||
super(ImageMetaProps, self).obj_make_compatible(primitive,
|
||||
target_version)
|
||||
target_version = versionutils.convert_version_to_tuple(target_version)
|
||||
if target_version < (1, 38):
|
||||
primitive.pop('hw_firmware_stateless', None)
|
||||
if target_version < (1, 37):
|
||||
primitive.pop('hw_ephemeral_encryption_secret_uuid', None)
|
||||
if target_version < (1, 36):
|
||||
@ -378,6 +381,9 @@ class ImageMetaProps(base.NovaObject):
|
||||
# This indicates the guest needs UEFI firmware
|
||||
'hw_firmware_type': fields.FirmwareTypeField(),
|
||||
|
||||
# This indicates the guest needs stateless firmware
|
||||
'hw_firmware_stateless': fields.FlexibleBooleanField(),
|
||||
|
||||
# name of the input bus type to use, e.g. usb, virtio
|
||||
'hw_input_bus': fields.InputBusField(),
|
||||
|
||||
|
@ -1238,7 +1238,7 @@ class TestInstanceNotificationSample(
|
||||
'nova_object.data': {},
|
||||
'nova_object.name': 'ImageMetaPropsPayload',
|
||||
'nova_object.namespace': 'nova',
|
||||
'nova_object.version': '1.13',
|
||||
'nova_object.version': '1.14',
|
||||
},
|
||||
'image.size': 58145823,
|
||||
'image.tags': [],
|
||||
@ -1334,7 +1334,7 @@ class TestInstanceNotificationSample(
|
||||
'nova_object.data': {},
|
||||
'nova_object.name': 'ImageMetaPropsPayload',
|
||||
'nova_object.namespace': 'nova',
|
||||
'nova_object.version': '1.13',
|
||||
'nova_object.version': '1.14',
|
||||
},
|
||||
'image.size': 58145823,
|
||||
'image.tags': [],
|
||||
|
@ -385,7 +385,7 @@ notification_object_data = {
|
||||
# ImageMetaProps, so when you see a fail here for that reason, you must
|
||||
# *also* bump the version of ImageMetaPropsPayload. See its docstring for
|
||||
# more information.
|
||||
'ImageMetaPropsPayload': '1.13-682cfe847d16301734e1fba924063e6d',
|
||||
'ImageMetaPropsPayload': '1.14-af9efd17cd034596be792fa25f24e83d',
|
||||
'InstanceActionNotification': '1.0-a73147b93b520ff0061865849d3dfa56',
|
||||
'InstanceActionPayload': '1.8-b948818df6ec562e4eb4b23e515e451b',
|
||||
'InstanceActionRebuildNotification':
|
||||
|
@ -591,3 +591,20 @@ class TestImageMetaProps(test.NoDBTestCase):
|
||||
self.assertNotIn(
|
||||
'hw_ephemeral_encryption_secret_uuid',
|
||||
primitive['nova_object.data'])
|
||||
|
||||
def test_obj_make_compatible_stateless_firmware(self):
|
||||
"""Check 'hw_firmware_stateless' compatibility."""
|
||||
obj = objects.ImageMetaProps(
|
||||
hw_firmware_stateless=True)
|
||||
|
||||
primitive = obj.obj_to_primitive('1.38')
|
||||
self.assertIn(
|
||||
'hw_firmware_stateless',
|
||||
primitive['nova_object.data'])
|
||||
self.assertTrue(
|
||||
primitive['nova_object.data']['hw_firmware_stateless'])
|
||||
|
||||
primitive = obj.obj_to_primitive('1.37')
|
||||
self.assertNotIn(
|
||||
'hw_firmware_stateless',
|
||||
primitive['nova_object.data'])
|
||||
|
@ -1105,7 +1105,7 @@ object_data = {
|
||||
'HyperVLiveMigrateData': '1.4-e265780e6acfa631476c8170e8d6fce0',
|
||||
'IDEDeviceBus': '1.0-29d4c9f27ac44197f01b6ac1b7e16502',
|
||||
'ImageMeta': '1.8-642d1b2eb3e880a367f37d72dd76162d',
|
||||
'ImageMetaProps': '1.37-1e0d70fb51041c0446b00695c5ef0e21',
|
||||
'ImageMetaProps': '1.38-1f4f4f1b60413aa543e446d716cfbc20',
|
||||
'Instance': '2.8-2727dba5e4a078e6cc848c1f94f7eb24',
|
||||
'InstanceAction': '1.2-9a5abc87fdd3af46f45731960651efb5',
|
||||
'InstanceActionEvent': '1.4-5b1f361bd81989f8bb2c20bb7e8a4cb4',
|
||||
|
Loading…
Reference in New Issue
Block a user