Parcourir la 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 il y a 6 ans
Parent
commit
71e21b91de
1 fichiers modifiés avec 12 ajouts et 8 suppressions
  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
         execution.type = constants.EXECUTION_TYPE_REPLICA_EXECUTION
 
 
         for instance in execution.action.instances:
         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(
             validate_replica_source_inputs_task = self._create_task(
                 instance,
                 instance,
                 constants.TASK_TYPE_VALIDATE_REPLICA_SOURCE_INPUTS,
                 constants.TASK_TYPE_VALIDATE_REPLICA_SOURCE_INPUTS,
                 execution)
                 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(
             validate_replica_destination_inputs_task = self._create_task(
                 instance,
                 instance,
                 constants.TASK_TYPE_VALIDATE_REPLICA_DESTINATION_INPUTS,
                 constants.TASK_TYPE_VALIDATE_REPLICA_DESTINATION_INPUTS,
@@ -728,15 +730,17 @@ class ConductorServerEndpoint(object):
             # to prevent the Replica disks from being cloned:
             # to prevent the Replica disks from being cloned:
             migration.info[instance] = {"clone_disks": False}
             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(
             validate_migration_source_inputs_task = self._create_task(
                 instance,
                 instance,
                 constants.TASK_TYPE_VALIDATE_MIGRATION_SOURCE_INPUTS,
                 constants.TASK_TYPE_VALIDATE_MIGRATION_SOURCE_INPUTS,
                 execution)
                 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(
             validate_migration_destination_inputs_task = self._create_task(
                 instance,
                 instance,
                 constants.TASK_TYPE_VALIDATE_MIGRATION_DESTINATION_INPUTS,
                 constants.TASK_TYPE_VALIDATE_MIGRATION_DESTINATION_INPUTS,