From ffb228bcc221162d77e2def9b81895ecb4bf48b7 Mon Sep 17 00:00:00 2001 From: Silvan Kaiser Date: Wed, 5 Apr 2017 11:04:33 +0200 Subject: [PATCH] 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 --- nova/tests/unit/virt/libvirt/volume/test_quobyte.py | 9 +++------ nova/virt/libvirt/volume/quobyte.py | 6 +++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py index 561789d2f8b6..f0507fd7fe8e 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py +++ b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py @@ -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") diff --git a/nova/virt/libvirt/volume/quobyte.py b/nova/virt/libvirt/volume/quobyte.py index 40d2fc2fe351..6c4718313592 100644 --- a/nova/virt/libvirt/volume/quobyte.py +++ b/nova/virt/libvirt/volume/quobyte.py @@ -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."""