소스 검색

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 1 년 전
부모
커밋
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 "