From 3f11a9de2db36d9d7ec4698229cc1343da872021 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Mon, 9 Dec 2019 10:17:37 -0500 Subject: [PATCH] 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 --- nova/conductor/tasks/cross_cell_migrate.py | 4 +++- nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nova/conductor/tasks/cross_cell_migrate.py b/nova/conductor/tasks/cross_cell_migrate.py index b1ecbf20d2..cefaea3f32 100644 --- a/nova/conductor/tasks/cross_cell_migrate.py +++ b/nova/conductor/tasks/cross_cell_migrate.py @@ -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) diff --git a/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py b/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py index 86f19edc0d..bc5245f191 100644 --- a/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py +++ b/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py @@ -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')