diff options
author | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-05-17 15:36:00 -0400 |
---|---|---|
committer | Mark Washenberger <mark.washenberger@rackspace.com> | 2011-05-17 15:36:00 -0400 |
commit | 1bc00ba6e7d13ab3533297ecda6c10965776dd8a (patch) | |
tree | e7e6a0cca172b1342457c55ebddfde049b303096 /nova/quota.py | |
parent | 34b1461fa567f5ffba89b893b8082df050a64a5e (diff) | |
download | nova-1bc00ba6e7d13ab3533297ecda6c10965776dd8a.tar.gz nova-1bc00ba6e7d13ab3533297ecda6c10965776dd8a.tar.xz nova-1bc00ba6e7d13ab3533297ecda6c10965776dd8a.zip |
support unlimited quotas in nova-manage and flags
Diffstat (limited to 'nova/quota.py')
-rw-r--r-- | nova/quota.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nova/quota.py b/nova/quota.py index b37fa5ba4..53eb34043 100644 --- a/nova/quota.py +++ b/nova/quota.py @@ -46,8 +46,8 @@ flags.DEFINE_integer('quota_max_injected_file_path_bytes', 255, 'number of bytes allowed per injected file path') -def get_quota(context, project_id): - rval = { +def _get_default_quota(): + defaults = { 'instances': FLAGS.quota_instances, 'cores': FLAGS.quota_cores, 'ram': FLAGS.quota_ram, @@ -56,7 +56,15 @@ def get_quota(context, project_id): 'floating_ips': FLAGS.quota_floating_ips, 'metadata_items': FLAGS.quota_metadata_items, } + # -1 in the quota flags means unlimited + for key in defaults.keys(): + if defaults[key] == -1: + defaults[key] = None + return defaults + +def get_quota(context, project_id): + rval = _get_default_quota() quota = db.quota_get_all_by_project(context, project_id) for key in rval.keys(): if key in quota: |