Deprecate useless quota_usage_refresh from nova-manage
Since we no longer use usage records, we don't need the nova-manage command to sync usage records with actual resource consumption. Co-Authored-By: melanie witt <melwittt@gmail.com> Part of blueprint cells-count-resources-to-check-quota-in-api Change-Id: I55f7a2b6e15eec6e6ec97be23903325ad22bd4d4
This commit is contained in:
parent
fb5ca63ade
commit
f2606322f7
@ -230,9 +230,14 @@ Nova Shell
|
||||
Nova Quota
|
||||
~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 16.0.0
|
||||
|
||||
This will be removed in 17.0.0 (Queens)
|
||||
|
||||
``nova-manage quota refresh``
|
||||
|
||||
Refresh the quota usage for a project or user.
|
||||
This command has been deprecated and is now a no-op since quota usage is
|
||||
counted from resources instead of being tracked separately.
|
||||
|
||||
Nova Project
|
||||
~~~~~~~~~~~~
|
||||
@ -243,9 +248,10 @@ Nova Project
|
||||
the ``quota_usage_refresh`` command. Operators should use the `API`_ for
|
||||
all other operations.
|
||||
|
||||
This command group will be removed in 17.0.0 (Queens). Users of the
|
||||
``quota_usage_refresh`` subcommand should instead use :ref:`nova-manage
|
||||
quota refresh <nova-manage-quota>`
|
||||
This command group will be removed in 17.0.0 (Queens). The
|
||||
``quota_usage_refresh`` subcommand has been deprecated and is now a no-op
|
||||
since quota usage is counted from resources instead of being tracked
|
||||
separately.
|
||||
|
||||
.. _API: https://developer.openstack.org/api-ref/compute/#quota-sets-os-quota-sets
|
||||
|
||||
@ -256,15 +262,8 @@ Nova Project
|
||||
|
||||
``nova-manage project quota_usage_refresh <project_id> [--user <user_id>] [--key <key>]``
|
||||
|
||||
Refresh the quota usages for the project/user so that the
|
||||
usage record matches the actual used. If a key is not specified
|
||||
then all quota usages relevant to the project/user are refreshed.
|
||||
|
||||
.. seealso::
|
||||
|
||||
The :ref:`nova-manage quota refresh <nova-manage-quota>` command
|
||||
performs the same actions and is not deprecated. That command should be
|
||||
used instead.
|
||||
This command has been deprecated and is now a no-op since quota usage is
|
||||
counted from resources instead of being tracked separately.
|
||||
|
||||
SEE ALSO
|
||||
========
|
||||
|
@ -209,29 +209,21 @@ def _db_error(caught_exception):
|
||||
class QuotaCommands(object):
|
||||
"""Class for managing quotas."""
|
||||
|
||||
# TODO(melwitt): Remove this during the Queens cycle
|
||||
description = ('DEPRECATED: The quota commands are deprecated since '
|
||||
'Pike as quota usage is counted from resources instead '
|
||||
'of being tracked separately. They will be removed in an '
|
||||
'upcoming release.')
|
||||
|
||||
@args('--project', dest='project_id', metavar='<Project Id>',
|
||||
help='Project Id', required=True)
|
||||
@args('--user', dest='user_id', metavar='<User Id>',
|
||||
help='User Id')
|
||||
@args('--key', metavar='<key>', help='Key')
|
||||
def refresh(self, project_id, user_id=None, key=None):
|
||||
"""Refresh the quotas for a project or user.
|
||||
|
||||
If no quota key is provided, all the quota usages will be refreshed.
|
||||
If a valid quota key is provided and it does not exist, it will be
|
||||
created. Otherwise, it will be refreshed.
|
||||
"""DEPRECATED: This command is deprecated and no longer does anything.
|
||||
"""
|
||||
ctxt = context.get_admin_context()
|
||||
|
||||
keys = None
|
||||
if key:
|
||||
keys = [key]
|
||||
|
||||
try:
|
||||
QUOTAS.usage_refresh(ctxt, project_id, user_id, keys)
|
||||
except exception.QuotaUsageRefreshNotAllowed as e:
|
||||
print(e.format_message())
|
||||
return 2
|
||||
pass
|
||||
|
||||
|
||||
class ProjectCommands(object):
|
||||
@ -317,26 +309,10 @@ class ProjectCommands(object):
|
||||
help='User Id')
|
||||
@args('--key', metavar='<key>', help='Key')
|
||||
def quota_usage_refresh(self, project_id, user_id=None, key=None):
|
||||
"""Refresh the quotas for project/user
|
||||
|
||||
If no quota key is provided, all the quota usages will be refreshed.
|
||||
If a valid quota key is provided and it does not exist, it will be
|
||||
created. Otherwise, it will be refreshed.
|
||||
|
||||
DEPRECATED: This command is deprecated. Use ``nova-manage quota
|
||||
refresh`` instead.
|
||||
"""DEPRECATED: This command is deprecated and no longer does anything.
|
||||
"""
|
||||
ctxt = context.get_admin_context()
|
||||
|
||||
keys = None
|
||||
if key:
|
||||
keys = [key]
|
||||
|
||||
try:
|
||||
QUOTAS.usage_refresh(ctxt, project_id, user_id, keys)
|
||||
except exception.QuotaUsageRefreshNotAllowed as e:
|
||||
print(e.format_message())
|
||||
return 2
|
||||
# TODO(melwitt): Remove this during the Queens cycle
|
||||
pass
|
||||
|
||||
|
||||
class AccountCommands(ProjectCommands):
|
||||
|
@ -354,27 +354,6 @@ class ProjectCommandsTestCase(test.TestCase):
|
||||
def test_quota_update_invalid_key(self):
|
||||
self.assertEqual(2, self.commands.quota('admin', 'volumes1', '10'))
|
||||
|
||||
def test_quota_usage_refresh_all_user_keys(self):
|
||||
self.assertIsNone(self.commands.quota_usage_refresh(
|
||||
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaab'))
|
||||
|
||||
def test_quota_usage_refresh_all_project_keys(self):
|
||||
self.assertIsNone(self.commands.quota_usage_refresh(
|
||||
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa'))
|
||||
|
||||
def test_quota_usage_refresh_invalid_user_key(self):
|
||||
self.assertEqual(2, self.commands.quota_usage_refresh(
|
||||
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaab',
|
||||
'fixed_ip'))
|
||||
|
||||
def test_quota_usage_refresh_invalid_project_key(self):
|
||||
self.assertEqual(2, self.commands.quota_usage_refresh(
|
||||
'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
|
||||
None,
|
||||
'ram'))
|
||||
|
||||
|
||||
class DBCommandsTestCase(test.NoDBTestCase):
|
||||
def setUp(self):
|
||||
|
@ -0,0 +1,6 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
The ``nova-manage quota refresh`` command has been deprecated and is now a
|
||||
no-op since quota usage is counted from resources instead of being tracked
|
||||
separately. The command will be removed during the Queens cycle.
|
Loading…
Reference in New Issue
Block a user