]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix: Synchronise Quobyte Share mounting
authorSilvan Kaiser <silvan@quobyte.com>
Fri, 20 Mar 2015 13:30:26 +0000 (14:30 +0100)
committerSilvan Kaiser <silvan@quobyte.com>
Mon, 23 Mar 2015 13:25:41 +0000 (13:25 +0000)
Quobyte ci tests show random failures with multiple similar shares.
A single share is listed in mounted shares twice after two (or more)
chronologically close successive calls to
_ensure_shares_mounted (examples see bug or similar Quobyte ci error
reports).
This is now prevented by synchronizing the method.

Closes-Bug: #1434502

Change-Id: Iae5cfb529c56681eaaf5868042264e4f8d71c0fb

cinder/volume/drivers/quobyte.py

index 694df0041d936fd2fb658a78d4f74fdd1fa5910f..e9bd8eb46f8a8dfbc9e8c9b271c94fc0c8c8080d 100644 (file)
@@ -308,7 +308,7 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriver):
 
         self.shares[url] = None  # None = No extra mount options.
 
-        LOG.debug("Quobyte Volume URL set to: %s" % str(self.shares))
+        LOG.debug("Quobyte Volume URL set to: %s", self.shares)
 
     def _ensure_share_mounted(self, quobyte_volume):
         """Mount Quobyte volume.
@@ -317,6 +317,7 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriver):
         mount_path = self._get_mount_point_for_share(quobyte_volume)
         self._mount_quobyte(quobyte_volume, mount_path, ensure=True)
 
+    @utils.synchronized('quobyte_ensure', external=False)
     def _ensure_shares_mounted(self):
         """Mount the Quobyte volume.
 
@@ -331,9 +332,9 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriver):
                 self._ensure_share_mounted(share)
                 self._mounted_shares.append(share)
             except Exception as exc:
-                LOG.warning(_LW('Exception during mounting %s') % (exc,))
+                LOG.warning(_LW('Exception during mounting %s'), exc)
 
-        LOG.debug('Available shares %s' % str(self._mounted_shares))
+        LOG.debug('Available shares %s', self._mounted_shares)
 
     def _find_share(self, volume_size_in_gib):
         """Returns the mounted Quobyte volume.