Sfoglia il codice sorgente

Improve auto-deployment lock safety

This patch prevents minion-pooled deployments from locking, since it would've
locked the deployment resource twice. As an improvement, the deployment
resource gets locked separately when getting deployment information inside
the deployer confirmation method. It also improves transfer locking safety
when creating deployment execution.
Daniel Vincze 10 mesi fa
parent
commit
ab088df43e
1 ha cambiato i file con 9 aggiunte e 4 eliminazioni
  1. 9 4
      coriolis/conductor/rpc/server.py

+ 9 - 4
coriolis/conductor/rpc/server.py

@@ -1616,13 +1616,18 @@ class ConductorServerEndpoint(object):
         else:
         else:
             self._begin_tasks(ctxt, deployment, execution)
             self._begin_tasks(ctxt, deployment, execution)
 
 
-    @deployment_synchronized
     def confirm_deployer_completed(
     def confirm_deployer_completed(
             self, ctxt, deployment_id, force=False):
             self, ctxt, deployment_id, force=False):
         try:
         try:
-            deployment = self._get_deployment(
-                ctxt, deployment_id, include_task_info=True)
-            self._execute_deployment(ctxt, deployment, force)
+            with lockutils.lock(
+                    constants.DEPLOYMENT_LOCK_NAME_FORMAT % deployment_id,
+                    external=True):
+                deployment = self._get_deployment(
+                    ctxt, deployment_id, include_task_info=True)
+            with lockutils.lock(
+                    constants.TRANSFER_LOCK_NAME_FORMAT %
+                    deployment.transfer_id, external=True):
+                self._execute_deployment(ctxt, deployment, force)
         except BaseException:
         except BaseException:
             LOG.error(
             LOG.error(
                 f"Something went wrong while attempting to launch pending "
                 f"Something went wrong while attempting to launch pending "