diff --git a/README.md b/README.md index 7efb8e4..4e7b32d 100644 --- a/README.md +++ b/README.md @@ -23,14 +23,18 @@ Please see the different patches readme files for their respective installation These patches provides an all in one patch file per project for easier installation. These patch files correct a list of issues/features, including single issue fix patches availabe in this repository. -## overlay_volume_patch (**beta**) +## multiattach + +Allows activating Cinder multi attach with the Quobyte driver. + +## overlay_volumes (**beta**) Backport of the upstream changes for [overlay volumes](https://review.openstack.org/#/c/507050), the [volume_from_snapshot_cache](https://review.openstack.org/#/c/502974/9) and some [general volume creation optimizations](https://review.openstack.org/#/c/500782/) for Cinder. ## qemu-img_commit_patch A simple Cinder patch for setups encountering qemu-img commit crashes during snapshot deletion with v3 Kernels. -## return_for_create_clone_patch +## return_for_create_clone Small patch that enables volume backups via volume cloning with Quobyte volumes. This change is part of the upstream code for releases Pike and newer. @@ -39,7 +43,7 @@ Small patch that enables volume backups via volume cloning with Quobyte volumes. Backport of a [Nova bugfix](https://review.openstack.org/#/c/432344/) for a [bug](https://bugs.launchpad.net/nova/+bug/1530860) that caused mounts to be removed when the Nova service was stopped or restarted. This patch is part of the upstream code fore releases Pike and newer. -## user_current_vol-url patch +## user_current_vol-url Patches the Cinder Quobyte driver to always use the currently configured quobyte_volume_url. diff --git a/multiattach/Queens/multiattach.patch b/multiattach/Queens/multiattach.patch new file mode 100644 index 0000000..3509cf9 --- /dev/null +++ b/multiattach/Queens/multiattach.patch @@ -0,0 +1,33 @@ +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index 31d578d28..c498437b1 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -54,6 +54,13 @@ volume_opts = [ + default='$state_path/mnt', + help=('Base dir containing the mount point' + ' for the Quobyte volume.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -502,6 +509,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if mounted: + self._validate_volume(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True) diff --git a/multiattach/Queens/multiattach_full_source.patch b/multiattach/Queens/multiattach_full_source.patch new file mode 100644 index 0000000..2e92d1b --- /dev/null +++ b/multiattach/Queens/multiattach_full_source.patch @@ -0,0 +1,80 @@ +diff --git a/cinder/tests/unit/volume/drivers/test_quobyte.py b/cinder/tests/unit/volume/drivers/test_quobyte.py +index ecec8eb68..0cdd26389 100644 +--- a/cinder/tests/unit/volume/drivers/test_quobyte.py ++++ b/cinder/tests/unit/volume/drivers/test_quobyte.py +@@ -15,6 +15,7 @@ + # under the License. + """Unit tests for the Quobyte driver module.""" + ++import ddt + import errno + import os + import psutil +@@ -34,6 +35,7 @@ from cinder.tests.unit import fake_snapshot + from cinder.tests.unit import fake_volume + from cinder.volume import configuration as conf + from cinder.volume.drivers import quobyte ++from cinder.volume.drivers import remotefs + + + class FakeDb(object): +@@ -47,6 +49,7 @@ class FakeDb(object): + return [] + + ++@ddt.ddt + class QuobyteDriverTestCase(test.TestCase): + """Test case for Quobyte driver.""" + +@@ -948,6 +951,18 @@ class QuobyteDriverTestCase(test.TestCase): + drv.configuration.nas_secure_file_permissions) + self.assertFalse(drv._execute_as_root) + ++ @ddt.data(True, False) ++ @mock.patch.object(remotefs.RemoteFSDriver, '_update_volume_stats') ++ def test__update_volume_stats(self, dat, mock_rfs_uvs): ++ drv = self._driver ++ drv.stats = {} ++ drv.configuration.quobyte_multiattach = dat ++ ++ drv._update_volume_stats() ++ ++ mock_rfs_uvs.assert_called_once_with() ++ self.assertEqual(dat, drv._stats['multiattach']) ++ + @mock.patch.object(psutil, "disk_partitions") + @mock.patch.object(os, "stat") + def test_validate_volume_all_good_prefix_val(self, stat_mock, part_mock): +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index 31d578d28..c498437b1 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -54,6 +54,13 @@ volume_opts = [ + default='$state_path/mnt', + help=('Base dir containing the mount point' + ' for the Quobyte volume.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -502,6 +509,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if mounted: + self._validate_volume(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True) diff --git a/multiattach/README.md b/multiattach/README.md new file mode 100644 index 0000000..cdfafbc --- /dev/null +++ b/multiattach/README.md @@ -0,0 +1,16 @@ + +## multiattach patch + +With this patch the Cinder Quobyte driver is enabled to use multiattach. Please note that using Cinder multiattach with Quobyte requires additional external locking services to be in use and Quobyte client caching to be off for the used Quobyte volume(s). + +This patch applies to stripped packaged installations as well as full source tree installations. Slightly different patch commands are used (see below). + +### Usage + +This patch can be applied by navigating to the Cinder project root directory. For stripped packaged installations please run: + + patch -p2 < /path/to/patchfile + +For full source tree installations please run: + + patch -p1 < /path/to/patchfile diff --git a/multiattach/Rocky/multiattach.patch b/multiattach/Rocky/multiattach.patch new file mode 100644 index 0000000..d6f0e0b --- /dev/null +++ b/multiattach/Rocky/multiattach.patch @@ -0,0 +1,35 @@ +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index 7067b9704..8fb6e1dbf 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -61,7 +61,14 @@ volume_opts = [ + default=False, + help=('Create a cache of volumes from merged snapshots to ' + 'speed up creation of multiple volumes from a single ' +- 'snapshot.')) ++ 'snapshot.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -591,6 +598,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if self.configuration.quobyte_volume_from_snapshot_cache: + self._ensure_volume_from_snap_cache(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True) diff --git a/multiattach/Rocky/multiattach_full_source.patch b/multiattach/Rocky/multiattach_full_source.patch new file mode 100644 index 0000000..450af81 --- /dev/null +++ b/multiattach/Rocky/multiattach_full_source.patch @@ -0,0 +1,82 @@ +diff --git a/cinder/tests/unit/volume/drivers/test_quobyte.py b/cinder/tests/unit/volume/drivers/test_quobyte.py +index a42b523eb..d2e1a14ff 100644 +--- a/cinder/tests/unit/volume/drivers/test_quobyte.py ++++ b/cinder/tests/unit/volume/drivers/test_quobyte.py +@@ -15,6 +15,7 @@ + # under the License. + """Unit tests for the Quobyte driver module.""" + ++import ddt + import errno + import os + import psutil +@@ -36,6 +37,7 @@ from cinder.tests.unit import fake_snapshot + from cinder.tests.unit import fake_volume + from cinder.volume import configuration as conf + from cinder.volume.drivers import quobyte ++from cinder.volume.drivers import remotefs + + + class FakeDb(object): +@@ -49,6 +51,7 @@ class FakeDb(object): + return [] + + ++@ddt.ddt + class QuobyteDriverTestCase(test.TestCase): + """Test case for Quobyte driver.""" + +@@ -1190,6 +1193,18 @@ class QuobyteDriverTestCase(test.TestCase): + drv.configuration.nas_secure_file_permissions) + self.assertFalse(drv._execute_as_root) + ++ @ddt.data(True, False) ++ @mock.patch.object(remotefs.RemoteFSDriver, '_update_volume_stats') ++ def test__update_volume_stats(self, dat, mock_rfs_uvs): ++ drv = self._driver ++ drv.stats = {} ++ drv.configuration.quobyte_multiattach = dat ++ ++ drv._update_volume_stats() ++ ++ mock_rfs_uvs.assert_called_once_with() ++ self.assertEqual(dat, drv._stats['multiattach']) ++ + @mock.patch.object(psutil, "disk_partitions") + @mock.patch.object(os, "stat") + def test_validate_volume_all_good_prefix_val(self, stat_mock, part_mock): +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index 7067b9704..8fb6e1dbf 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -61,7 +61,14 @@ volume_opts = [ + default=False, + help=('Create a cache of volumes from merged snapshots to ' + 'speed up creation of multiple volumes from a single ' +- 'snapshot.')) ++ 'snapshot.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -591,6 +598,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if self.configuration.quobyte_volume_from_snapshot_cache: + self._ensure_volume_from_snap_cache(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True) diff --git a/multiattach/Stein/multiattach.patch b/multiattach/Stein/multiattach.patch new file mode 100644 index 0000000..fafb243 --- /dev/null +++ b/multiattach/Stein/multiattach.patch @@ -0,0 +1,35 @@ +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index ede5e3f48..4720cc57f 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -71,7 +71,14 @@ volume_opts = [ + ' quobyte_qcow2_volumes and' + ' quobyte_volume_from_snapshot_cache to be set to' + ' True. If one of these is set to False this option is' +- ' ignored.')) ++ ' ignored.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -700,6 +707,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if self.configuration.quobyte_volume_from_snapshot_cache: + self._ensure_volume_from_snap_cache(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True) diff --git a/multiattach/Stein/multiattach_full_source.patch b/multiattach/Stein/multiattach_full_source.patch new file mode 100644 index 0000000..6f22b47 --- /dev/null +++ b/multiattach/Stein/multiattach_full_source.patch @@ -0,0 +1,58 @@ +diff --git a/cinder/tests/unit/volume/drivers/test_quobyte.py b/cinder/tests/unit/volume/drivers/test_quobyte.py +index 1fb177e5d..b1b81eaef 100644 +--- a/cinder/tests/unit/volume/drivers/test_quobyte.py ++++ b/cinder/tests/unit/volume/drivers/test_quobyte.py +@@ -1447,6 +1447,18 @@ class QuobyteDriverTestCase(test.TestCase): + drv.configuration.nas_secure_file_permissions) + self.assertFalse(drv._execute_as_root) + ++ @ddt.data(True, False) ++ @mock.patch.object(remotefs.RemoteFSDriver, '_update_volume_stats') ++ def test__update_volume_stats(self, dat, mock_rfs_uvs): ++ drv = self._driver ++ drv.stats = {} ++ drv.configuration.quobyte_multiattach = dat ++ ++ drv._update_volume_stats() ++ ++ mock_rfs_uvs.assert_called_once_with() ++ self.assertEqual(dat, drv._stats['multiattach']) ++ + @mock.patch.object(psutil, "disk_partitions") + @mock.patch.object(os, "stat") + def test_validate_volume_all_good_prefix_val(self, stat_mock, part_mock): +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index 339619854..bd5b995bd 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -71,7 +71,14 @@ volume_opts = [ + ' quobyte_qcow2_volumes and' + ' quobyte_volume_from_snapshot_cache to be set to' + ' True. If one of these is set to False this option is' +- ' ignored.')) ++ ' ignored.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -700,6 +707,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if self.configuration.quobyte_volume_from_snapshot_cache: + self._ensure_volume_from_snap_cache(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True) diff --git a/multiattach/Train/multiattach.patch b/multiattach/Train/multiattach.patch new file mode 100644 index 0000000..fafb243 --- /dev/null +++ b/multiattach/Train/multiattach.patch @@ -0,0 +1,35 @@ +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index ede5e3f48..4720cc57f 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -71,7 +71,14 @@ volume_opts = [ + ' quobyte_qcow2_volumes and' + ' quobyte_volume_from_snapshot_cache to be set to' + ' True. If one of these is set to False this option is' +- ' ignored.')) ++ ' ignored.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -700,6 +707,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if self.configuration.quobyte_volume_from_snapshot_cache: + self._ensure_volume_from_snap_cache(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True) diff --git a/multiattach/Train/multiattach_full_source.patch b/multiattach/Train/multiattach_full_source.patch new file mode 100644 index 0000000..6f22b47 --- /dev/null +++ b/multiattach/Train/multiattach_full_source.patch @@ -0,0 +1,58 @@ +diff --git a/cinder/tests/unit/volume/drivers/test_quobyte.py b/cinder/tests/unit/volume/drivers/test_quobyte.py +index 1fb177e5d..b1b81eaef 100644 +--- a/cinder/tests/unit/volume/drivers/test_quobyte.py ++++ b/cinder/tests/unit/volume/drivers/test_quobyte.py +@@ -1447,6 +1447,18 @@ class QuobyteDriverTestCase(test.TestCase): + drv.configuration.nas_secure_file_permissions) + self.assertFalse(drv._execute_as_root) + ++ @ddt.data(True, False) ++ @mock.patch.object(remotefs.RemoteFSDriver, '_update_volume_stats') ++ def test__update_volume_stats(self, dat, mock_rfs_uvs): ++ drv = self._driver ++ drv.stats = {} ++ drv.configuration.quobyte_multiattach = dat ++ ++ drv._update_volume_stats() ++ ++ mock_rfs_uvs.assert_called_once_with() ++ self.assertEqual(dat, drv._stats['multiattach']) ++ + @mock.patch.object(psutil, "disk_partitions") + @mock.patch.object(os, "stat") + def test_validate_volume_all_good_prefix_val(self, stat_mock, part_mock): +diff --git a/cinder/volume/drivers/quobyte.py b/cinder/volume/drivers/quobyte.py +index 339619854..bd5b995bd 100644 +--- a/cinder/volume/drivers/quobyte.py ++++ b/cinder/volume/drivers/quobyte.py +@@ -71,7 +71,14 @@ volume_opts = [ + ' quobyte_qcow2_volumes and' + ' quobyte_volume_from_snapshot_cache to be set to' + ' True. If one of these is set to False this option is' +- ' ignored.')) ++ ' ignored.')), ++ cfg.BoolOpt('quobyte_multiattach', ++ default=False, ++ help=('Allows using Cinders multi attach feature with Quobyte.' ++ ' Note that usage of multiattach with Quobyte requires' ++ ' using an additional distributed locking service.' ++ ' Ensure Quobyte volumes used with this option do not' ++ ' use client caching in their volume configuration.')) + ] + + CONF = cfg.CONF +@@ -700,6 +707,14 @@ class QuobyteDriver(remotefs_drv.RemoteFSSnapDriverDistributed): + if self.configuration.quobyte_volume_from_snapshot_cache: + self._ensure_volume_from_snap_cache(mount_path) + ++ def _update_volume_stats(self): ++ super(QuobyteDriver, self)._update_volume_stats() ++ if self.configuration.quobyte_multiattach: ++ self._stats["multiattach"] = True ++ LOG.info('multiattach for Quobyte is active.') ++ else: ++ self._stats["multiattach"] = False ++ + def _validate_volume(self, mount_path): + """Runs a number of tests on the expect Quobyte mount""" + partitions = psutil.disk_partitions(all=True)