From: Navneet Singh Date: Wed, 31 Jul 2013 08:29:33 +0000 (+0530) Subject: Fix check for mount.nfs helper installation X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=efd82e0265efbbfa43ff7ebb7523790b81299882;p=openstack-build%2Fcinder-build.git Fix check for mount.nfs helper installation 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 --- diff --git a/cinder/tests/test_nfs.py b/cinder/tests/test_nfs.py index 48bf0c78f..25ce710fe 100644 --- a/cinder/tests/test_nfs.py +++ b/cinder/tests/test_nfs.py @@ -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() diff --git a/cinder/volume/drivers/nfs.py b/cinder/volume/drivers/nfs.py index 2e58e9430..10d204024 100644 --- a/cinder/volume/drivers/nfs.py +++ b/cinder/volume/drivers/nfs.py @@ -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 = []