]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Scality: Lock around SOFS mount to avoid a race
authorJordanP <jordan.pittier@scality.com>
Thu, 15 Jan 2015 14:42:10 +0000 (15:42 +0100)
committerJordanP <jordan.pittier@scality.com>
Fri, 16 Jan 2015 13:59:04 +0000 (14:59 +0100)
Both cinder-volume and cinder-backup could want to mount the
SOFS at the same time (during init).

Related-Bug: #1410341
Change-Id: I75faa6eb283bc7c1f655cf5b051bed025af3d701

cinder/volume/drivers/scality.py

index a16bb53db97af473e516f1c59f80f0f9cb166feb..918aefdda4b0f9f38dccbdcc463401a9ad20d62b 100644 (file)
@@ -23,6 +23,7 @@ import urllib2
 
 from oslo.config import cfg
 from oslo.utils import units
+from oslo_concurrency import lockutils
 import six.moves.urllib.parse as urlparse
 
 from cinder import exception
@@ -99,6 +100,7 @@ class ScalityDriver(driver.VolumeDriver):
             if e.errno != errno.EEXIST:
                 raise
 
+    @lockutils.synchronized('mount-sofs', 'cinder-sofs', external=True)
     def _mount_sofs(self):
         config = self.configuration.scality_sofs_config
         mount_path = self.configuration.scality_sofs_mount_point