Skip to content

Commit 3f11a9d

Browse files
committed
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
1 parent 2e7a008 commit 3f11a9d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

nova/conductor/tasks/cross_cell_migrate.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from nova.compute import utils as compute_utils
2525
from nova.compute import vm_states
2626
from nova.conductor.tasks import base
27+
from nova import conf
2728
from nova import context as nova_context
2829
from nova import exception
2930
from nova.i18n import _
@@ -36,6 +37,7 @@
3637
from nova.volume import cinder
3738

3839
LOG = logging.getLogger(__name__)
40+
CONF = conf.CONF
3941

4042

4143
def clone_creatable_object(ctxt, obj, delete_fields=None):
@@ -967,7 +969,7 @@ def _send_resize_confirm_notification(self, instance, phase):
967969
self.legacy_notifier, ctxt, instance, 'resize.confirm.%s' % phase)
968970
# Send the versioned notification.
969971
compute_utils.notify_about_instance_action(
970-
ctxt, instance, instance.host, # TODO(mriedem): Use CONF.host?
972+
ctxt, instance, CONF.host,
971973
action=fields.NotificationAction.RESIZE_CONFIRM,
972974
phase=phase)
973975

nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,13 +1203,14 @@ def test_rollback(self, mock_set_state_notify, mock_get_reqspec,
12031203
@mock.patch('nova.compute.utils.notify_about_instance_action')
12041204
def test_send_resize_confirm_notification(self, mock_versioned_notify,
12051205
mock_legacy_notify):
1206+
self.flags(host='fake-conductor-host')
12061207
instance = self.task.instance
12071208
self.task._send_resize_confirm_notification(instance, 'fake-phase')
12081209
mock_legacy_notify.assert_called_once_with(
12091210
self.task.legacy_notifier, instance._context, instance,
12101211
'resize.confirm.fake-phase')
12111212
mock_versioned_notify.assert_called_once_with(
1212-
instance._context, instance, instance.host,
1213+
instance._context, instance, 'fake-conductor-host',
12131214
action=fields.NotificationAction.RESIZE_CONFIRM,
12141215
phase='fake-phase')
12151216

0 commit comments

Comments
 (0)