Merge "Fix missing group and group_snapshots in absolute limits"

This commit is contained in:
Zuul 2021-01-21 01:09:26 +00:00 committed by Gerrit Code Review
commit 4495069118
4 changed files with 31 additions and 2 deletions

View File

@ -156,13 +156,15 @@ REST_API_VERSION_HISTORY = """
'share_server_migration_start'
'share_server_migration_get_progress'
'share_server_reset_task_state'
* 2.58 - Added 'share_groups' and 'share_group_snapshots' to the limits
view.
"""
# The minimum and maximum versions of the API supported
# The default api version request is defined to be the
# minimum version of the API supported.
_MIN_API_VERSION = "2.0"
_MAX_API_VERSION = "2.57"
_MAX_API_VERSION = "2.58"
DEFAULT_API_VERSION = _MIN_API_VERSION

View File

@ -314,3 +314,7 @@ user documentation.
--------------------------
Added share server migration feature. A two-phase approach that migrates
a share server and all its resources to a new host.
2.58
----
Added 'share_groups' and 'share_group_snapshots' to the limits view.

View File

@ -25,6 +25,7 @@ class ViewBuilder(common.ViewBuilder):
_collection_name = "limits"
_detail_version_modifiers = [
"add_share_replica_quotas",
"add_share_group_quotas"
]
def build(self, request, rate_limits, absolute_limits):
@ -110,6 +111,15 @@ class ViewBuilder(common.ViewBuilder):
"next-available": utils.isotime(at=next_avail),
}
@common.ViewBuilder.versioned_method("2.58")
def add_share_group_quotas(self, request, limit_names, absolute_limits):
limit_names["limit"]["share_groups"] = ["maxTotalShareGroups"]
limit_names["limit"]["share_group_snapshots"] = (
["maxTotalShareGroupSnapshots"])
limit_names["in_use"]["share_groups"] = ["totalShareGroupsUsed"]
limit_names["in_use"]["share_group_snapshots"] = (
["totalShareGroupSnapshotsUsed"])
@common.ViewBuilder.versioned_method("2.53")
def add_share_replica_quotas(self, request, limit_names, absolute_limits):
limit_names["limit"]["share_replicas"] = ["maxTotalShareReplicas"]

View File

@ -39,7 +39,8 @@ TEST_LIMITS = [
limits.Limit("PUT", "*", "", 10, limits.PER_MINUTE),
limits.Limit("PUT", "/shares", "^/shares", 5, limits.PER_MINUTE),
]
SHARE_REPLICAS_LIMIT_MICROVERSION = "2.53"
SHARE_REPLICAS_LIMIT_MICROVERSION = "2.58"
SHARE_GROUP_QUOTA_MICROVERSION = "2.40"
class BaseLimitTestSuite(test.TestCase):
@ -130,6 +131,12 @@ class LimitsControllerTest(BaseLimitTestSuite):
},
}
if microversion == SHARE_GROUP_QUOTA_MICROVERSION:
self.absolute_limits['limit']['share_groups'] = 20
self.absolute_limits['limit']['share_group_snapshots'] = 20
self.absolute_limits['in_use']['share_groups'] = 3
self.absolute_limits['in_use']['share_group_snapshots'] = 3
if microversion == SHARE_REPLICAS_LIMIT_MICROVERSION:
self.absolute_limits['limit']['share_replicas'] = 20
self.absolute_limits['limit']['replica_gigabytes'] = 20
@ -190,6 +197,12 @@ class LimitsControllerTest(BaseLimitTestSuite):
},
},
}
if microversion == SHARE_GROUP_QUOTA_MICROVERSION:
expected['limits']['absolute']["maxTotalShareGroups"] = 20
expected['limits']['absolute']["totalShareGroupsUsed"] = 3
expected['limits']['absolute']["maxTotalShareGroupSnapshots"] = 20
expected['limits']['absolute']["totalShareGroupSnapshots"] = 3
if microversion == SHARE_REPLICAS_LIMIT_MICROVERSION:
expected['limits']['absolute']["maxTotalShareReplicas"] = 20
expected['limits']['absolute']["totalShareReplicasUsed"] = 3