Skip to content

Commit

Permalink
Fix fulfilled migration exception
Browse files Browse the repository at this point in the history
Raises proper exception when user attempts to re-execute or re-deploy an already fulfilled
migration action.
  • Loading branch information
Dany9966 committed Oct 22, 2024
1 parent 2ec91db commit ba387b5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 3 additions & 7 deletions coriolis/conductor/rpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,9 @@ def _check_reservation_for_replica(self, replica):
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(
Expand Down
8 changes: 8 additions & 0 deletions coriolis/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

0 comments on commit ba387b5

Please sign in to comment.