Add share groups/share group snaps to quota class
Share groups and share group snapshots can be now updated through the quota class API This change adds this option to the manilaclient CLI Closes-Bug: #1871252 Change-Id: If2faf8a88a0a0e39d7fd0554bc3e530e18c3e922
This commit is contained in:
parent
a20f85f3d7
commit
be8326b7cc
@ -3185,7 +3185,14 @@ class ShellTest(test_utils.TestCase):
|
||||
'--snapshots': 5,
|
||||
'--gigabytes': 5,
|
||||
'--snapshot-gigabytes': 5,
|
||||
'--share-networks': 5})
|
||||
'--share-networks': 5},
|
||||
{'--shares': 5,
|
||||
'--snapshots': 5,
|
||||
'--gigabytes': 5,
|
||||
'--snapshot-gigabytes': 5,
|
||||
'--share-networks': 5,
|
||||
'--share-groups': 5,
|
||||
'--share-group-snapshots': 5})
|
||||
def test_quota_class_update(self, data):
|
||||
cmd = 'quota-class-update test'
|
||||
expected = dict()
|
||||
|
@ -55,6 +55,7 @@ class QuotaClassSetManager(base.ManagerWithFind):
|
||||
snapshots=None, snapshot_gigabytes=None,
|
||||
share_networks=None, share_replicas=None,
|
||||
replica_gigabytes=None, per_share_gigabytes=None,
|
||||
share_groups=None, share_group_snapshots=None,
|
||||
resource_path=RESOURCE_PATH):
|
||||
body = {
|
||||
'quota_class_set': {
|
||||
@ -67,6 +68,8 @@ class QuotaClassSetManager(base.ManagerWithFind):
|
||||
"share_replicas": share_replicas,
|
||||
"replica_gigabytes": replica_gigabytes,
|
||||
'per_share_gigabytes': per_share_gigabytes,
|
||||
'share_groups': share_groups,
|
||||
'share_group_snapshots': share_group_snapshots,
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,7 +91,7 @@ class QuotaClassSetManager(base.ManagerWithFind):
|
||||
snapshots=snapshots, snapshot_gigabytes=snapshot_gigabytes,
|
||||
share_networks=share_networks, resource_path=RESOURCE_PATH_LEGACY)
|
||||
|
||||
@api_versions.wraps("2.7", "2.52") # noqa
|
||||
@api_versions.wraps("2.7", "2.39") # noqa
|
||||
def update(self, class_name, shares=None, gigabytes=None, # noqa
|
||||
snapshots=None, snapshot_gigabytes=None, share_networks=None):
|
||||
return self._do_update(
|
||||
@ -96,25 +99,42 @@ class QuotaClassSetManager(base.ManagerWithFind):
|
||||
snapshots=snapshots, snapshot_gigabytes=snapshot_gigabytes,
|
||||
share_networks=share_networks, resource_path=RESOURCE_PATH)
|
||||
|
||||
@api_versions.wraps("2.40", "2.52") # noqa
|
||||
def update(self, class_name, shares=None, gigabytes=None, # noqa
|
||||
snapshots=None, snapshot_gigabytes=None, share_networks=None,
|
||||
share_groups=None, share_group_snapshots=None):
|
||||
return self._do_update(
|
||||
class_name, shares=shares, gigabytes=gigabytes,
|
||||
snapshots=snapshots, snapshot_gigabytes=snapshot_gigabytes,
|
||||
share_networks=share_networks, share_groups=share_groups,
|
||||
share_group_snapshots=share_group_snapshots,
|
||||
resource_path=RESOURCE_PATH)
|
||||
|
||||
@api_versions.wraps(REPLICA_QUOTAS_MICROVERSION, "2.61") # noqa
|
||||
def update(self, class_name, shares=None, gigabytes=None, # noqa
|
||||
snapshots=None, snapshot_gigabytes=None, share_networks=None,
|
||||
share_groups=None, share_group_snapshots=None,
|
||||
share_replicas=None, replica_gigabytes=None):
|
||||
return self._do_update(
|
||||
class_name, shares=shares, gigabytes=gigabytes,
|
||||
snapshots=snapshots, snapshot_gigabytes=snapshot_gigabytes,
|
||||
share_networks=share_networks, share_replicas=share_replicas,
|
||||
replica_gigabytes=replica_gigabytes, resource_path=RESOURCE_PATH)
|
||||
share_networks=share_networks, share_groups=share_groups,
|
||||
share_group_snapshots=share_group_snapshots,
|
||||
share_replicas=share_replicas, replica_gigabytes=replica_gigabytes,
|
||||
resource_path=RESOURCE_PATH)
|
||||
|
||||
@api_versions.wraps("2.62") # noqa
|
||||
def update(self, class_name, shares=None, gigabytes=None, # noqa
|
||||
snapshots=None, snapshot_gigabytes=None, share_networks=None,
|
||||
share_groups=None, share_group_snapshots=None,
|
||||
share_replicas=None, replica_gigabytes=None,
|
||||
per_share_gigabytes=None):
|
||||
return self._do_update(
|
||||
class_name, shares=shares, gigabytes=gigabytes,
|
||||
snapshots=snapshots, snapshot_gigabytes=snapshot_gigabytes,
|
||||
share_networks=share_networks, share_replicas=share_replicas,
|
||||
share_networks=share_networks, share_groups=share_groups,
|
||||
share_group_snapshots=share_group_snapshots,
|
||||
share_replicas=share_replicas,
|
||||
replica_gigabytes=replica_gigabytes,
|
||||
per_share_gigabytes=per_share_gigabytes,
|
||||
resource_path=RESOURCE_PATH)
|
||||
|
@ -458,7 +458,9 @@ _quota_resources = [
|
||||
'share_networks',
|
||||
'share_replicas',
|
||||
'replica_gigabytes',
|
||||
'per_share_gigabytes'
|
||||
'per_share_gigabytes',
|
||||
'share_groups',
|
||||
'share_group_snapshots'
|
||||
]
|
||||
|
||||
|
||||
@ -772,6 +774,24 @@ def do_quota_class_show(cs, args):
|
||||
default=None,
|
||||
action='single_alias',
|
||||
help='New value for the "share_networks" quota.')
|
||||
@cliutils.arg(
|
||||
'--share-groups',
|
||||
'--share_groups', # alias
|
||||
metavar='<share-groups>',
|
||||
type=int,
|
||||
default=None,
|
||||
action='single_alias',
|
||||
help='New value for the "share_groups" quota. Available only for '
|
||||
'microversion >= 2.40')
|
||||
@cliutils.arg(
|
||||
'--share-group-snapshots',
|
||||
'--share_group_snapshots',
|
||||
metavar='<share-group-snapshots>',
|
||||
type=int,
|
||||
default=None,
|
||||
action='single_alias',
|
||||
help='New value for the "share_group_snapshots" quota. Available only for '
|
||||
'microversion >= 2.40')
|
||||
@cliutils.arg(
|
||||
'--share-replicas',
|
||||
'--share_replicas', # alias
|
||||
@ -802,6 +822,11 @@ def do_quota_class_show(cs, args):
|
||||
'microversion >= 2.62')
|
||||
def do_quota_class_update(cs, args):
|
||||
"""Update the quotas for a quota class (Admin only)."""
|
||||
if args.share_groups is not None or args.share_group_snapshots is not None:
|
||||
if cs.api_version < api_versions.APIVersion("2.40"):
|
||||
raise exceptions.CommandError(
|
||||
"'share groups' quotas are available only starting with "
|
||||
"'2.40' API microversion.")
|
||||
if args.share_replicas is not None or args.replica_gigabytes is not None:
|
||||
if cs.api_version < api_versions.APIVersion("2.53"):
|
||||
raise exceptions.CommandError(
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Share group and share group snapshots quotas have been available in manila
|
||||
since API 2.40. With this change, we added the possibility for users to update
|
||||
share group and share group snapshots quotas via the quota class API to the
|
||||
manilaclient CLI. For more details, please refer to
|
||||
`Launchpad bug 1871252 <https://bugs.launchpad.net/manila/+bug/1871252>`_.
|
Loading…
Reference in New Issue
Block a user