Transform instance.resize_revert notification
The instance.resize_revert.start and instance.resize_revert.end notifications are transformed to the versioned framework. Change-Id: Ia86c8804b284ed4ad72a1993c454ec373c063b99 Implements: bp versioned-notification-transformation-queens
This commit is contained in:
parent
2c7302e33e
commit
ac0745babd
6
doc/notification_samples/instance-resize_revert-end.json
Normal file
6
doc/notification_samples/instance-resize_revert-end.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"event_type":"instance.resize_revert.end",
|
||||
"payload":{"$ref":"common_payloads/InstanceActionPayload.json#"},
|
||||
"priority":"INFO",
|
||||
"publisher_id":"nova-compute:compute"
|
||||
}
|
22
doc/notification_samples/instance-resize_revert-start.json
Normal file
22
doc/notification_samples/instance-resize_revert-start.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"event_type":"instance.resize_revert.start",
|
||||
"payload":{
|
||||
"$ref":"common_payloads/InstanceActionPayload.json#",
|
||||
"nova_object.data": {
|
||||
"flavor":{
|
||||
"nova_object.data": {
|
||||
"flavorid": "d5a8bb54-365a-45ae-abdb-38d249df7845",
|
||||
"name": "other_flavor",
|
||||
"memory_mb": 256,
|
||||
"extra_specs": {
|
||||
"hw:watchdog_action": "reset"
|
||||
}
|
||||
}
|
||||
},
|
||||
"state":"resized",
|
||||
"task_state":"resize_reverting"
|
||||
}
|
||||
},
|
||||
"priority":"INFO",
|
||||
"publisher_id":"nova-compute:compute"
|
||||
}
|
@ -3851,6 +3851,9 @@ class ComputeManager(manager.Manager):
|
||||
with self._error_out_instance_on_exception(context, instance):
|
||||
self._notify_about_instance_usage(
|
||||
context, instance, "resize.revert.start")
|
||||
compute_utils.notify_about_instance_action(context, instance,
|
||||
self.host, action=fields.NotificationAction.RESIZE_REVERT,
|
||||
phase=fields.NotificationPhase.START)
|
||||
|
||||
# NOTE(mriedem): delete stashed old_vm_state information; we
|
||||
# default to ACTIVE for backwards compatibility if old_vm_state
|
||||
@ -3910,6 +3913,9 @@ class ComputeManager(manager.Manager):
|
||||
|
||||
self._notify_about_instance_usage(
|
||||
context, instance, "resize.revert.end")
|
||||
compute_utils.notify_about_instance_action(context, instance,
|
||||
self.host, action=fields.NotificationAction.RESIZE_REVERT,
|
||||
phase=fields.NotificationPhase.END)
|
||||
|
||||
def _revert_allocation(self, context, instance, migration):
|
||||
"""Revert an allocation that is held by migration to our instance."""
|
||||
|
@ -443,8 +443,8 @@ class InstanceStateUpdatePayload(base.NotificationPayloadBase):
|
||||
# @base.notification_sample('instance-resize_confirm-start.json')
|
||||
# @base.notification_sample('instance-resize_confirm-end.json')
|
||||
# @base.notification_sample('instance-resize_prep-start.json')
|
||||
# @base.notification_sample('instance-resize_revert-start.json')
|
||||
# @base.notification_sample('instance-resize_revert-end.json')
|
||||
@base.notification_sample('instance-resize_revert-start.json')
|
||||
@base.notification_sample('instance-resize_revert-end.json')
|
||||
@base.notification_sample('instance-shelve_offload-start.json')
|
||||
@base.notification_sample('instance-shelve_offload-end.json')
|
||||
@base.notification_sample('instance-soft_delete-start.json')
|
||||
|
@ -229,8 +229,7 @@ class TestInstanceNotificationSample(
|
||||
self._test_pause_unpause_server,
|
||||
self._test_shelve_and_shelve_offload_server,
|
||||
self._test_unshelve_server,
|
||||
self._test_resize_server,
|
||||
self._test_revert_server,
|
||||
self._test_resize_and_revert_server,
|
||||
self._test_resize_confirm_server,
|
||||
self._test_snapshot_server,
|
||||
self._test_reboot_server,
|
||||
@ -690,7 +689,7 @@ class TestInstanceNotificationSample(
|
||||
'uuid': server['id']},
|
||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[3])
|
||||
|
||||
def _test_resize_server(self, server):
|
||||
def _test_resize_and_revert_server(self, server):
|
||||
self.flags(allow_resize_to_same_host=True)
|
||||
other_flavor_body = {
|
||||
'flavor': {
|
||||
@ -734,8 +733,24 @@ class TestInstanceNotificationSample(
|
||||
'uuid': server['id']},
|
||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[idx])
|
||||
|
||||
# the following is the revert server request
|
||||
post = {'revertResize': None}
|
||||
self.api.post_server_action(server['id'], post)
|
||||
self._wait_for_state_change(self.api, server, 'ACTIVE')
|
||||
|
||||
self.assertEqual(6, len(fake_notifier.VERSIONED_NOTIFICATIONS))
|
||||
self._verify_notification(
|
||||
'instance-resize_revert-start',
|
||||
replacements={
|
||||
'reservation_id': server['reservation_id'],
|
||||
'uuid': server['id']},
|
||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[4])
|
||||
self._verify_notification(
|
||||
'instance-resize_revert-end',
|
||||
replacements={
|
||||
'reservation_id': server['reservation_id'],
|
||||
'uuid': server['id']},
|
||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[5])
|
||||
|
||||
@mock.patch('nova.compute.manager.ComputeManager._reschedule',
|
||||
return_value=True)
|
||||
@ -1109,9 +1124,6 @@ class TestInstanceNotificationSample(
|
||||
'uuid': server['id']},
|
||||
actual=fake_notifier.VERSIONED_NOTIFICATIONS[6])
|
||||
|
||||
def _test_revert_server(self, server):
|
||||
pass
|
||||
|
||||
def _test_resize_confirm_server(self, server):
|
||||
pass
|
||||
|
||||
|
@ -5562,7 +5562,8 @@ class ComputeTestCase(BaseTestCase,
|
||||
self._test_resize_with_pci(
|
||||
self.compute.revert_resize, '0000:0b:00.1')
|
||||
|
||||
def _test_finish_revert_resize(self, power_on,
|
||||
@mock.patch.object(nova.compute.utils, 'notify_about_instance_action')
|
||||
def _test_finish_revert_resize(self, mock_notify, power_on,
|
||||
remove_old_vm_state=False,
|
||||
numa_topology=None):
|
||||
"""Convenience method that does most of the work for the
|
||||
@ -5689,6 +5690,11 @@ class ComputeTestCase(BaseTestCase,
|
||||
self.compute.finish_revert_resize(self.context,
|
||||
migration=migration,
|
||||
instance=instance, reservations=[])
|
||||
mock_notify.assert_has_calls([
|
||||
mock.call(self.context, instance, 'fake-mini',
|
||||
action='resize_revert', phase='start'),
|
||||
mock.call(self.context, instance, 'fake-mini',
|
||||
action='resize_revert', phase='end')])
|
||||
|
||||
self.assertIsNone(instance.task_state)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user