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
This commit is contained in:
committed by
Matt Riedemann
parent
fb2ec18477
commit
a413150b20
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user