Skip to content

Commit b620212

Browse files
committed
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>
1 parent 00e7019 commit b620212

2 files changed

Lines changed: 47 additions & 4 deletions

File tree

openstackclient/common/quota.py

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -585,14 +585,20 @@ def get_parser(self, prog_name):
585585
parser.add_argument(
586586
'project',
587587
metavar='<project/class>',
588-
help=_('Set quotas for this project or class (name/ID)'),
588+
help=_('Set quotas for this project or class (name or ID)'),
589589
)
590+
# TODO(stephenfin): Remove in OSC 8.0
590591
parser.add_argument(
591592
'--class',
592593
dest='quota_class',
593594
action='store_true',
594595
default=False,
595-
help=_('Set quotas for <class>'),
596+
help=_(
597+
'**Deprecated** Set quotas for <class>. '
598+
'Deprecated as quota classes were never fully implemented '
599+
'and only the default class is supported. '
600+
'(compute and volume only)'
601+
),
596602
)
597603
for k, v, h in self._build_options_list():
598604
parser.add_argument(
@@ -624,6 +630,15 @@ def get_parser(self, prog_name):
624630
return parser
625631

626632
def take_action(self, parsed_args):
633+
if parsed_args.quota_class:
634+
msg = _(
635+
"The '--class' option has been deprecated. Quota classes were "
636+
"never fully implemented and the compute and volume services "
637+
"only support a single 'default' quota class while the "
638+
"network service does not support quota classes at all. "
639+
"Please use 'openstack quota show --default' instead."
640+
)
641+
self.log.warning(msg)
627642

628643
identity_client = self.app.client_manager.identity
629644
compute_client = self.app.client_manager.compute
@@ -718,12 +733,20 @@ def get_parser(self, prog_name):
718733
),
719734
)
720735
type_group = parser.add_mutually_exclusive_group()
736+
# TODO(stephenfin): Remove in OSC 8.0
721737
type_group.add_argument(
722738
'--class',
723739
dest='quota_class',
724740
action='store_true',
725741
default=False,
726-
help=_('Show quotas for <class>'),
742+
help=_(
743+
'**Deprecated** Show quotas for <class>. '
744+
'Deprecated as quota classes were never fully implemented '
745+
'and only the default class is supported. '
746+
'Use --default instead which is also supported by the network '
747+
'service. '
748+
'(compute and volume only)'
749+
),
727750
)
728751
type_group.add_argument(
729752
'--default',
@@ -778,7 +801,16 @@ def get_parser(self, prog_name):
778801
def take_action(self, parsed_args):
779802
project = parsed_args.project
780803

781-
if not parsed_args.quota_class:
804+
if parsed_args.quota_class:
805+
msg = _(
806+
"The '--class' option has been deprecated. Quota classes were "
807+
"never fully implemented and the compute and volume services "
808+
"only support a single 'default' quota class while the "
809+
"network service does not support quota classes at all. "
810+
"Please use 'openstack quota show --default' instead."
811+
)
812+
self.log.warning(msg)
813+
else:
782814
project_info = get_project(self.app, parsed_args.project)
783815
project = project_info['id']
784816

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
deprecations:
3+
- |
4+
The ``--class`` options of the ``quota show`` and ``quota set`` commands
5+
are now deprecated. Quota classes were never fully implemented and the
6+
compute and volume services only support a single ``default`` quota class
7+
while the network service does not support quota classes at all. The
8+
default quotas can be changed on a deployment-wide basis via configuration
9+
and can be inspected using the ``openstack quota show --default`` command.
10+
Quotas can still be set on a project-specific basis using the ``quota set``
11+
command.

0 commit comments

Comments
 (0)