Removes potentially bad exit value from accepted list in Quobyte volume driver

This disallows exit code 4 in the list of valid exit codes of the execute
call for mounting Quobyte volumes. As exit code 0 is the default value
for the allowed exit codes the whole check_exit_codes argument is
omitted.
Furthermore this updates the (dis-)connect volume sync locks to be
Quobyte specific.

Closes-Bug: #1679976

Change-Id: I87b74535bd1a2045948a56d1648cd587146facb7
This commit is contained in:
Silvan Kaiser 2017-04-05 11:04:33 +02:00
parent 036b53f5cd
commit ffb228bcc2
2 changed files with 6 additions and 9 deletions

View File

@ -47,8 +47,7 @@ class QuobyteTestCase(test.NoDBTestCase):
mock_ensure_tree.assert_called_once_with(export_mnt_base)
expected_commands = [mock.call('mount.quobyte',
quobyte_volume,
export_mnt_base,
check_exit_code=[0, 4])
export_mnt_base)
]
mock_execute.assert_has_calls(expected_commands)
mock_exists.assert_called_once_with(" /run/systemd/system")
@ -72,8 +71,7 @@ class QuobyteTestCase(test.NoDBTestCase):
'--user',
'mount.quobyte',
quobyte_volume,
export_mnt_base,
check_exit_code=[0, 4])
export_mnt_base)
]
mock_execute.assert_has_calls(expected_commands)
mock_exists.assert_called_once_with(" /run/systemd/system")
@ -100,8 +98,7 @@ class QuobyteTestCase(test.NoDBTestCase):
quobyte_volume,
export_mnt_base,
'-c',
config_file_dummy,
check_exit_code=[0, 4])
config_file_dummy)
]
mock_execute.assert_has_calls(expected_commands)
mock_exists.assert_called_once_with(" /run/systemd/system")

View File

@ -54,7 +54,7 @@ def mount_volume(volume, mnt_base, configfile=None):
LOG.debug('Mounting volume %s at mount point %s ...',
volume,
mnt_base)
utils.execute(*command, check_exit_code=[0, 4])
utils.execute(*command)
LOG.info('Mounted volume: %s', volume)
@ -107,7 +107,7 @@ class LibvirtQuobyteVolumeDriver(fs.LibvirtBaseFileSystemVolumeDriver):
return conf
@utils.synchronized('connect_volume')
@utils.synchronized('connect_qb_volume')
def connect_volume(self, connection_info, disk_info, instance):
"""Connect the volume."""
data = connection_info['data']
@ -133,7 +133,7 @@ class LibvirtQuobyteVolumeDriver(fs.LibvirtBaseFileSystemVolumeDriver):
validate_volume(mount_path)
@utils.synchronized('connect_volume')
@utils.synchronized('connect_qb_volume')
def disconnect_volume(self, connection_info, disk_dev, instance):
"""Disconnect the volume."""