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 <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane 2022-09-23 18:21:56 +01:00
parent 00e7019022
commit b62021260c
2 changed files with 47 additions and 4 deletions

View File

@ -585,14 +585,20 @@ class SetQuota(common.NetDetectionMixin, command.Command):
parser.add_argument(
'project',
metavar='<project/class>',
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 <class>'),
help=_(
'**Deprecated** Set quotas for <class>. '
'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 <class>'),
help=_(
'**Deprecated** Show quotas for <class>. '
'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']

View File

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