From e0e81e2b87403798c1731a00ff34d1ed4c645ce1 Mon Sep 17 00:00:00 2001 From: "wei.ying" Date: Wed, 15 Nov 2017 20:49:44 +0800 Subject: [PATCH] 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 --- openstack_dashboard/dashboards/admin/defaults/tests.py | 2 ++ openstack_dashboard/dashboards/admin/defaults/workflows.py | 3 +++ .../dashboards/identity/projects/workflows.py | 3 +++ openstack_dashboard/test/test_data/nova_data.py | 2 ++ openstack_dashboard/usage/quotas.py | 2 ++ ...dd-server-groups-quota-management-0c1dc5763a3b893c.yaml | 7 +++++++ 6 files changed, 19 insertions(+) create mode 100644 releasenotes/notes/add-server-groups-quota-management-0c1dc5763a3b893c.yaml diff --git a/openstack_dashboard/dashboards/admin/defaults/tests.py b/openstack_dashboard/dashboards/admin/defaults/tests.py index f330a284a7..83ebbc3b31 100644 --- a/openstack_dashboard/dashboards/admin/defaults/tests.py +++ b/openstack_dashboard/dashboards/admin/defaults/tests.py @@ -57,6 +57,8 @@ class ServicesViewTests(test.BaseAdminViewTests): '', '', '', + '', + '', '', ] self._check_quotas_data(res, 'compute_quotas', expected_data) diff --git a/openstack_dashboard/dashboards/admin/defaults/workflows.py b/openstack_dashboard/dashboards/admin/defaults/workflows.py index c30dd67440..3ea8970d8c 100644 --- a/openstack_dashboard/dashboards/admin/defaults/workflows.py +++ b/openstack_dashboard/dashboards/admin/defaults/workflows.py @@ -35,6 +35,9 @@ class UpdateDefaultComputeQuotasAction(workflows.Action): metadata_items = forms.IntegerField(min_value=-1, label=_("Metadata Items")) 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, label=_("Injected Files")) injected_file_content_bytes = forms.IntegerField( diff --git a/openstack_dashboard/dashboards/identity/projects/workflows.py b/openstack_dashboard/dashboards/identity/projects/workflows.py index 83e16641da..d3766e439b 100644 --- a/openstack_dashboard/dashboards/identity/projects/workflows.py +++ b/openstack_dashboard/dashboards/identity/projects/workflows.py @@ -102,6 +102,9 @@ class ComputeQuotaAction(CommonQuotaAction): metadata_items = forms.IntegerField(min_value=-1, label=_("Metadata Items")) 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, label=_("Injected Files")) injected_file_content_bytes = forms.IntegerField( diff --git a/openstack_dashboard/test/test_data/nova_data.py b/openstack_dashboard/test/test_data/nova_data.py index dbd0e78cbe..24096a766e 100644 --- a/openstack_dashboard/test/test_data/nova_data.py +++ b/openstack_dashboard/test/test_data/nova_data.py @@ -300,6 +300,8 @@ def data(TEST): 'injected_files': '1', 'cores': '10', 'key_pairs': 100, + 'server_groups': 10, + 'server_group_members': 10, 'injected_file_path_bytes': 255, } quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data) diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py index 39aab80a71..5777d1324f 100644 --- a/openstack_dashboard/usage/quotas.py +++ b/openstack_dashboard/usage/quotas.py @@ -39,6 +39,8 @@ NOVA_COMPUTE_QUOTA_FIELDS = { "injected_file_path_bytes", "ram", "key_pairs", + "server_groups", + "server_group_members", } # We no longer supports nova-network, so network related quotas from nova diff --git a/releasenotes/notes/add-server-groups-quota-management-0c1dc5763a3b893c.yaml b/releasenotes/notes/add-server-groups-quota-management-0c1dc5763a3b893c.yaml new file mode 100644 index 0000000000..d8bb552992 --- /dev/null +++ b/releasenotes/notes/add-server-groups-quota-management-0c1dc5763a3b893c.yaml @@ -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.