Skip to content

Commit

Permalink
Adds a Cinder multiattach patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
casusbelli committed Mar 17, 2020
1 parent 3fea04b commit 4609a99
Show file tree
Hide file tree
Showing 10 changed files with 439 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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.

Expand Down
33 changes: 33 additions & 0 deletions multiattach/Queens/multiattach.patch
Original file line number Diff line number Diff line change
@@ -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)
80 changes: 80 additions & 0 deletions multiattach/Queens/multiattach_full_source.patch
Original file line number Diff line number Diff line change
@@ -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)
16 changes: 16 additions & 0 deletions multiattach/README.md
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions multiattach/Rocky/multiattach.patch
Original file line number Diff line number Diff line change
@@ -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)
82 changes: 82 additions & 0 deletions multiattach/Rocky/multiattach_full_source.patch
Original file line number Diff line number Diff line change
@@ -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)
35 changes: 35 additions & 0 deletions multiattach/Stein/multiattach.patch
Original file line number Diff line number Diff line change
@@ -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)
58 changes: 58 additions & 0 deletions multiattach/Stein/multiattach_full_source.patch
Original file line number Diff line number Diff line change
@@ -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)
Loading

0 comments on commit 4609a99

Please sign in to comment.