Transform rescue/unrescue instance notifications

The rescue (instance.rescue.start and instance.rescue.end) and unrescue
(instance.unrescue.start and instance.unrescue.end) notifications are
transformed to the versioned framework.

This patch also fixes the power state of the server
when unrescuing it with the fake compute driver.

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: Ib1d03c6d693e3b04886c638c956e35809fed8fc2
Implements: bp versioned-notification-transformation-queens
Closes-Bug: #1742133
This commit is contained in:
Béla Vancsics
2017-07-24 11:59:59 +02:00
committed by Takashi NATSUME
parent e66fc365c8
commit df7442ee5a
17 changed files with 256 additions and 15 deletions

View File

@@ -244,6 +244,21 @@ class InstanceUpdatePayload(InstancePayload):
for instance_tag in instance.tags.objects]
@nova_base.NovaObjectRegistry.register_notification
class InstanceActionRescuePayload(InstanceActionPayload):
# Version 1.0: Initial version
VERSION = '1.0'
fields = {
'rescue_image_ref': fields.UUIDField(nullable=True)
}
def __init__(self, instance, fault, rescue_image_ref):
super(InstanceActionRescuePayload, self).__init__(
instance=instance,
fault=fault)
self.rescue_image_ref = rescue_image_ref
@nova_base.NovaObjectRegistry.register_notification
class IpPayload(base.NotificationPayloadBase):
# Version 1.0: Initial version
@@ -451,8 +466,8 @@ class InstanceStateUpdatePayload(base.NotificationPayloadBase):
@base.notification_sample('instance-soft_delete-end.json')
@base.notification_sample('instance-trigger_crash_dump-start.json')
@base.notification_sample('instance-trigger_crash_dump-end.json')
# @base.notification_sample('instance-unrescue-start.json')
# @base.notification_sample('instance-unrescue-end.json')
@base.notification_sample('instance-unrescue-start.json')
@base.notification_sample('instance-unrescue-end.json')
@base.notification_sample('instance-unshelve-start.json')
@base.notification_sample('instance-unshelve-end.json')
@nova_base.NovaObjectRegistry.register_notification
@@ -529,6 +544,18 @@ class InstanceActionSnapshotNotification(base.NotificationBase):
}
@base.notification_sample('instance-rescue-start.json')
@base.notification_sample('instance-rescue-end.json')
@nova_base.NovaObjectRegistry.register_notification
class InstanceActionRescueNotification(base.NotificationBase):
# Version 1.0: Initial version
VERSION = '1.0'
fields = {
'payload': fields.ObjectField('InstanceActionRescuePayload')
}
@nova_base.NovaObjectRegistry.register_notification
class InstanceActionSnapshotPayload(InstanceActionPayload):
# Version 1.6: Initial version. It starts at version 1.6 as