From: Silvan Kaiser Date: Fri, 20 Mar 2015 13:30:26 +0000 (+0100) Subject: Fix: Synchronise Quobyte Share mounting X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=6e0d0a5edbdec8fc3426b4938efa894340afd6bb;p=openstack-build%2Fcinder-build.git Fix: Synchronise Quobyte Share mounting 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 --- diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py index 694df0041..e9bd8eb46 100644 --- a/cinder/volume/drivers/quobyte.py +++ b/cinder/volume/drivers/quobyte.py @@ -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.