Просмотр исходного кода

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 месяцев назад
Родитель
Сommit
ab088df43e
1 измененных файлов с 9 добавлено и 4 удалено
  1. 9 4
      coriolis/conductor/rpc/server.py

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

@@ -1616,13 +1616,18 @@ class ConductorServerEndpoint(object):
         else:
             self._begin_tasks(ctxt, deployment, execution)
 
-    @deployment_synchronized
     def confirm_deployer_completed(
             self, ctxt, deployment_id, force=False):
         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:
             LOG.error(
                 f"Something went wrong while attempting to launch pending "