Fixes ZFSSANFS driver on Solaris platform
The Solaris operating system doesn't have the mount.nfs tool installed. This fix skips the check for mount.nfs if the operating system is Solaris in the setup method. Change-Id: I8f6ee8e576a0f79ffe688aa2740913e9097e06c0 Closes-Bug: #1598191
This commit is contained in:
parent
0d6677f6aa
commit
bc2f011fc0
|
@ -14,6 +14,7 @@
|
|||
"""Unit tests for Oracle's ZFSSA Cinder volume driver."""
|
||||
|
||||
from datetime import date
|
||||
import errno
|
||||
import json
|
||||
import math
|
||||
|
||||
|
@ -886,6 +887,7 @@ class TestZFSSANFSDriver(test.TestCase):
|
|||
self.drv._execute = fake_utils.fake_execute
|
||||
self.drv.do_setup({})
|
||||
self.drv.mount_path = 'fake_mount_path'
|
||||
self.context = context.get_admin_context()
|
||||
|
||||
def _create_fake_config(self):
|
||||
self.configuration = mock.Mock(spec=conf.Configuration)
|
||||
|
@ -908,6 +910,22 @@ class TestZFSSANFSDriver(test.TestCase):
|
|||
self.configuration.nfs_sparsed_volumes = 'true'
|
||||
self.configuration.zfssa_manage_policy = 'strict'
|
||||
|
||||
def test_setup_nfs_client(self):
|
||||
mock_execute = self.mock_object(self.drv, '_execute',
|
||||
side_effect= OSError(errno.ENOENT,
|
||||
'No such file or '
|
||||
'directory.'))
|
||||
|
||||
self.assertRaises(exception.NfsException, self.drv.do_setup,
|
||||
self.context)
|
||||
mock_execute.assert_has_calls(
|
||||
[mock.call('mount.nfs',
|
||||
check_exit_code=False,
|
||||
run_as_root=True),
|
||||
mock.call('/usr/sbin/mount',
|
||||
check_exit_code=False,
|
||||
run_as_root=True)])
|
||||
|
||||
def test_migrate_volume(self):
|
||||
self.drv.zfssa.get_asn.return_value = (
|
||||
'9a2b5a0f-e3af-6d14-9578-8825f229dc89')
|
||||
|
|
|
@ -113,15 +113,18 @@ class ZFSSANFSDriver(nfs.NfsDriver):
|
|||
LOG.error(msg)
|
||||
raise exception.NfsException(msg)
|
||||
|
||||
package = 'mount.nfs'
|
||||
try:
|
||||
self._execute(package, check_exit_code=False, run_as_root=True)
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.ENOENT:
|
||||
msg = _('%s is not installed') % package
|
||||
raise exception.NfsException(msg)
|
||||
else:
|
||||
raise
|
||||
packages = ('mount.nfs', '/usr/sbin/mount')
|
||||
for package in packages:
|
||||
try:
|
||||
self._execute(package, check_exit_code=False, run_as_root=True)
|
||||
break
|
||||
except OSError as exc:
|
||||
if exc.errno != errno.ENOENT:
|
||||
raise
|
||||
LOG.error(_LE('%s is not installed.'), package)
|
||||
else:
|
||||
msg = utils.build_or_str(packages, '%s needs to be installed.')
|
||||
raise exception.NfsException(msg)
|
||||
|
||||
lcfg = self.configuration
|
||||
LOG.info(_LI('Connecting to host: %s.'), lcfg.san_ip)
|
||||
|
|
Loading…
Reference in New Issue