Transform instance.shelve_offload notifications

Instance.shelve_offload.start and instance.shelve_offload.end notifications
are transformed to the new versioned framework.

Change-Id: Ifccb61527854cdc1a4ceef34059710b5fd802ff9
Implements: bp versioned-notification-transformation-ocata
This commit is contained in:
Béla Vancsics
2016-10-17 16:02:36 +02:00
committed by Gábor Antal
parent 7e36553fa1
commit b1b86c8d91
6 changed files with 180 additions and 3 deletions

View File

@@ -161,7 +161,8 @@ class ShelveComputeManagerTestCase(test_compute.BaseTestCase):
def test_shelve_and_offload(self):
self._shelve_instance(0)
def _shelve_offload(self, clean_shutdown=True):
@mock.patch('nova.compute.utils.notify_about_instance_action')
def _shelve_offload(self, mock_notify, clean_shutdown=True):
host = 'fake-mini'
instance = self._create_fake_instance_obj(params={'host': host})
instance.task_state = task_states.SHELVING
@@ -195,6 +196,12 @@ class ShelveComputeManagerTestCase(test_compute.BaseTestCase):
with mock.patch.object(instance, 'save'):
self.compute.shelve_offload_instance(self.context, instance,
clean_shutdown=clean_shutdown)
mock_notify.assert_has_calls([
mock.call(self.context, instance, 'fake-mini',
action='shelve_offload', phase='start'),
mock.call(self.context, instance, 'fake-mini',
action='shelve_offload', phase='end')])
self.assertEqual(vm_states.SHELVED_OFFLOADED, instance.vm_state)
self.assertIsNone(instance.task_state)