diff --git a/nova/conductor/manager.py b/nova/conductor/manager.py index 82b125cd45..74495c4888 100644 --- a/nova/conductor/manager.py +++ b/nova/conductor/manager.py @@ -485,7 +485,7 @@ class ComputeTaskManager(base.Base): request_spec, clean_shutdown, self.compute_rpcapi, self.query_client, self.report_client, - host_list) + host_list, self.network_api) def _destroy_build_request(self, context, instance): # The BuildRequest needs to be stored until the instance is mapped to diff --git a/nova/conductor/tasks/migrate.py b/nova/conductor/tasks/migrate.py index 4998c96fa9..f4803e44be 100644 --- a/nova/conductor/tasks/migrate.py +++ b/nova/conductor/tasks/migrate.py @@ -112,7 +112,7 @@ def revert_allocation_for_migration(context, source_cn, instance, migration): class MigrationTask(base.TaskBase): def __init__(self, context, instance, flavor, request_spec, clean_shutdown, compute_rpcapi, - query_client, report_client, host_list): + query_client, report_client, host_list, network_api): super(MigrationTask, self).__init__(context, instance) self.clean_shutdown = clean_shutdown self.request_spec = request_spec @@ -122,6 +122,7 @@ class MigrationTask(base.TaskBase): self.query_client = query_client self.reportclient = report_client self.host_list = host_list + self.network_api = network_api # Persist things from the happy path so we don't have to look # them up if we need to roll back diff --git a/nova/tests/unit/conductor/tasks/test_migrate.py b/nova/tests/unit/conductor/tasks/test_migrate.py index bab53361a9..0e6aae11db 100644 --- a/nova/tests/unit/conductor/tasks/test_migrate.py +++ b/nova/tests/unit/conductor/tasks/test_migrate.py @@ -60,6 +60,8 @@ class MigrationTaskTestCase(test.NoDBTestCase): self.ensure_network_metadata_mock = _p.start() self.addCleanup(_p.stop) + self.mock_network_api = mock.Mock() + def _generate_task(self): return migrate.MigrationTask(self.context, self.instance, self.flavor, self.request_spec, @@ -67,7 +69,8 @@ class MigrationTaskTestCase(test.NoDBTestCase): compute_rpcapi.ComputeAPI(), query.SchedulerQueryClient(), report.SchedulerReportClient(), - host_list=None) + host_list=None, + network_api=self.mock_network_api) @mock.patch.object(objects.MigrationList, 'get_by_filters') @mock.patch('nova.scheduler.client.report.SchedulerReportClient')