From 2d7beddc0bb7830c2a8bf893b9221c0de568c55d Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Tue, 14 May 2013 10:44:13 +0100 Subject: Extract live-migration scheduler logic from the scheduler driver Before moving the control of live-migration into the conductor, extract the live-migration control logic into a separate class. The callback to select_hosts will be replaced by a new scheduler rpc method in a later changeset. Part of blueprint live-migration-to-conductor Change-Id: I6de33ada6dc377e20f8df07da92244f2c150b9fe --- nova/scheduler/manager.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'nova/scheduler/manager.py') diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py index 5c99feb03..3d62ff9b0 100644 --- a/nova/scheduler/manager.py +++ b/nova/scheduler/manager.py @@ -30,6 +30,7 @@ from nova.compute import task_states from nova.compute import utils as compute_utils from nova.compute import vm_states from nova.conductor import api as conductor_api +from nova.conductor.tasks import live_migrate import nova.context from nova import exception from nova import manager @@ -102,9 +103,8 @@ class SchedulerManager(manager.Manager): def live_migration(self, context, instance, dest, block_migration, disk_over_commit): try: - return self.driver.schedule_live_migration( - context, instance, dest, - block_migration, disk_over_commit) + self._schedule_live_migration(context, instance, dest, + block_migration, disk_over_commit) except (exception.NoValidHost, exception.ComputeServiceUnavailable, exception.InvalidHypervisorType, @@ -131,6 +131,13 @@ class SchedulerManager(manager.Manager): {'vm_state': vm_states.ERROR}, context, ex, request_spec) + def _schedule_live_migration(self, context, instance, dest, + block_migration, disk_over_commit): + task = live_migrate.LiveMigrationTask(context, instance, + dest, block_migration, disk_over_commit, + self.driver.select_hosts) + return task.execute() + def run_instance(self, context, request_spec, admin_password, injected_files, requested_networks, is_first_time, filter_properties): -- cgit