Allow setting quotas for server groups and server group members

Adds support of --server-groups and --server-group-members options
to the "quota set" command.

Change-Id: I178d1e267d010be7e908adefcf3b15abdafd9da4
Closes-Bug: #1602223
This commit is contained in:
Elena Ezhova 2016-07-12 14:38:48 +03:00
parent 97ccb65f83
commit b50c2b6a88
5 changed files with 30 additions and 0 deletions

View File

@ -25,6 +25,8 @@ Set quotas for project
[--key-pairs <num-key-pairs>] [--key-pairs <num-key-pairs>]
[--properties <num-properties>] [--properties <num-properties>]
[--ram <ram-mb>] [--ram <ram-mb>]
[--server-groups <num-server-groups>]
[--server-group-members <num-server-group-members>]
# Block Storage settings # Block Storage settings
[--gigabytes <new-gigabytes>] [--gigabytes <new-gigabytes>]
@ -64,6 +66,8 @@ Set quotas for class
[--key-pairs <num-key-pairs>] [--key-pairs <num-key-pairs>]
[--properties <num-properties>] [--properties <num-properties>]
[--ram <ram-mb>] [--ram <ram-mb>]
[--server-groups <num-server-groups>]
[--server-group-members <num-server-group-members>]
# Block Storage settings # Block Storage settings
[--gigabytes <new-gigabytes>] [--gigabytes <new-gigabytes>]
@ -108,6 +112,14 @@ Set quotas for class
New value for the injected-file-size quota New value for the injected-file-size quota
.. option:: --server-groups <new-server-groups>
New value for the server-groups quota
.. option:: --server-group-members <new-server-group-members>
New value for the server-group-members quota
.. option:: --floating-ips <new-floating-ips> .. option:: --floating-ips <new-floating-ips>
New value for the floating-ips quota New value for the floating-ips quota

View File

@ -38,6 +38,8 @@ COMPUTE_QUOTAS = {
'key_pairs': 'key-pairs', 'key_pairs': 'key-pairs',
'metadata_items': 'properties', 'metadata_items': 'properties',
'ram': 'ram', 'ram': 'ram',
'server_groups': 'server-groups',
'server_group_members': 'server-group-members',
} }
VOLUME_QUOTAS = { VOLUME_QUOTAS = {

View File

@ -115,6 +115,8 @@ class TestQuotaSet(TestQuota):
'--properties', str(compute_fakes.property_num), '--properties', str(compute_fakes.property_num),
'--secgroup-rules', str(compute_fakes.secgroup_rule_num), '--secgroup-rules', str(compute_fakes.secgroup_rule_num),
'--secgroups', str(compute_fakes.secgroup_num), '--secgroups', str(compute_fakes.secgroup_num),
'--server-groups', str(compute_fakes.servgroup_num),
'--server-group-members', str(compute_fakes.servgroup_members_num),
identity_fakes.project_name, identity_fakes.project_name,
] ]
verifylist = [ verifylist = [
@ -131,6 +133,8 @@ class TestQuotaSet(TestQuota):
('metadata_items', compute_fakes.property_num), ('metadata_items', compute_fakes.property_num),
('security_group_rules', compute_fakes.secgroup_rule_num), ('security_group_rules', compute_fakes.secgroup_rule_num),
('security_groups', compute_fakes.secgroup_num), ('security_groups', compute_fakes.secgroup_num),
('server_groups', compute_fakes.servgroup_num),
('server_group_members', compute_fakes.servgroup_members_num),
('project', identity_fakes.project_name), ('project', identity_fakes.project_name),
] ]
@ -153,6 +157,8 @@ class TestQuotaSet(TestQuota):
'metadata_items': compute_fakes.property_num, 'metadata_items': compute_fakes.property_num,
'security_group_rules': compute_fakes.secgroup_rule_num, 'security_group_rules': compute_fakes.secgroup_rule_num,
'security_groups': compute_fakes.secgroup_num, 'security_groups': compute_fakes.secgroup_num,
'server_groups': compute_fakes.servgroup_num,
'server_group_members': compute_fakes.servgroup_members_num,
} }
self.quotas_mock.update.assert_called_with( self.quotas_mock.update.assert_called_with(

View File

@ -36,6 +36,8 @@ instance_num = 10
property_num = 128 property_num = 128
secgroup_rule_num = 20 secgroup_rule_num = 20
secgroup_num = 10 secgroup_num = 10
servgroup_num = 10
servgroup_members_num = 10
project_name = 'project_test' project_name = 'project_test'
QUOTA = { QUOTA = {
'project': project_name, 'project': project_name,
@ -51,6 +53,8 @@ QUOTA = {
'properties': property_num, 'properties': property_num,
'secgroup_rules': secgroup_rule_num, 'secgroup_rules': secgroup_rule_num,
'secgroups': secgroup_num, 'secgroups': secgroup_num,
'server-groups': servgroup_num,
'server-group-members': servgroup_members_num
} }
QUOTA_columns = tuple(sorted(QUOTA)) QUOTA_columns = tuple(sorted(QUOTA))

View File

@ -0,0 +1,6 @@
---
features:
- Added support of --server-groups --server-group-members options
to ``quota set`` command.
[Bug `1602223 <https://bugs.launchpad.net/python-openstackclient/+bug/1602223>`_]