summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-02-27 19:00:45 +0000
committerGerrit Code Review <review@openstack.org>2013-02-27 19:00:45 +0000
commit986182b3272c6263f88e05ae46363dd44cea0801 (patch)
tree3e72cf3ca2eda2be85ce72a3a4e8479443ece6c9
parent56af9bd1457d71c99b30def2e8de6248016fc99b (diff)
parent7584fe39b4de9e1b7e7c7adad582322cd0316642 (diff)
downloadtuskar-ui-986182b3272c6263f88e05ae46363dd44cea0801.tar.gz
Merge "Allow admin to edit project quotas for security groups and rules"
-rw-r--r--openstack_dashboard/dashboards/admin/info/tests.py7
-rw-r--r--openstack_dashboard/dashboards/admin/projects/views.py4
-rw-r--r--openstack_dashboard/dashboards/admin/projects/workflows.py63
-rw-r--r--openstack_dashboard/test/test_data/nova_data.py4
-rw-r--r--openstack_dashboard/test/tests/quotas.py8
-rw-r--r--tools/pip-requires2
6 files changed, 59 insertions, 29 deletions
diff --git a/openstack_dashboard/dashboards/admin/info/tests.py b/openstack_dashboard/dashboards/admin/info/tests.py
index 6938d8b8..2b274246 100644
--- a/openstack_dashboard/dashboards/admin/info/tests.py
+++ b/openstack_dashboard/dashboards/admin/info/tests.py
@@ -60,6 +60,8 @@ class ServicessViewTests(test.BaseAdminViewTests):
'<Quota: (instances, 10)>',
'<Quota: (volumes, 1)>',
'<Quota: (cores, 10)>',
+ '<Quota: (security_groups, 10)>',
+ '<Quota: (security_group_rules, 20)>',
'<Quota: (injected_file_content_bytes, 1)>',
'<Quota: (metadata_items, 1)>',
'<Quota: (injected_files, 1)>',
@@ -68,4 +70,7 @@ class ServicessViewTests(test.BaseAdminViewTests):
'<Quota: (floating_ips, 1)>',
'<Quota: (instances, 10)>',
'<Quota: (volumes, 1)>',
- '<Quota: (cores, 10)>'])
+ '<Quota: (cores, 10)>',
+ '<Quota: (security_groups, 10)>',
+ '<Quota: (security_group_rules, 20)>'],
+ ordered=False)
diff --git a/openstack_dashboard/dashboards/admin/projects/views.py b/openstack_dashboard/dashboards/admin/projects/views.py
index 8bd3819e..e08f0756 100644
--- a/openstack_dashboard/dashboards/admin/projects/views.py
+++ b/openstack_dashboard/dashboards/admin/projects/views.py
@@ -46,7 +46,9 @@ QUOTA_FIELDS = ("metadata_items",
"volumes",
"gigabytes",
"ram",
- "floating_ips")
+ "floating_ips",
+ "security_groups",
+ "security_group_rules")
PROJECT_INFO_FIELDS = ("name",
"description",
diff --git a/openstack_dashboard/dashboards/admin/projects/workflows.py b/openstack_dashboard/dashboards/admin/projects/workflows.py
index 760dea59..ba6791cf 100644
--- a/openstack_dashboard/dashboards/admin/projects/workflows.py
+++ b/openstack_dashboard/dashboards/admin/projects/workflows.py
@@ -40,17 +40,21 @@ ADD_USER_URL = "horizon:admin:projects:create_user"
class UpdateProjectQuotaAction(workflows.Action):
ifcb_label = _("Injected File Content Bytes")
metadata_items = forms.IntegerField(min_value=-1,
- label=_("Metadata Items"))
+ label=_("Metadata Items"))
cores = forms.IntegerField(min_value=-1, label=_("VCPUs"))
instances = forms.IntegerField(min_value=-1, label=_("Instances"))
injected_files = forms.IntegerField(min_value=-1,
- label=_("Injected Files"))
+ label=_("Injected Files"))
injected_file_content_bytes = forms.IntegerField(min_value=-1,
label=ifcb_label)
volumes = forms.IntegerField(min_value=-1, label=_("Volumes"))
gigabytes = forms.IntegerField(min_value=-1, label=_("Gigabytes"))
ram = forms.IntegerField(min_value=-1, label=_("RAM (MB)"))
floating_ips = forms.IntegerField(min_value=-1, label=_("Floating IPs"))
+ security_groups = forms.IntegerField(min_value=-1,
+ label=_("Security Groups"))
+ security_group_rules = forms.IntegerField(min_value=-1,
+ label=_("Security Group Rules"))
class Meta:
name = _("Quota")
@@ -70,7 +74,9 @@ class UpdateProjectQuota(workflows.Step):
"volumes",
"gigabytes",
"ram",
- "floating_ips")
+ "floating_ips",
+ "security_groups",
+ "security_group_rules")
class CreateProjectInfoAction(workflows.Action):
@@ -247,17 +253,20 @@ class CreateProject(workflows.Workflow):
# update the project quota
ifcb = data['injected_file_content_bytes']
try:
- api.nova.tenant_quota_update(request,
- project_id,
- metadata_items=data['metadata_items'],
- injected_file_content_bytes=ifcb,
- volumes=data['volumes'],
- gigabytes=data['gigabytes'],
- ram=data['ram'],
- floating_ips=data['floating_ips'],
- instances=data['instances'],
- injected_files=data['injected_files'],
- cores=data['cores'])
+ api.nova.tenant_quota_update(
+ request,
+ project_id,
+ metadata_items=data['metadata_items'],
+ injected_file_content_bytes=ifcb,
+ volumes=data['volumes'],
+ gigabytes=data['gigabytes'],
+ ram=data['ram'],
+ floating_ips=data['floating_ips'],
+ instances=data['instances'],
+ injected_files=data['injected_files'],
+ cores=data['cores'],
+ security_groups=data['security_groups'],
+ security_group_rules=data['security_group_rules'])
except:
exceptions.handle(request, _('Unable to set project quotas.'))
return True
@@ -381,17 +390,21 @@ class UpdateProject(workflows.Workflow):
# TODO(gabriel): Once nova-volume is fully deprecated the
# "volumes" and "gigabytes" quotas should no longer be sent to
# the nova API to be updated anymore.
- nova.tenant_quota_update(request,
- project_id,
- metadata_items=data['metadata_items'],
- injected_file_content_bytes=ifcb,
- volumes=data['volumes'],
- gigabytes=data['gigabytes'],
- ram=data['ram'],
- floating_ips=data['floating_ips'],
- instances=data['instances'],
- injected_files=data['injected_files'],
- cores=data['cores'])
+ nova.tenant_quota_update(
+ request,
+ project_id,
+ metadata_items=data['metadata_items'],
+ injected_file_content_bytes=ifcb,
+ volumes=data['volumes'],
+ gigabytes=data['gigabytes'],
+ ram=data['ram'],
+ floating_ips=data['floating_ips'],
+ instances=data['instances'],
+ injected_files=data['injected_files'],
+ cores=data['cores'],
+ security_groups=data['security_groups'],
+ security_group_rules=data['security_group_rules'])
+
if is_service_enabled(request, 'volume'):
cinder.tenant_quota_update(request,
project_id,
diff --git a/openstack_dashboard/test/test_data/nova_data.py b/openstack_dashboard/test/test_data/nova_data.py
index f15c270d..9208bd8f 100644
--- a/openstack_dashboard/test/test_data/nova_data.py
+++ b/openstack_dashboard/test/test_data/nova_data.py
@@ -297,7 +297,9 @@ def data(TEST):
floating_ips='1',
instances='10',
injected_files='1',
- cores='10')
+ cores='10',
+ security_groups='10',
+ security_group_rules='20')
quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data)
TEST.quotas.nova = QuotaSetWrapper(quota)
TEST.quotas.add(QuotaSetWrapper(quota))
diff --git a/openstack_dashboard/test/tests/quotas.py b/openstack_dashboard/test/tests/quotas.py
index 9078db8f..7fabb7a1 100644
--- a/openstack_dashboard/test/tests/quotas.py
+++ b/openstack_dashboard/test/tests/quotas.py
@@ -60,6 +60,8 @@ class QuotaTests(test.APITestCase):
'injected_file_content_bytes': {'quota': 1},
'metadata_items': {'quota': 1},
'injected_files': {'quota': 1},
+ 'security_groups': {'quota': 10},
+ 'security_group_rules': {'quota': 20},
'gigabytes': {'available': 920, 'used': 80, 'quota': 1000},
'ram': {'available': 8976, 'used': 1024, 'quota': 10000},
'floating_ips': {'available': 0, 'used': 2, 'quota': 1},
@@ -95,6 +97,8 @@ class QuotaTests(test.APITestCase):
'injected_file_content_bytes': {'quota': 1},
'metadata_items': {'quota': 1},
'injected_files': {'quota': 1},
+ 'security_groups': {'quota': 10},
+ 'security_group_rules': {'quota': 20},
'ram': {'available': 8976, 'used': 1024, 'quota': 10000},
'floating_ips': {'available': 0, 'used': 2, 'quota': 1},
'instances': {'available': 8, 'used': 2, 'quota': 10},
@@ -127,6 +131,8 @@ class QuotaTests(test.APITestCase):
'injected_file_content_bytes': {'quota': 1},
'metadata_items': {'quota': 1},
'injected_files': {'quota': 1},
+ 'security_groups': {'quota': 10},
+ 'security_group_rules': {'quota': 20},
'ram': {'available': 10000, 'used': 0, 'quota': 10000},
'floating_ips': {'available': 1, 'used': 0, 'quota': 1},
'instances': {'available': 10, 'used': 0, 'quota': 10},
@@ -168,6 +174,8 @@ class QuotaTests(test.APITestCase):
'injected_file_content_bytes': {'quota': 1},
'metadata_items': {'quota': 1},
'injected_files': {'quota': 1},
+ 'security_groups': {'quota': 10},
+ 'security_group_rules': {'quota': 20},
'gigabytes': {'available': 920, 'used': 80, 'quota': 1000},
'ram': {'available': float("inf"), 'used': 1024,
'quota': float("inf")},
diff --git a/tools/pip-requires b/tools/pip-requires
index 9ae97492..c4b30f93 100644
--- a/tools/pip-requires
+++ b/tools/pip-requires
@@ -6,7 +6,7 @@ netaddr
python-cinderclient
python-glanceclient<2
python-keystoneclient
-python-novaclient>=2.10.0,<3
+python-novaclient>=2.11.1,<3
python-quantumclient>=2.0
python-swiftclient>1.1,<2
pytz