]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Run only one instance of Nuage sync cycle at a time
authorSayaji <sayaji15@gmail.com>
Mon, 1 Dec 2014 23:25:57 +0000 (15:25 -0800)
committerSayaji <sayaji15@gmail.com>
Fri, 9 Jan 2015 21:21:38 +0000 (13:21 -0800)
Sync can run as part of Neutron and as a standalone tool.
So when sync is triggered through Neutron, someone can
trigger another sync cycle using the standalone tool.
Similarly when sync is triggered by standalone tool, Neutron
can trigger another sync cycle. This can lead to unexpected
sync behaviour .This fix will allow only one sync cycle at a
time and the other cycle will be blocked till the first one is
complete.

Change-Id: I9ffd07bea38d806f92edc160480b5896d3393202
Closes-Bug:1398190

neutron/plugins/nuage/syncmanager.py

index ef68b546c2bc5cfbdc0c4349b035c708509d83fc..fee9319dece5a3a778de0b3e62ce9a03ac2285ed 100644 (file)
@@ -22,6 +22,7 @@ from neutron.db import db_base_plugin_v2
 from neutron.db import extraroute_db
 from neutron.db import securitygroups_db
 from neutron.i18n import _LE, _LI, _LW
+from neutron.openstack.common import lockutils
 from neutron.openstack.common import log
 from neutron.plugins.nuage.common import config
 from neutron.plugins.nuage import nuagedb
@@ -42,6 +43,7 @@ class SyncManager(db_base_plugin_v2.NeutronDbPluginV2,
         self.context = ncontext.get_admin_context()
         self.nuageclient = nuageclient
 
+    @lockutils.synchronized('synchronize', 'nuage-sync', external=True)
     def synchronize(self, fipquota):
         LOG.info(_LI("Starting the sync between Neutron and VSD"))
         try: