From bdce4e7e789954bd5f1da6a1f238aa015c691d50 Mon Sep 17 00:00:00 2001 From: Andrew Kerr Date: Wed, 27 Aug 2014 18:28:01 -0400 Subject: Don't clear _mounted_shares list in remoteFS while updating This fix makes the updating of the _mounted_shares list in remoteFS more of an atomic operation. Previously this list would be cleared, then rebuilt. That allowed a race condition where operations that took place during this update would have a list of 0 shares to work with. Closes-Bug: #1366083 cherry-picked from commit 9cc9cf111ef8a0265df5323fecaed12b0dabe312 Change-Id: I740d8f1b87db911242326a38ff398b81c5974cea --- cinder/volume/drivers/nfs.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index 19347738c..82ae373cc 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -145,7 +145,7 @@ class RemoteFsDriver(driver.VolumeDriver): """Look for remote shares in the flags and tries to mount them locally. """ - self._mounted_shares = [] + mounted_shares = [] self._load_shares_config(getattr(self.configuration, self.driver_prefix + @@ -154,10 +154,12 @@ class RemoteFsDriver(driver.VolumeDriver): for share in self.shares.keys(): try: self._ensure_share_mounted(share) - self._mounted_shares.append(share) + mounted_shares.append(share) except Exception as exc: LOG.warning(_('Exception during mounting %s') % (exc,)) + self._mounted_shares = mounted_shares + LOG.debug('Available shares %s' % str(self._mounted_shares)) def create_cloned_volume(self, volume, src_vref): -- cgit v1.2.1