Add server groups and server group members quota management in Horizon

Currently we can't set server groups and server group members quotas
in Horizon, they are still the back end definition of default.
In some cases, it will failed to create an instance when server group
members quota is insufficient. Therefore, it is necessary to specify
the quota of the server groups and server group members when creating
and editing the project. This patch allows the user to modify the
default values for the server groups and the server group members
quota.

Change-Id: Ifbd51bec3e775d8fecbf110da37309a443a3d1ba
Closes-Bug:#1732429
This commit is contained in:
wei.ying 2017-11-15 20:49:44 +08:00
parent 2c0de431c7
commit e0e81e2b87
6 changed files with 19 additions and 0 deletions

View File

@ -57,6 +57,8 @@ class ServicesViewTests(test.BaseAdminViewTests):
'<Quota: (instances, 10)>', '<Quota: (instances, 10)>',
'<Quota: (cores, 10)>', '<Quota: (cores, 10)>',
'<Quota: (key_pairs, 100)>', '<Quota: (key_pairs, 100)>',
'<Quota: (server_groups, 10)>',
'<Quota: (server_group_members, 10)>',
'<Quota: (injected_file_path_bytes, 255)>', '<Quota: (injected_file_path_bytes, 255)>',
] ]
self._check_quotas_data(res, 'compute_quotas', expected_data) self._check_quotas_data(res, 'compute_quotas', expected_data)

View File

@ -35,6 +35,9 @@ class UpdateDefaultComputeQuotasAction(workflows.Action):
metadata_items = forms.IntegerField(min_value=-1, metadata_items = forms.IntegerField(min_value=-1,
label=_("Metadata Items")) label=_("Metadata Items"))
key_pairs = forms.IntegerField(min_value=-1, label=_("Key Pairs")) key_pairs = forms.IntegerField(min_value=-1, label=_("Key Pairs"))
server_groups = forms.IntegerField(min_value=-1, label=_("Server Groups"))
server_group_members = forms.IntegerField(
min_value=-1, label=_("Server Group Members"))
injected_files = forms.IntegerField(min_value=-1, injected_files = forms.IntegerField(min_value=-1,
label=_("Injected Files")) label=_("Injected Files"))
injected_file_content_bytes = forms.IntegerField( injected_file_content_bytes = forms.IntegerField(

View File

@ -102,6 +102,9 @@ class ComputeQuotaAction(CommonQuotaAction):
metadata_items = forms.IntegerField(min_value=-1, metadata_items = forms.IntegerField(min_value=-1,
label=_("Metadata Items")) label=_("Metadata Items"))
key_pairs = forms.IntegerField(min_value=-1, label=_("Key Pairs")) key_pairs = forms.IntegerField(min_value=-1, label=_("Key Pairs"))
server_groups = forms.IntegerField(min_value=-1, label=_("Server Groups"))
server_group_members = forms.IntegerField(
min_value=-1, label=_("Server Group Members"))
injected_files = forms.IntegerField(min_value=-1, injected_files = forms.IntegerField(min_value=-1,
label=_("Injected Files")) label=_("Injected Files"))
injected_file_content_bytes = forms.IntegerField( injected_file_content_bytes = forms.IntegerField(

View File

@ -300,6 +300,8 @@ def data(TEST):
'injected_files': '1', 'injected_files': '1',
'cores': '10', 'cores': '10',
'key_pairs': 100, 'key_pairs': 100,
'server_groups': 10,
'server_group_members': 10,
'injected_file_path_bytes': 255, 'injected_file_path_bytes': 255,
} }
quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data) quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data)

View File

@ -39,6 +39,8 @@ NOVA_COMPUTE_QUOTA_FIELDS = {
"injected_file_path_bytes", "injected_file_path_bytes",
"ram", "ram",
"key_pairs", "key_pairs",
"server_groups",
"server_group_members",
} }
# We no longer supports nova-network, so network related quotas from nova # We no longer supports nova-network, so network related quotas from nova

View File

@ -0,0 +1,7 @@
---
features:
- |
Added server groups and server group members quota management.
Users can specify their values when creating or modifying project
information, and users can also change their quota default values
on the Admin-> System-> Defaults page.