summaryrefslogtreecommitdiffstats
path: root/bin/nova-manage
diff options
context:
space:
mode:
authorvijaya-erukala <vijaya_erukala@persistent.co.in>2012-10-09 19:25:27 +0530
committervijaya-erukala <vijaya_erukala@persistent.co.in>2012-10-09 19:31:46 +0530
commit82d8ffec5b5220039e57685fe4359950d1209b14 (patch)
tree375b79977eea9f06fdae82a460a96d25d44d5328 /bin/nova-manage
parentfb101685cc14ed9b0396ce966e571d3fb457c32f (diff)
downloadnova-82d8ffec5b5220039e57685fe4359950d1209b14.tar.gz
nova-82d8ffec5b5220039e57685fe4359950d1209b14.tar.xz
nova-82d8ffec5b5220039e57685fe4359950d1209b14.zip
nova-manage doesn't validate key to update the quota
nova-manage doesn't validate the key value supplied to update the quota, as a result unnecessary records will be created in db and user will be under the impression that quota value got updated. This patch validates the input value given to the key. fixes bug 1064359 Change-Id: I9928f30881aa2780a23005b5f69aa67a44f314c5
Diffstat (limited to 'bin/nova-manage')
-rwxr-xr-xbin/nova-manage6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index d16853841..79a5cec26 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -221,13 +221,17 @@ class ProjectCommands(object):
def quota(self, project_id, key=None, value=None):
"""Set or display quotas for project"""
ctxt = context.get_admin_context()
- if key:
+ project_quota = QUOTAS.get_project_quotas(ctxt, project_id)
+ if key and key in project_quota:
if value.lower() == 'unlimited':
value = -1
try:
db.quota_update(ctxt, project_id, key, value)
except exception.ProjectQuotaNotFound:
db.quota_create(ctxt, project_id, key, value)
+ else:
+ print "error: Invalid key %s supplied for update" % key
+ sys.exit(2)
project_quota = QUOTAS.get_project_quotas(ctxt, project_id)
for key, value in project_quota.iteritems():
if value['limit'] < 0 or value['limit'] is None: