Merge "Scality SOFS: don't always read /proc/mounts twice"
This commit is contained in:
commit
6001f50cd7
@ -149,6 +149,21 @@ class ScalityDriverTestCase(test.TestCase):
|
||||
_FAKE_MNT_POINT)
|
||||
self.assertEqual(expected_args, mock_execute.call_args[0])
|
||||
|
||||
@mock.patch("cinder.volume.utils.read_proc_mounts")
|
||||
@mock.patch("oslo_concurrency.processutils.execute")
|
||||
@mock.patch("oslo_utils.fileutils.ensure_tree", mock.Mock())
|
||||
@mock.patch("os.symlink", mock.Mock())
|
||||
def test_ensure_shares_mounted_when_sofs_mounted(self, mock_execute,
|
||||
mock_read_proc_mounts):
|
||||
mock_read_proc_mounts.return_value = _FAKE_MOUNTS_TABLE[1]
|
||||
|
||||
self.drv._ensure_shares_mounted()
|
||||
|
||||
# Because SOFS is mounted from the beginning, we shouldn't read
|
||||
# /proc/mounts more than once.
|
||||
mock_read_proc_mounts.assert_called_once_with()
|
||||
self.assertFalse(mock_execute.called)
|
||||
|
||||
def test_find_share_when_no_shares_mounted(self):
|
||||
self.assertRaises(exception.RemoteFSNoSharesMounted,
|
||||
self.drv._find_share, 'ignored')
|
||||
|
@ -135,10 +135,11 @@ class ScalityDriver(remotefs_drv.RemoteFSSnapDriver):
|
||||
if not self._sofs_is_mounted():
|
||||
self._execute('mount', '-t', 'sofs', self.sofs_config,
|
||||
self.sofs_mount_point, run_as_root=True)
|
||||
if not self._sofs_is_mounted():
|
||||
msg = _("Cannot mount Scality SOFS, check syslog for errors")
|
||||
LOG.error(msg)
|
||||
raise exception.VolumeBackendAPIException(data=msg)
|
||||
# Check whether the mount command succeeded
|
||||
if not self._sofs_is_mounted():
|
||||
msg = _("Cannot mount Scality SOFS, check syslog for errors")
|
||||
LOG.error(msg)
|
||||
raise exception.VolumeBackendAPIException(data=msg)
|
||||
|
||||
fileutils.ensure_tree(self.sofs_abs_volume_dir)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user