]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
NetApp: Fix race condition in 7-mode iSCSI driver with DFM.
authorRushi Agrawal <rushi.agr@gmail.com>
Wed, 27 Feb 2013 11:37:41 +0000 (06:37 -0500)
committerRushi Agrawal <rushi.agr@gmail.com>
Tue, 26 Feb 2013 06:30:39 +0000 (12:00 +0530)
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

cinder/volume/drivers/netapp/iscsi.py

index d97c9e5c24154535b3a9e5823ad9b39d1cdbe5e2..7b9bd59e4fbd52b98c81ba15df86a456b62e1fd5 100644 (file)
@@ -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.