Browse Source

Schedule VALIDATE_SOURCE tasks before GET_INSTANCE.

This patch makes the conductor schedule the VALIDATE_SOURCE_*_INPUTS
tasks before the GET_INSTANCE_INFO ones of both Migrations and Replicas.
This is so as to allow the source validation to run before the instance
query (which might depend on params validated by the former), as well as
prevent any state conflicts while the two tasks are running.
Nashwan Azhari 6 years ago
parent
commit
71e21b91de
1 changed files with 12 additions and 8 deletions
  1. 12 8
      coriolis/conductor/rpc/server.py

+ 12 - 8
coriolis/conductor/rpc/server.py

@@ -334,15 +334,17 @@ class ConductorServerEndpoint(object):
         execution.type = constants.EXECUTION_TYPE_REPLICA_EXECUTION
 
         for instance in execution.action.instances:
-            get_instance_info_task = self._create_task(
-                instance, constants.TASK_TYPE_GET_INSTANCE_INFO,
-                execution)
-
             validate_replica_source_inputs_task = self._create_task(
                 instance,
                 constants.TASK_TYPE_VALIDATE_REPLICA_SOURCE_INPUTS,
                 execution)
 
+            get_instance_info_task = self._create_task(
+                instance,
+                constants.TASK_TYPE_GET_INSTANCE_INFO,
+                execution,
+                depends_on=[validate_replica_source_inputs_task.id])
+
             validate_replica_destination_inputs_task = self._create_task(
                 instance,
                 constants.TASK_TYPE_VALIDATE_REPLICA_DESTINATION_INPUTS,
@@ -728,15 +730,17 @@ class ConductorServerEndpoint(object):
             # to prevent the Replica disks from being cloned:
             migration.info[instance] = {"clone_disks": False}
 
-            get_instance_info_task = self._create_task(
-                instance, constants.TASK_TYPE_GET_INSTANCE_INFO,
-                execution)
-
             validate_migration_source_inputs_task = self._create_task(
                 instance,
                 constants.TASK_TYPE_VALIDATE_MIGRATION_SOURCE_INPUTS,
                 execution)
 
+            get_instance_info_task = self._create_task(
+                instance,
+                constants.TASK_TYPE_GET_INSTANCE_INFO,
+                execution,
+                depends_on=[validate_migration_source_inputs_task.id])
+
             validate_migration_destination_inputs_task = self._create_task(
                 instance,
                 constants.TASK_TYPE_VALIDATE_MIGRATION_DESTINATION_INPUTS,