From: Rushi Agrawal Date: Wed, 27 Feb 2013 11:37:41 +0000 (-0500) Subject: NetApp: Fix race condition in 7-mode iSCSI driver with DFM. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=3cff1cb24f7627dd913ce02a0f62c7ef85b5c37c;p=openstack-build%2Fcinder-build.git NetApp: Fix race condition in 7-mode iSCSI driver with DFM. A race condition was discovered in the driver while creating or deleting multiple volumes in a very short interval of time (can be reproduced by making successive API calls to Cinder). This fix decorates the methods responsible for race condition with a synchronized() decorator. The problem was with the management software: DFM, and in principle, there should not be two processes trying to modify the DFM dataset object at the same time. This patch prevents from such a possibility. Fixes bug 1091480 Change-Id: I11cfc8868171acec356f4140aba52b8078d109df --- diff --git a/cinder/volume/drivers/netapp/iscsi.py b/cinder/volume/drivers/netapp/iscsi.py index d97c9e5c2..7b9bd59e4 100644 --- a/cinder/volume/drivers/netapp/iscsi.py +++ b/cinder/volume/drivers/netapp/iscsi.py @@ -33,6 +33,7 @@ from suds.sax import text from cinder import exception from cinder import flags +from cinder.openstack.common import lockutils from cinder.openstack.common import log as logging from cinder.volume import driver from cinder.volume.drivers.netapp.api import NaApiError @@ -383,6 +384,7 @@ class NetAppISCSIDriver(driver.ISCSIDriver): self.discovered_datasets.append(ds) return ds + @lockutils.synchronized('netapp_dfm', 'cinder-', True) def _provision(self, name, description, project, ss_type, size): """Provision a LUN through provisioning manager. @@ -443,6 +445,7 @@ class NetAppISCSIDriver(driver.ISCSIDriver): return None return volume_type['name'] + @lockutils.synchronized('netapp_dfm', 'cinder-', True) def _remove_destroy(self, name, project): """Remove the LUN from the dataset, also destroying it.