Sfoglia il codice sorgente

Fixed early-exit TaskRunners returning whole task info.

Nashwan Azhari 6 anni fa
parent
commit
b6da8026d5
2 ha cambiato i file con 10 aggiunte e 11 eliminazioni
  1. 3 4
      coriolis/conductor/rpc/server.py
  2. 7 7
      coriolis/tasks/replica_tasks.py

+ 3 - 4
coriolis/conductor/rpc/server.py

@@ -609,8 +609,7 @@ class ConductorServerEndpoint(object):
                     replicate_disks_task.id],
                 on_error=True)
 
-        self._check_execution_tasks_sanity(
-            execution, replica.info)
+        self._check_execution_tasks_sanity(execution, replica.info)
 
         # update the action info for all of the Replicas:
         for instance in execution.action.instances:
@@ -712,6 +711,7 @@ class ConductorServerEndpoint(object):
                 "instances. Ensure that the replica has been executed "
                 "successfully priorly" % replica_id)
 
+        self._check_execution_tasks_sanity(execution, replica.info)
         db_api.add_replica_tasks_execution(ctxt, execution)
         LOG.info("Replica tasks execution created: %s", execution.id)
 
@@ -1142,8 +1142,7 @@ class ConductorServerEndpoint(object):
                 execution, depends_on=cleanup_deps,
                 on_error_only=True)
 
-        self._check_execution_tasks_sanity(
-            execution, migration.info)
+        self._check_execution_tasks_sanity(execution, migration.info)
         db_api.add_migration(ctxt, migration)
 
         LOG.info("Migration created: %s", migration.id)

+ 7 - 7
coriolis/tasks/replica_tasks.py

@@ -228,7 +228,7 @@ class DeleteReplicaDisksTask(base.TaskRunner):
         if not task_info.get("volumes_info"):
             LOG.debug(
                 "No volumes_info present. Skipping disk deletion.")
-            return task_info
+            return {'volumes_info': []}
 
         provider = providers_factory.get_provider(
             destination["type"], constants.PROVIDER_TYPE_REPLICA_IMPORT,
@@ -644,7 +644,7 @@ class ValidateReplicaExecutionDestinationInputsTask(base.TaskRunner):
             event_manager.progress_update(
                 "Replica Import Provider for platform '%s' does not support "
                 "Replica input validation" % destination_type)
-            return task_info
+            return {}
 
         export_info = task_info.get("export_info")
         if not export_info:
@@ -692,7 +692,7 @@ class ValidateReplicaDeploymentParametersTask(base.TaskRunner):
                 "Replica Deployment Provider for platform '%s' does not "
                 "support Replica Deployment input validation" % (
                     destination_type))
-            return task_info
+            return {}
 
         # NOTE: the target environment JSON schema should have been validated
         # upon accepting the Replica API creation request.
@@ -717,10 +717,11 @@ class UpdateSourceReplicaTask(base.TaskRunner):
              event_handler):
         event_manager = events.EventManager(event_handler)
         new_source_env = task_info.get('source_environment', {})
+        volumes_info = task_info.get("volumes_info", [])
         if not new_source_env:
             event_manager.progress_update(
                 "No new source environment options provided")
-            return task_info
+            return {'volumes_info': volumes_info}
 
         source_provider = providers_factory.get_provider(
             origin["type"], constants.PROVIDER_TYPE_SOURCE_REPLICA_UPDATE,
@@ -731,7 +732,6 @@ class UpdateSourceReplicaTask(base.TaskRunner):
                 " updating Replicas" % origin["type"])
 
         origin_connection_info = base.get_connection_info(ctxt, origin)
-        volumes_info = task_info.get("volumes_info", [])
 
         LOG.info("Checking source provider environment params")
         # NOTE: the `source_environment` in the `origin` is the one set
@@ -764,10 +764,11 @@ class UpdateDestinationReplicaTask(base.TaskRunner):
             event_handler):
         event_manager = events.EventManager(event_handler)
         new_destination_env = task_info.get('target_environment', {})
+        volumes_info = task_info.get("volumes_info", [])
         if not new_destination_env:
             event_manager.progress_update(
                 "No new destination environment options provided")
-            return task_info
+            return {"volumes_info": volumes_info}
 
         destination_provider = providers_factory.get_provider(
             destination["type"],
@@ -781,7 +782,6 @@ class UpdateDestinationReplicaTask(base.TaskRunner):
         destination_connection_info = base.get_connection_info(
             ctxt, destination)
         export_info = task_info.get("export_info", {})
-        volumes_info = task_info.get("volumes_info", [])
 
         LOG.info("Checking destination provider environment params")
         # NOTE: the `target_environment` in the `destination` is the one