Skip to content

Commit a413150

Browse files
Balazs Gibizermriedem
authored andcommitted
Pass network API to the conducor's MigrationTask
During migration conductor needs to heal the content of the RequestSpec.requested_resources field based on the resource requests of the ports attached to the instance being migrated. This patch makes sure that the MigrationTask has access the networking API to do such healing. blueprint: support-move-ops-with-qos-ports Change-Id: Idf38568c3c237687c54fbbfcc6c5792c49c95161
1 parent fb2ec18 commit a413150

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

nova/conductor/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def _build_cold_migrate_task(self, context, instance, flavor, request_spec,
485485
request_spec, clean_shutdown,
486486
self.compute_rpcapi,
487487
self.query_client, self.report_client,
488-
host_list)
488+
host_list, self.network_api)
489489

490490
def _destroy_build_request(self, context, instance):
491491
# The BuildRequest needs to be stored until the instance is mapped to

nova/conductor/tasks/migrate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def revert_allocation_for_migration(context, source_cn, instance, migration):
112112
class MigrationTask(base.TaskBase):
113113
def __init__(self, context, instance, flavor,
114114
request_spec, clean_shutdown, compute_rpcapi,
115-
query_client, report_client, host_list):
115+
query_client, report_client, host_list, network_api):
116116
super(MigrationTask, self).__init__(context, instance)
117117
self.clean_shutdown = clean_shutdown
118118
self.request_spec = request_spec
@@ -122,6 +122,7 @@ def __init__(self, context, instance, flavor,
122122
self.query_client = query_client
123123
self.reportclient = report_client
124124
self.host_list = host_list
125+
self.network_api = network_api
125126

126127
# Persist things from the happy path so we don't have to look
127128
# them up if we need to roll back

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,17 @@ def setUp(self):
6060
self.ensure_network_metadata_mock = _p.start()
6161
self.addCleanup(_p.stop)
6262

63+
self.mock_network_api = mock.Mock()
64+
6365
def _generate_task(self):
6466
return migrate.MigrationTask(self.context, self.instance, self.flavor,
6567
self.request_spec,
6668
self.clean_shutdown,
6769
compute_rpcapi.ComputeAPI(),
6870
query.SchedulerQueryClient(),
6971
report.SchedulerReportClient(),
70-
host_list=None)
72+
host_list=None,
73+
network_api=self.mock_network_api)
7174

7275
@mock.patch.object(objects.MigrationList, 'get_by_filters')
7376
@mock.patch('nova.scheduler.client.report.SchedulerReportClient')

0 commit comments

Comments
 (0)