]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix check for mount.nfs helper installation
authorNavneet Singh <singn@netapp.com>
Wed, 31 Jul 2013 08:29:33 +0000 (13:59 +0530)
committerNavneet Singh <singn@netapp.com>
Thu, 1 Aug 2013 18:52:35 +0000 (00:22 +0530)
This fixes the issue for checking the
existence of mount.nfs helper program
in installation directories during
driver set up.

Closes-Bug:#1212286

Change-Id: If2fa925614bd42295eae0f62ba948e14a89e1343

cinder/tests/test_nfs.py
cinder/volume/drivers/nfs.py

index 48bf0c78fee3e6f01e41176d41238ce6d7a4e6ca..25ce710fed639bd0e9bca4b5438c47a0fb9b101d 100644 (file)
@@ -382,7 +382,7 @@ class NfsDriverTestCase(test.TestCase):
         mox.StubOutWithMock(os.path, 'exists')
         os.path.exists(self.TEST_SHARES_CONFIG_FILE).AndReturn(True)
         mox.StubOutWithMock(drv, '_execute')
-        drv._execute('mount.nfs', check_exit_code=False).\
+        drv._execute('mount.nfs', check_exit_code=False, run_as_root=True).\
             AndRaise(OSError(errno.ENOENT, 'No such file or directory'))
 
         mox.ReplayAll()
index 2e58e94300ebdb0ebf3cb44ab3d42aca307e3c14..10d204024f45d0fccf9ec6901afe46d819637a34 100644 (file)
@@ -400,13 +400,14 @@ class NfsDriver(RemoteFsDriver):
 
         self.shares = {}  # address : options
 
+        # Check if mount.nfs is installed
         try:
-            self._execute('mount.nfs', check_exit_code=False)
+            self._execute('mount.nfs', check_exit_code=False, run_as_root=True)
         except OSError as exc:
             if exc.errno == errno.ENOENT:
                 raise exception.NfsException('mount.nfs is not installed')
             else:
-                raise
+                raise exc
 
     def _ensure_share_mounted(self, nfs_share):
         mnt_flags = []