Skip to content

Commit

Permalink
Fix reservation management on minion pool errors
Browse files Browse the repository at this point in the history
Fixes an edge-case where if a reservation cannot be found for an existing
replica, and the minion pool set to it is also in an invalid state, a new
reservation would be created but never saved to DB because of the minion pool
error. This patch makes sure that the minion pool validation is done before
the reservation checks when creating replica executions.
  • Loading branch information
Dany9966 committed Oct 22, 2024
1 parent d845c05 commit 2ec91db
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions coriolis/conductor/rpc/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,9 @@ def _check_task_cls_param_requirements(task, instance_task_info_keys):
@replica_synchronized
def execute_replica_tasks(self, ctxt, replica_id, shutdown_instances):
replica = self._get_replica(ctxt, replica_id, include_task_info=True)
self._check_reservation_for_replica(replica)
self._check_replica_running_executions(ctxt, replica)
self._check_minion_pools_for_action(ctxt, replica)
self._check_reservation_for_replica(replica)

execution = models.TasksExecution()
execution.id = str(uuid.uuid4())
Expand Down Expand Up @@ -1396,7 +1396,6 @@ def deploy_replica_instances(
instance_osmorphing_minion_pool_mappings=None,
skip_os_morphing=False, user_scripts=None):
replica = self._get_replica(ctxt, replica_id, include_task_info=True)
self._check_reservation_for_replica(replica)
self._check_replica_running_executions(ctxt, replica)
self._check_valid_replica_tasks_execution(replica, force)
user_scripts = user_scripts or replica.user_scripts
Expand Down Expand Up @@ -1445,6 +1444,7 @@ def deploy_replica_instances(
migration.instance_osmorphing_minion_pool_mappings.update(
instance_osmorphing_minion_pool_mappings)
self._check_minion_pools_for_action(ctxt, migration)
self._check_reservation_for_replica(replica)

execution = models.TasksExecution()
migration.executions = [execution]
Expand Down

0 comments on commit 2ec91db

Please sign in to comment.