-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fea04b
commit 4609a99
Showing
10 changed files
with
439 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Oops, something went wrong.