Skip to content

Commit

Permalink
Fix migration reservation deletion on internal cancellations
Browse files Browse the repository at this point in the history
This patch makes sure that the migration reservation deletion is done on any
migration task cancellation. Prior to this, internal cancellations (i.e.
KeyboardInterrupt signals) that were raised internally did not result in a
migration reservation deletion, leaving said cancelled migration licences as
consumed. The reservation deletion was moved in the cancellation confirmation
operation on conductor side, so all cancellation signals will be included in
making sure the cancelled migration licence will be reverted.
  • Loading branch information
Dany9966 committed Sep 5, 2024
1 parent 24c52ea commit ec7f2d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion coriolis/conductor/rpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,6 @@ def cancel_migration(self, ctxt, migration_id, force):
constants.EXECUTION_LOCK_NAME_FORMAT % execution.id,
external=True):
self._cancel_tasks_execution(ctxt, execution, force=force)
self._check_delete_reservation_for_transfer(migration)

def _cancel_tasks_execution(
self, ctxt, execution, requery=True, force=False):
Expand Down Expand Up @@ -3301,6 +3300,10 @@ def confirm_task_cancellation(self, ctxt, task_id, cancellation_details):
"confirmation of its cancellation.",
task.id, task.status, final_status)
execution = db_api.get_tasks_execution(ctxt, task.execution_id)
if execution.type == constants.EXECUTION_TYPE_MIGRATION:
action = db_api.get_action(
ctxt, execution.action_id, include_task_info=False)
self._check_delete_reservation_for_transfer(action)
self._advance_execution_state(ctxt, execution, requery=False)

@parent_tasks_execution_synchronized
Expand Down

0 comments on commit ec7f2d9

Please sign in to comment.