Merge "Add uuid field in ContainerAction object"
This commit is contained in:
commit
c0446842da
@ -27,7 +27,8 @@ LOG = logging.getLogger(__name__)
|
||||
class ContainerAction(base.ZunPersistentObject, base.ZunObject):
|
||||
|
||||
# Version 1.0: Initial version
|
||||
VERSION = '1.0'
|
||||
# Version 1.1: Add uuid column.
|
||||
VERSION = '1.1'
|
||||
|
||||
fields = {
|
||||
'id': fields.IntegerField(),
|
||||
@ -39,12 +40,13 @@ class ContainerAction(base.ZunPersistentObject, base.ZunObject):
|
||||
'start_time': fields.DateTimeField(nullable=True),
|
||||
'finish_time': fields.DateTimeField(nullable=True),
|
||||
'message': fields.StringField(nullable=True),
|
||||
'uuid': fields.StringField(nullable=True),
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
def _from_db_object(context, action, db_action):
|
||||
for field in action.fields:
|
||||
setattr(action, field, db_action[field])
|
||||
setattr(action, field, getattr(db_action, field, None))
|
||||
|
||||
action.obj_reset_changes()
|
||||
return action
|
||||
|
@ -403,8 +403,13 @@ def create_test_capsule(**kwargs):
|
||||
return dbapi.create_capsule(kwargs['context'], capsule)
|
||||
|
||||
|
||||
class FakeObject(object):
|
||||
def __getitem__(self, key):
|
||||
return getattr(self, key)
|
||||
|
||||
|
||||
def get_test_action(**kwargs):
|
||||
return {
|
||||
action_values = {
|
||||
'created_at': kwargs.get('created_at'),
|
||||
'updated_at': kwargs.get('updated_at'),
|
||||
'id': kwargs.get('id', 123),
|
||||
@ -419,9 +424,15 @@ def get_test_action(**kwargs):
|
||||
'message': kwargs.get('message', 'fake-message'),
|
||||
}
|
||||
|
||||
fake_action = FakeObject()
|
||||
for k, v in action_values.items():
|
||||
setattr(fake_action, k, v)
|
||||
return fake_action
|
||||
|
||||
|
||||
def get_test_action_event(**kwargs):
|
||||
return {
|
||||
|
||||
event_values = {
|
||||
'created_at': kwargs.get('created_at'),
|
||||
'updated_at': kwargs.get('updated_at'),
|
||||
'id': kwargs.get('id', 123),
|
||||
@ -432,3 +443,8 @@ def get_test_action_event(**kwargs):
|
||||
'result': kwargs.get('result', 'Error'),
|
||||
'traceback': kwargs.get('traceback', 'fake-tb'),
|
||||
}
|
||||
|
||||
fake_event = FakeObject()
|
||||
for k, v in event_values.items():
|
||||
setattr(fake_event, k, v)
|
||||
return fake_event
|
||||
|
@ -360,7 +360,7 @@ object_data = {
|
||||
'PciDevicePoolList': '1.0-15ecf022a68ddbb8c2a6739cfc9f8f5e',
|
||||
'ContainerPCIRequest': '1.0-b060f9f9f734bedde79a71a4d3112ee0',
|
||||
'ContainerPCIRequests': '1.0-7b8f7f044661fe4e24e6949c035af2c4',
|
||||
'ContainerAction': '1.0-8d6facdc65855c6c6afbed8531209279',
|
||||
'ContainerAction': '1.1-b0c721f9e10c6c0d1e41e512c49eb877',
|
||||
'ContainerActionEvent': '1.0-2974d0a6f5d4821fd4e223a88c10181a'
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user