summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kerr <andrew.kerr@netapp.com>2014-08-27 18:28:01 -0400
committerAndrew Kerr <andrew.kerr@netapp.com>2014-09-19 11:18:41 -0400
commitbdce4e7e789954bd5f1da6a1f238aa015c691d50 (patch)
treee9ef43db40d4e4e635f20d5f857fa5e0494d949f
parenta4d595b4a8adee9a96f7b56bfd8347056bc88b2a (diff)
downloadcinder-bdce4e7e789954bd5f1da6a1f238aa015c691d50.tar.gz
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
-rw-r--r--cinder/volume/drivers/nfs.py6
1 files 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):