summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgy Kibardin <gkibardin@mirantis.com>2017-03-15 13:36:05 +0300
committerGeorgy Kibardin <gkibardin@mirantis.com>2017-03-23 05:15:48 +0000
commit2caa56fa6e6d70b62d60867b78f0dddb33aa6b18 (patch)
treec846f4f01e49349b49c7bf2b09f49c49bbb8a162
parent847e9a81b944bab5642fbcda496526d080d697a7 (diff)
Moving task cache update into task creation transaction
Doing this we avoid inclusion of task cache update statement into the next transaction which may cause different problems such as deadlocks. (update happens inside make_astute_message() function) Change-Id: I865b98beb621bee089cf79f1304498fd3637d64f Closes-Bug: #1618852
Notes
Notes (review): Verified+1: Fuel CI <fuel-ci-bot@mirantis.com> Code-Review+2: Aleksey Kasatkin <akasatkin@mirantis.com> Code-Review+2: Alexander Kislitsky <akislitsky@mirantis.com> Workflow+1: Alexander Kislitsky <akislitsky@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 23 Mar 2017 09:46:24 +0000 Reviewed-on: https://review.openstack.org/445869 Project: openstack/fuel-web Branch: refs/heads/master
-rw-r--r--nailgun/nailgun/task/task.py33
1 files changed, 12 insertions, 21 deletions
diff --git a/nailgun/nailgun/task/task.py b/nailgun/nailgun/task/task.py
index 031792b..e0ee772 100644
--- a/nailgun/nailgun/task/task.py
+++ b/nailgun/nailgun/task/task.py
@@ -946,24 +946,18 @@ class StopDeploymentTask(object):
946 } 946 }
947 } 947 }
948 ) 948 )
949 db().commit()
950 return rpc_message 949 return rpc_message
951 950
952 @classmethod 951 @classmethod
953 def execute(cls, task, deploy_task=None, provision_task=None): 952 def execute(cls, task, deploy_task=None, provision_task=None):
954 db().commit() 953 messages = []
955 if provision_task: 954 if provision_task:
956 rpc.cast( 955 messages.append(cls.message(task, provision_task))
957 'naily',
958 cls.message(task, provision_task),
959 service=True
960 )
961 if deploy_task: 956 if deploy_task:
962 rpc.cast( 957 messages.append(cls.message(task, deploy_task))
963 'naily', 958 db().commit()
964 cls.message(task, deploy_task), 959 for msg in messages:
965 service=True 960 rpc.cast('naily', msg, service=True)
966 )
967 961
968 962
969class ResetEnvironmentTask(object): 963class ResetEnvironmentTask(object):
@@ -1962,8 +1956,9 @@ class CheckRepoAvailability(BaseNetworkVerification):
1962 return rpc_message 1956 return rpc_message
1963 1957
1964 def execute(self): 1958 def execute(self):
1959 message = self.get_message()
1965 db().commit() 1960 db().commit()
1966 rpc.cast('naily', self.get_message()) 1961 rpc.cast('naily', message)
1967 1962
1968 def _get_nodes_to_check(self): 1963 def _get_nodes_to_check(self):
1969 nodes = [{'uid': consts.MASTER_NODE_UID}] 1964 nodes = [{'uid': consts.MASTER_NODE_UID}]
@@ -2091,11 +2086,9 @@ class CreateStatsUserTask(object):
2091 2086
2092 @classmethod 2087 @classmethod
2093 def execute(cls, task, primary_controller): 2088 def execute(cls, task, primary_controller):
2089 message = cls.message(task, primary_controller)
2094 db().commit() 2090 db().commit()
2095 rpc.cast( 2091 rpc.cast('naily', message)
2096 'naily',
2097 cls.message(task, primary_controller)
2098 )
2099 2092
2100 2093
2101class RemoveStatsUserTask(object): 2094class RemoveStatsUserTask(object):
@@ -2124,11 +2117,9 @@ class RemoveStatsUserTask(object):
2124 2117
2125 @classmethod 2118 @classmethod
2126 def execute(cls, task, primary_controller): 2119 def execute(cls, task, primary_controller):
2120 message = cls.message(task, primary_controller)
2127 db().commit() 2121 db().commit()
2128 rpc.cast( 2122 rpc.cast('naily', message)
2129 'naily',
2130 cls.message(task, primary_controller)
2131 )
2132 2123
2133 2124
2134class UpdateOpenstackConfigTask(BaseDeploymentTask): 2125class UpdateOpenstackConfigTask(BaseDeploymentTask):