Browse Source

Raise explicit error when trying to deploy an executionless replica.

Nashwan Azhari 7 years ago
parent
commit
096788b70f
1 changed files with 3 additions and 0 deletions
  1. 3 0
      coriolis/conductor/rpc/server.py

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

@@ -427,6 +427,9 @@ class ConductorServerEndpoint(object):
     def _check_valid_replica_tasks_execution(replica, force=False):
     def _check_valid_replica_tasks_execution(replica, force=False):
         sorted_executions = sorted(
         sorted_executions = sorted(
             replica.executions, key=lambda e: e.number, reverse=True)
             replica.executions, key=lambda e: e.number, reverse=True)
+        if not sorted_executions:
+            raise exception.InvalidReplicaState(
+                "The Replica has never been executed.")
 
 
         if (force and sorted_executions[0].status !=
         if (force and sorted_executions[0].status !=
                 constants.EXECUTION_STATUS_COMPLETED):
                 constants.EXECUTION_STATUS_COMPLETED):