From 8fbfe923bd99760293117dea47040c77746bc2d5 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Mon, 6 May 2019 20:32:47 -0500 Subject: [PATCH] Deprecate NestedDbQuotaDriver for nested quotas This driver does not appear to be used and all projects will be switching over to the keystone supported unified limits quota mechanism. To prepare for switching quota handling to this new code, we want to deprecate the driver now so we can remove the code and not need to refactor it into the new handling. Change-Id: I56fc03affc9c2c47cbc0e38a66aa8b86f56d1499 Signed-off-by: Sean McGinnis --- cinder/cmd/status.py | 21 +++++++++++++++++++ cinder/quota.py | 6 ++++++ cinder/tests/unit/cmd/test_status.py | 14 +++++++++++++ doc/source/cli/cinder-status.rst | 1 + .../block-storage/nested-quota.rst | 7 +++++++ ...precate-nested-quota-d1ad7e8f54492a87.yaml | 13 ++++++++++++ 6 files changed, 62 insertions(+) create mode 100644 releasenotes/notes/deprecate-nested-quota-d1ad7e8f54492a87.yaml diff --git a/cinder/cmd/status.py b/cinder/cmd/status.py index 958fa358631..9e8540016ab 100644 --- a/cinder/cmd/status.py +++ b/cinder/cmd/status.py @@ -131,12 +131,33 @@ class Checks(uc.UpgradeCommands): return uc.Result(SUCCESS) + def _check_nested_quota(self): + """Checks for the use of the nested quota driver. + + The NestedDbQuotaDriver is deprecated in the Train release to prepare + for upcoming unified limits changes. + """ + # We import here to avoid conf loading order issues with cinder.service + # above. + import cinder.quota # noqa + + quota_driver = CONF.quota_driver + if quota_driver == 'cinder.quota.NestedDbQuotaDriver': + return uc.Result( + WARNING, + 'The NestedDbQuotaDriver has been deprecated. It will ' + 'continue to work in the 15.0.0 (Train) release, but will be ' + 'removed in 16.0.0') + + return uc.Result(SUCCESS) + _upgrade_checks = ( # added in Stein ('Backup Driver Path', _check_backup_module), ('Use of Policy File', _check_policy_file), # added in Train ('Periodic Interval Use', _check_periodic_interval), + ('Use of Nest Quota Driver', _check_nested_quota), ) diff --git a/cinder/quota.py b/cinder/quota.py index 77155109a6d..2ec8da431d9 100644 --- a/cinder/quota.py +++ b/cinder/quota.py @@ -452,6 +452,12 @@ class DbQuotaDriver(object): class NestedDbQuotaDriver(DbQuotaDriver): + + def __init__(self, *args, **kwargs): + super(NestedDbQuotaDriver, self).__init__(*args, **kwargs) + LOG.warning('The NestedDbQuotaDriver is deprecated and will be ' + 'removed in the "U" release.') + def validate_nested_setup(self, ctxt, resources, project_tree, fix_allocated_quotas=False): """Ensures project_tree has quotas that make sense as nested quotas. diff --git a/cinder/tests/unit/cmd/test_status.py b/cinder/tests/unit/cmd/test_status.py index 5fa24e575bb..26997944015 100644 --- a/cinder/tests/unit/cmd/test_status.py +++ b/cinder/tests/unit/cmd/test_status.py @@ -12,6 +12,7 @@ """Unit tests for the cinder-status CLI interfaces.""" +import ddt import mock from oslo_config import cfg from oslo_upgradecheck import upgradecheck as uc @@ -22,6 +23,7 @@ from cinder.cmd import status CONF = cfg.CONF +@ddt.ddt class TestCinderStatus(testtools.TestCase): """Test cases for the cinder-status upgrade check command.""" @@ -109,3 +111,15 @@ class TestCinderStatus(testtools.TestCase): self.assertEqual(uc.Code.WARNING, result.code) self.assertIn('New configuration options have been introduced', result.details) + + @ddt.data(['cinder.quota.DbQuotaDriver', True], + ['cinder.quota.NestedDbQuotaDriver', False]) + @ddt.unpack + def test_nested_quota_driver(self, driver, should_pass): + self._set_config('quota_driver', driver) + result = self.checks._check_nested_quota() + if should_pass: + expected = uc.Code.SUCCESS + else: + expected = uc.Code.WARNING + self.assertEqual(expected, result.code) diff --git a/doc/source/cli/cinder-status.rst b/doc/source/cli/cinder-status.rst index 9a040ba7307..a19145bbe39 100644 --- a/doc/source/cli/cinder-status.rst +++ b/doc/source/cli/cinder-status.rst @@ -95,6 +95,7 @@ Upgrade * Check added to make operators aware of new finer-grained configuration options affecting the periodicity of various Cinder tasks. Triggered when the the ``periodic_interval`` option is not set to its default value. + * Added check for use of deprecated ``cinder.quota.NestedDbQuotaDriver``. See Also ======== diff --git a/doc/source/configuration/block-storage/nested-quota.rst b/doc/source/configuration/block-storage/nested-quota.rst index 9fcdabdaa4d..524b30795d6 100644 --- a/doc/source/configuration/block-storage/nested-quota.rst +++ b/doc/source/configuration/block-storage/nested-quota.rst @@ -2,6 +2,13 @@ Nested quotas ============= +.. warning:: + + The current nested quota driver is deprecated in the Cinder "Train" release + and will be removed. Configuration for handling nested project quotas will + change in a future release. + + Nested quota is a change in how OpenStack services (such as Block Storage and Compute) handle their quota resources by being hierarchy-aware. The main reason for this change is to fully appreciate the hierarchical multi-tenancy diff --git a/releasenotes/notes/deprecate-nested-quota-d1ad7e8f54492a87.yaml b/releasenotes/notes/deprecate-nested-quota-d1ad7e8f54492a87.yaml new file mode 100644 index 00000000000..c063ca53b2a --- /dev/null +++ b/releasenotes/notes/deprecate-nested-quota-d1ad7e8f54492a87.yaml @@ -0,0 +1,13 @@ +--- +upgrade: + - | + A new check is added to the ``cinder-status upgrade check`` CLI to check + for the use of the deprecated ``cinder.quota.NestedDbQuotaDriver``. This + driver will be replaced by a new, OpenStack-wide, nested quota management. +deprecations: + - | + The ``cinder.quota.NestedDbQuotaDriver`` quota driver for handling nested + projects is now deprecated. There is an OpenStack-wide effort to move to + "unified limits" that will require changes in how quotas are handled for + these types of configurations. The ``NestedDbQuotaDriver`` will continue + to work until it is replaced with this new mechanism.