Sfoglia il codice sorgente

Fix fulfilled migration exception

Raises proper exception when user attempts to re-execute or re-deploy an already fulfilled
migration action.
Daniel Vincze 1 anno fa
parent
commit
d715a67084
2 ha cambiato i file con 11 aggiunte e 7 eliminazioni
  1. 3 7
      coriolis/conductor/rpc/server.py
  2. 8 0
      coriolis/exception.py

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

@@ -402,13 +402,9 @@ class ConductorServerEndpoint(object):
                 fulfilled_at = reservation.get("fulfilled_at", None)
                 if scenario == constants.REPLICA_SCENARIO_LIVE_MIGRATION and (
                         fulfilled_at):
-                    raise exception.LicensingException(
-                        message=f"The Live Migration operation with ID "
-                                f"'{replica.id}' (licensing reservation "
-                                f"'{reservation_id}' has already been "
-                                f"fulfilled on {fulfilled_at}. Please "
-                                f"create a new Live Migration operation "
-                                f"to create a new licensing reservation.")
+                    raise exception.MigrationLicenceFulfilledException(
+                        action_id=replica.id, reservation_id=reservation_id,
+                        fulfilled_at=fulfilled_at)
 
                 replica.reservation_id = (
                     self._licensing_client.check_refresh_reservation(

+ 8 - 0
coriolis/exception.py

@@ -523,3 +523,11 @@ class OSMorphingWinRMOperationTimeout(OSMorphingOperationTimeout):
         " or the command execution time exceeds the timeout set. Try extending"
         " the timeout by editing the 'default_osmorphing_operation_timeout' "
         "in Coriolis' static configuration file.")
+
+
+class MigrationLicenceFulfilledException(Invalid):
+    message = (
+        "The Live Migration operation with ID '%(action_id)s' (licensing "
+        "reservation '%(reservation_id)s') has already been fulfilled on "
+        "%(fulfilled_at)s. Please create a new Live Migration operation to "
+        "create a new licensing reservation.")