From b62021260c9c2d372ea635a2a7f0608b7c8472e1 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 23 Sep 2022 18:21:56 +0100 Subject: [PATCH] quota: Deprecate 'quota show --class', 'quota set --class' arguments This doesn't do anything special in nova and cinder and is not supported in neutron. For the 'quota show' command, people should use the '--default' argument instead. Change-Id: I0dd38e5cb252a01d5817ed168be040b21b35e348 Signed-off-by: Stephen Finucane --- openstackclient/common/quota.py | 40 +++++++++++++++++-- ...-quota-class-options-ba33a45caedbdf3e.yaml | 11 +++++ 2 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/deprecated-quota-class-options-ba33a45caedbdf3e.yaml diff --git a/openstackclient/common/quota.py b/openstackclient/common/quota.py index 0504b15298..6739c51b5a 100644 --- a/openstackclient/common/quota.py +++ b/openstackclient/common/quota.py @@ -585,14 +585,20 @@ class SetQuota(common.NetDetectionMixin, command.Command): parser.add_argument( 'project', metavar='', - help=_('Set quotas for this project or class (name/ID)'), + help=_('Set quotas for this project or class (name or ID)'), ) + # TODO(stephenfin): Remove in OSC 8.0 parser.add_argument( '--class', dest='quota_class', action='store_true', default=False, - help=_('Set quotas for '), + help=_( + '**Deprecated** Set quotas for . ' + 'Deprecated as quota classes were never fully implemented ' + 'and only the default class is supported. ' + '(compute and volume only)' + ), ) for k, v, h in self._build_options_list(): parser.add_argument( @@ -624,6 +630,15 @@ class SetQuota(common.NetDetectionMixin, command.Command): return parser def take_action(self, parsed_args): + if parsed_args.quota_class: + msg = _( + "The '--class' option has been deprecated. Quota classes were " + "never fully implemented and the compute and volume services " + "only support a single 'default' quota class while the " + "network service does not support quota classes at all. " + "Please use 'openstack quota show --default' instead." + ) + self.log.warning(msg) identity_client = self.app.client_manager.identity compute_client = self.app.client_manager.compute @@ -718,12 +733,20 @@ class ShowQuota(command.Lister): ), ) type_group = parser.add_mutually_exclusive_group() + # TODO(stephenfin): Remove in OSC 8.0 type_group.add_argument( '--class', dest='quota_class', action='store_true', default=False, - help=_('Show quotas for '), + help=_( + '**Deprecated** Show quotas for . ' + 'Deprecated as quota classes were never fully implemented ' + 'and only the default class is supported. ' + 'Use --default instead which is also supported by the network ' + 'service. ' + '(compute and volume only)' + ), ) type_group.add_argument( '--default', @@ -778,7 +801,16 @@ class ShowQuota(command.Lister): def take_action(self, parsed_args): project = parsed_args.project - if not parsed_args.quota_class: + if parsed_args.quota_class: + msg = _( + "The '--class' option has been deprecated. Quota classes were " + "never fully implemented and the compute and volume services " + "only support a single 'default' quota class while the " + "network service does not support quota classes at all. " + "Please use 'openstack quota show --default' instead." + ) + self.log.warning(msg) + else: project_info = get_project(self.app, parsed_args.project) project = project_info['id'] diff --git a/releasenotes/notes/deprecated-quota-class-options-ba33a45caedbdf3e.yaml b/releasenotes/notes/deprecated-quota-class-options-ba33a45caedbdf3e.yaml new file mode 100644 index 0000000000..d1800f7a02 --- /dev/null +++ b/releasenotes/notes/deprecated-quota-class-options-ba33a45caedbdf3e.yaml @@ -0,0 +1,11 @@ +--- +deprecations: + - | + The ``--class`` options of the ``quota show`` and ``quota set`` commands + are now deprecated. Quota classes were never fully implemented and the + compute and volume services only support a single ``default`` quota class + while the network service does not support quota classes at all. The + default quotas can be changed on a deployment-wide basis via configuration + and can be inspected using the ``openstack quota show --default`` command. + Quotas can still be set on a project-specific basis using the ``quota set`` + command.