Deploy steps - versioned objects
Adds a 'deploy_step' field to the Node object. Co-Authored-By: Ruby Loo <rloo@oath.com> Change-Id: I3393cc0f6506fe0a8dd655b3e2b9c48fcc921808 Story: #1753128 Task: #22592
This commit is contained in:
parent
f5a5af32a3
commit
aac5bcb3e4
@ -118,7 +118,7 @@ RELEASE_MAPPING = {
|
|||||||
'api': '1.43',
|
'api': '1.43',
|
||||||
'rpc': '1.44',
|
'rpc': '1.44',
|
||||||
'objects': {
|
'objects': {
|
||||||
'Node': ['1.24', '1.25'],
|
'Node': ['1.24', '1.25', '1.26'],
|
||||||
'Conductor': ['1.2'],
|
'Conductor': ['1.2'],
|
||||||
'Chassis': ['1.3'],
|
'Chassis': ['1.3'],
|
||||||
'Port': ['1.8'],
|
'Port': ['1.8'],
|
||||||
|
@ -61,7 +61,8 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat):
|
|||||||
# Version 1.23: Add traits field
|
# Version 1.23: Add traits field
|
||||||
# Version 1.24: Add bios_interface field
|
# Version 1.24: Add bios_interface field
|
||||||
# Version 1.25: Add fault field
|
# Version 1.25: Add fault field
|
||||||
VERSION = '1.25'
|
# Version 1.26: Add deploy_step field
|
||||||
|
VERSION = '1.26'
|
||||||
|
|
||||||
dbapi = db_api.get_instance()
|
dbapi = db_api.get_instance()
|
||||||
|
|
||||||
@ -82,6 +83,11 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat):
|
|||||||
# or has not yet started.
|
# or has not yet started.
|
||||||
'clean_step': object_fields.FlexibleDictField(nullable=True),
|
'clean_step': object_fields.FlexibleDictField(nullable=True),
|
||||||
|
|
||||||
|
# A deploy step dictionary, indicating the current step
|
||||||
|
# being executed, or None, indicating deployment is not in progress
|
||||||
|
# or has not yet started.
|
||||||
|
'deploy_step': object_fields.FlexibleDictField(nullable=True),
|
||||||
|
|
||||||
'raid_config': object_fields.FlexibleDictField(nullable=True),
|
'raid_config': object_fields.FlexibleDictField(nullable=True),
|
||||||
'target_raid_config': object_fields.FlexibleDictField(nullable=True),
|
'target_raid_config': object_fields.FlexibleDictField(nullable=True),
|
||||||
|
|
||||||
@ -477,6 +483,22 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat):
|
|||||||
elif self.fault is not None:
|
elif self.fault is not None:
|
||||||
self.fault = None
|
self.fault = None
|
||||||
|
|
||||||
|
def _convert_deploy_step_field(self, target_version,
|
||||||
|
remove_unavailable_fields=True):
|
||||||
|
# NOTE(rloo): Typically we set the value to None. However,
|
||||||
|
# deploy_step is a FlexibleDictField. Setting it to None
|
||||||
|
# causes it to be set to {} under-the-hood. So I am being
|
||||||
|
# explicit about that here.
|
||||||
|
step_is_set = self.obj_attr_is_set('deploy_step')
|
||||||
|
if target_version >= (1, 26):
|
||||||
|
if not step_is_set:
|
||||||
|
self.deploy_step = {}
|
||||||
|
elif step_is_set:
|
||||||
|
if remove_unavailable_fields:
|
||||||
|
delattr(self, 'deploy_step')
|
||||||
|
elif self.deploy_step:
|
||||||
|
self.deploy_step = {}
|
||||||
|
|
||||||
def _convert_to_version(self, target_version,
|
def _convert_to_version(self, target_version,
|
||||||
remove_unavailable_fields=True):
|
remove_unavailable_fields=True):
|
||||||
"""Convert to the target version.
|
"""Convert to the target version.
|
||||||
@ -496,6 +518,8 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat):
|
|||||||
removed).
|
removed).
|
||||||
Version 1.25: fault field was added. For versions prior to
|
Version 1.25: fault field was added. For versions prior to
|
||||||
this, it should be removed.
|
this, it should be removed.
|
||||||
|
Version 1.26: deploy_step field was added. For versions prior to
|
||||||
|
this, it should be removed.
|
||||||
|
|
||||||
:param target_version: the desired version of the object
|
:param target_version: the desired version of the object
|
||||||
:param remove_unavailable_fields: True to remove fields that are
|
:param remove_unavailable_fields: True to remove fields that are
|
||||||
@ -547,6 +571,8 @@ class Node(base.IronicObject, object_base.VersionedObjectDictCompat):
|
|||||||
self.bios_interface = None
|
self.bios_interface = None
|
||||||
|
|
||||||
self._convert_fault_field(target_version, remove_unavailable_fields)
|
self._convert_fault_field(target_version, remove_unavailable_fields)
|
||||||
|
self._convert_deploy_step_field(target_version,
|
||||||
|
remove_unavailable_fields)
|
||||||
|
|
||||||
|
|
||||||
@base.IronicObjectRegistry.register
|
@base.IronicObjectRegistry.register
|
||||||
|
@ -664,7 +664,7 @@ class TestObject(_LocalTest, _TestObject):
|
|||||||
# version bump. It is an MD5 hash of the object fields and remotable methods.
|
# version bump. It is an MD5 hash of the object fields and remotable methods.
|
||||||
# The fingerprint values should only be changed if there is a version bump.
|
# The fingerprint values should only be changed if there is a version bump.
|
||||||
expected_object_fingerprints = {
|
expected_object_fingerprints = {
|
||||||
'Node': '1.25-3a468b3e88d0a8fe7709f822fc654e4b',
|
'Node': '1.26-31732244b5bc3f8c334f77c03449f4c6',
|
||||||
'MyObj': '1.5-9459d30d6954bffc7a9afd347a807ca6',
|
'MyObj': '1.5-9459d30d6954bffc7a9afd347a807ca6',
|
||||||
'Chassis': '1.3-d656e039fd8ae9f34efc232ab3980905',
|
'Chassis': '1.3-d656e039fd8ae9f34efc232ab3980905',
|
||||||
'Port': '1.8-898a47921f4a1f53fcdddd4eeb179e0b',
|
'Port': '1.8-898a47921f4a1f53fcdddd4eeb179e0b',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user