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
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()
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 = []