]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Don't clear _mounted_shares list in remoteFS while updating
authorAndrew Kerr <andrew.kerr@netapp.com>
Fri, 5 Sep 2014 15:28:06 +0000 (10:28 -0500)
committerAndrew Kerr <andrew.kerr@netapp.com>
Fri, 5 Sep 2014 15:28:48 +0000 (10:28 -0500)
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.

Change-Id: I740d8f1b87db911242326a38ff398b81c5974cea
Closes-Bug: #1366083

cinder/volume/drivers/remotefs.py

index 85e625fb5aa79cf4529eb238f4b4bae11d3ba40d..d62f14e80fe1924d2b1cb80bd186c2ee1b0954ba 100644 (file)
@@ -138,7 +138,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 +
@@ -147,10 +147,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' % self._mounted_shares)
 
     def create_cloned_volume(self, volume, src_vref):