Add power_state to InstancePayLoad

As we have added power_state to instance, it should be added to
notifications

Change-Id: I0448643fc5671f8fc173d4ae23c9d4fd63f62783
This commit is contained in:
Zhenguo Niu 2017-02-03 17:18:45 +08:00
parent bec4986818
commit 15359acb73
2 changed files with 6 additions and 5 deletions

View File

@ -28,8 +28,7 @@ class InstancePayload(base.NotificationPayloadBase):
'launched_at': ('instance', 'launched_at'),
'updated_at': ('instance', 'updated_at'),
'status': ('instance', 'status'),
# TODO(liusheng) the instance object hasn't power_state attribute
# 'power_state': ('instance', 'power_state'),
'power_state': ('instance', 'power_state'),
'instance_type_uuid': ('instance', 'instance_type_uuid'),
'description': ('instance', 'description')
}
@ -44,7 +43,7 @@ class InstancePayload(base.NotificationPayloadBase):
'instance_type_uuid': fields.UUIDField(nullable=False),
'image_uuid': fields.UUIDField(nullable=True),
'availability_zone': fields.StringField(nullable=True),
# 'power_state': fields.StringField(nullable=True),
'power_state': fields.StringField(nullable=True),
'created_at': fields.DateTimeField(nullable=True),
'launched_at': fields.DateTimeField(nullable=True),
'updated_at': fields.DateTimeField(nullable=True),

View File

@ -226,8 +226,8 @@ class TestNotificationBase(test_base.TestCase):
notification_object_data = {
'InstancePayload': '1.0-897d5e392176f1e1d004f7d6f88482b3',
'InstanceActionPayload': '1.0-a0ff2469842cf5e19acdf0d3d53a90c5',
'InstancePayload': '1.0-e0f5f1a93307435bff6ccb1b69d66003',
'InstanceActionPayload': '1.0-406ba4240e7dc166a10069484397c3e1',
'InstanceActionNotification': '1.0-20087e599436bd9db62ae1fb5e2dfef2',
'ExceptionPayload': '1.0-7c31986d8d78bed910c324965c431e18',
'ExceptionNotification': '1.0-20087e599436bd9db62ae1fb5e2dfef2',
@ -328,3 +328,5 @@ class TestInstanceActionNotification(test_base.TestCase):
self.assertEqual(fake_inst_values['project_id'], payload['project_id'])
self.assertEqual(fake_inst_values['description'],
payload['description'])
self.assertEqual(fake_inst_values['power_state'],
payload['power_state'])