|
@@ -35,14 +35,14 @@ class ConductorServerEndpoint(object):
|
|
|
task_export.migration = migration
|
|
task_export.migration = migration
|
|
|
task_export.instance = instance
|
|
task_export.instance = instance
|
|
|
task_export.status = constants.TASK_STATUS_WAITING
|
|
task_export.status = constants.TASK_STATUS_WAITING
|
|
|
- task_export.task_type = constants.TASK_TYPE_EXPORT
|
|
|
|
|
|
|
+ task_export.task_type = constants.TASK_TYPE_EXPORT_INSTANCE
|
|
|
|
|
|
|
|
task_import = models.Task()
|
|
task_import = models.Task()
|
|
|
task_import.id = str(uuid.uuid4())
|
|
task_import.id = str(uuid.uuid4())
|
|
|
task_import.migration = migration
|
|
task_import.migration = migration
|
|
|
task_import.instance = instance
|
|
task_import.instance = instance
|
|
|
task_import.status = constants.TASK_STATUS_WAITING
|
|
task_import.status = constants.TASK_STATUS_WAITING
|
|
|
- task_import.task_type = constants.TASK_TYPE_IMPORT
|
|
|
|
|
|
|
+ task_import.task_type = constants.TASK_TYPE_IMPORT_INSTANCE
|
|
|
task_import.depends_on = [task_export.id]
|
|
task_import.depends_on = [task_export.id]
|
|
|
|
|
|
|
|
db_api.add_migration(ctxt, migration)
|
|
db_api.add_migration(ctxt, migration)
|
|
@@ -50,8 +50,14 @@ class ConductorServerEndpoint(object):
|
|
|
|
|
|
|
|
for task in migration.tasks:
|
|
for task in migration.tasks:
|
|
|
if not task.depends_on:
|
|
if not task.depends_on:
|
|
|
- self._rpc_worker_client.begin_export_instance(
|
|
|
|
|
- ctxt, task.id, origin, instance)
|
|
|
|
|
|
|
+ self._rpc_worker_client.begin_task(
|
|
|
|
|
+ ctxt, server=None,
|
|
|
|
|
+ task_id=task.id,
|
|
|
|
|
+ task_type=task.task_type,
|
|
|
|
|
+ origin=migration.origin,
|
|
|
|
|
+ destination=migration.destination,
|
|
|
|
|
+ instance=task.instance,
|
|
|
|
|
+ task_info=None)
|
|
|
|
|
|
|
|
return self.get_migration(ctxt, migration.id)
|
|
return self.get_migration(ctxt, migration.id)
|
|
|
|
|
|
|
@@ -73,19 +79,22 @@ class ConductorServerEndpoint(object):
|
|
|
if (task.depends_on and parent_task.id in task.depends_on and
|
|
if (task.depends_on and parent_task.id in task.depends_on and
|
|
|
task.status == constants.TASK_STATUS_WAITING):
|
|
task.status == constants.TASK_STATUS_WAITING):
|
|
|
has_pending_tasks = True
|
|
has_pending_tasks = True
|
|
|
- if task.task_type == constants.TASK_TYPE_IMPORT:
|
|
|
|
|
- # Needs to be executed on the same host
|
|
|
|
|
- self._rpc_worker_client.begin_import_instance(
|
|
|
|
|
- ctxt, parent_task.host, task.id,
|
|
|
|
|
- migration.destination,
|
|
|
|
|
- task.instance,
|
|
|
|
|
- task_info)
|
|
|
|
|
|
|
+ # instance imports needs to be executed on the same host
|
|
|
|
|
+ server = None
|
|
|
|
|
+ if task.task_type == constants.TASK_TYPE_IMPORT_INSTANCE:
|
|
|
|
|
+ server = parent_task.host
|
|
|
|
|
+
|
|
|
|
|
+ self._rpc_worker_client.begin_task(
|
|
|
|
|
+ ctxt, server=server,
|
|
|
|
|
+ task_id=task.id,
|
|
|
|
|
+ task_type=task.task_type,
|
|
|
|
|
+ origin=migration.origin,
|
|
|
|
|
+ destination=migration.destination,
|
|
|
|
|
+ instance=task.instance,
|
|
|
|
|
+ task_info=task_info)
|
|
|
return has_pending_tasks
|
|
return has_pending_tasks
|
|
|
|
|
|
|
|
- def export_completed(self, ctxt, task_id, export_info):
|
|
|
|
|
- self._task_completed(ctxt, task_id, export_info)
|
|
|
|
|
-
|
|
|
|
|
- def _task_completed(self, ctxt, task_id, task_info):
|
|
|
|
|
|
|
+ def task_completed(self, ctxt, task_id, task_info):
|
|
|
LOG.info("Task completed: %s", task_id)
|
|
LOG.info("Task completed: %s", task_id)
|
|
|
|
|
|
|
|
db_api.set_task_status(
|
|
db_api.set_task_status(
|
|
@@ -103,9 +112,6 @@ class ConductorServerEndpoint(object):
|
|
|
db_api.set_migration_status(
|
|
db_api.set_migration_status(
|
|
|
ctxt, migration.id, constants.MIGRATION_STATUS_COMPLETED)
|
|
ctxt, migration.id, constants.MIGRATION_STATUS_COMPLETED)
|
|
|
|
|
|
|
|
- def import_completed(self, ctxt, task_id):
|
|
|
|
|
- self._task_completed(ctxt, task_id, None)
|
|
|
|
|
-
|
|
|
|
|
def set_task_error(self, ctxt, task_id, exception_details):
|
|
def set_task_error(self, ctxt, task_id, exception_details):
|
|
|
LOG.error("Task error: %(task_id)s - %(ex)s",
|
|
LOG.error("Task error: %(task_id)s - %(ex)s",
|
|
|
{"task_id": task_id, "ex": exception_details})
|
|
{"task_id": task_id, "ex": exception_details})
|