Follow up to I5b9d41ef34385689d8da9b3962a1eac759eddf6a

This addresses the TODO based on the review comment here [1].

[1] https://review.opendev.org/#/c/637070/56/nova/conductor/tasks/cross_cell_migrate.py@970

Part of blueprint cross-cell-resize

Change-Id: Ic48a73cc7e25a8f639aaec3e7ca59224184c495b
This commit is contained in:
Matt Riedemann
2019-12-09 10:17:37 -05:00
parent 2e7a0088c2
commit 3f11a9de2d
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -24,6 +24,7 @@ from nova.compute import task_states
from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova.conductor.tasks import base
from nova import conf
from nova import context as nova_context
from nova import exception
from nova.i18n import _
@@ -36,6 +37,7 @@ from nova.scheduler import utils as scheduler_utils
from nova.volume import cinder
LOG = logging.getLogger(__name__)
CONF = conf.CONF
def clone_creatable_object(ctxt, obj, delete_fields=None):
@@ -967,7 +969,7 @@ class ConfirmResizeTask(base.TaskBase):
self.legacy_notifier, ctxt, instance, 'resize.confirm.%s' % phase)
# Send the versioned notification.
compute_utils.notify_about_instance_action(
ctxt, instance, instance.host, # TODO(mriedem): Use CONF.host?
ctxt, instance, CONF.host,
action=fields.NotificationAction.RESIZE_CONFIRM,
phase=phase)
@@ -1203,13 +1203,14 @@ class ConfirmResizeTaskTestCase(test.NoDBTestCase):
@mock.patch('nova.compute.utils.notify_about_instance_action')
def test_send_resize_confirm_notification(self, mock_versioned_notify,
mock_legacy_notify):
self.flags(host='fake-conductor-host')
instance = self.task.instance
self.task._send_resize_confirm_notification(instance, 'fake-phase')
mock_legacy_notify.assert_called_once_with(
self.task.legacy_notifier, instance._context, instance,
'resize.confirm.fake-phase')
mock_versioned_notify.assert_called_once_with(
instance._context, instance, instance.host,
instance._context, instance, 'fake-conductor-host',
action=fields.NotificationAction.RESIZE_CONFIRM,
phase='fake-phase')