From: Sayaji Date: Mon, 1 Dec 2014 23:25:57 +0000 (-0800) Subject: Run only one instance of Nuage sync cycle at a time X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=674d62a581da5164f6d5d2fe0d9b82a074f229eb;p=openstack-build%2Fneutron-build.git Run only one instance of Nuage sync cycle at a time 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 --- diff --git a/neutron/plugins/nuage/syncmanager.py b/neutron/plugins/nuage/syncmanager.py index ef68b546c..fee9319de 100644 --- a/neutron/plugins/nuage/syncmanager.py +++ b/neutron/plugins/nuage/syncmanager.py @@ -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: