Merge "Execute mount.nfs check with absolute path"
This commit is contained in:
commit
cb029f2cab
cinder
@ -1283,13 +1283,13 @@ class NfsDriverDoSetupTestCase(test.TestCase):
|
||||
errno.ENOENT, 'No such file or directory.')
|
||||
|
||||
with self.assertRaisesRegex(exception.NfsException,
|
||||
'mount.nfs is not installed'):
|
||||
'/sbin/mount.nfs is not installed'):
|
||||
drv.do_setup(self.context)
|
||||
|
||||
mock_os_path_exists.assert_has_calls(
|
||||
[mock.call(self.configuration.nfs_shares_config)])
|
||||
mock_execute.assert_has_calls(
|
||||
[mock.call('mount.nfs',
|
||||
[mock.call('/sbin/mount.nfs',
|
||||
check_exit_code=False,
|
||||
run_as_root=False)])
|
||||
|
||||
@ -1313,7 +1313,7 @@ class NfsDriverDoSetupTestCase(test.TestCase):
|
||||
mock_os_path_exists.assert_has_calls(
|
||||
[mock.call(self.configuration.nfs_shares_config)])
|
||||
mock_execute.assert_has_calls(
|
||||
[mock.call('mount.nfs',
|
||||
[mock.call('/sbin/mount.nfs',
|
||||
check_exit_code=False,
|
||||
run_as_root=False)])
|
||||
|
||||
|
@ -143,9 +143,14 @@ class NfsDriver(driver.ExtendVD, remotefs.RemoteFSDriver):
|
||||
|
||||
self.shares = {} # address : options
|
||||
|
||||
# Check if mount.nfs is installed on this system; note that we don't
|
||||
# need to be root to see if the package is installed.
|
||||
package = 'mount.nfs'
|
||||
# Check if /sbin/mount.nfs is installed on this system;
|
||||
# note that we don't need to be root, to see if the package
|
||||
# is installed.
|
||||
# We rely on the absolute path /sbin/mount.nfs; this seems to be
|
||||
# common on most distributions (SUSE, RedHat, CentOS, Ubuntu, Debian)
|
||||
# and it does not depend on correct PATH of the executing user,
|
||||
# when trying to find the relative binary.
|
||||
package = '/sbin/mount.nfs'
|
||||
try:
|
||||
self._execute(package, check_exit_code=False,
|
||||
run_as_root=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user