From ec7f2d9215ebddde1ec2ce5afd775fe30c510dd9 Mon Sep 17 00:00:00 2001 From: Daniel Vincze Date: Thu, 5 Sep 2024 14:50:42 +0300 Subject: [PATCH] Fix migration reservation deletion on internal cancellations 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. --- coriolis/conductor/rpc/server.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coriolis/conductor/rpc/server.py b/coriolis/conductor/rpc/server.py index 92ff8383..ecdb6d64 100644 --- a/coriolis/conductor/rpc/server.py +++ b/coriolis/conductor/rpc/server.py @@ -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): @@ -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