diff options
author | Trey Morris <trey.morris@rackspace.com> | 2011-03-17 15:57:04 -0500 |
---|---|---|
committer | Trey Morris <trey.morris@rackspace.com> | 2011-03-17 15:57:04 -0500 |
commit | 400ca259f49a741cf2cefd86afcf2494ee0bd446 (patch) | |
tree | 881a11a7ba5a306f0d728c085a8021cb7e527bd5 /nova/quota.py | |
parent | 038d99d9fa4354bd617adfa332d69a87a9f7918e (diff) | |
parent | 88ae79505a84736ebdf57ba67c60ff16de5c9e87 (diff) | |
download | nova-400ca259f49a741cf2cefd86afcf2494ee0bd446.tar.gz nova-400ca259f49a741cf2cefd86afcf2494ee0bd446.tar.xz nova-400ca259f49a741cf2cefd86afcf2494ee0bd446.zip |
merged trunk, merged qos, slight refactor regarding merges
Diffstat (limited to 'nova/quota.py')
-rw-r--r-- | nova/quota.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nova/quota.py b/nova/quota.py index 6b52a97fa..2b24c0b5b 100644 --- a/nova/quota.py +++ b/nova/quota.py @@ -37,6 +37,12 @@ flags.DEFINE_integer('quota_floating_ips', 10, 'number of floating ips allowed per project') flags.DEFINE_integer('quota_metadata_items', 128, 'number of metadata items allowed per instance') +flags.DEFINE_integer('quota_max_injected_files', 5, + 'number of injected files allowed') +flags.DEFINE_integer('quota_max_injected_file_content_bytes', 10 * 1024, + 'number of bytes allowed per injected file') +flags.DEFINE_integer('quota_max_injected_file_path_bytes', 255, + 'number of bytes allowed per injected file path') def get_quota(context, project_id): @@ -46,6 +52,7 @@ def get_quota(context, project_id): 'gigabytes': FLAGS.quota_gigabytes, 'floating_ips': FLAGS.quota_floating_ips, 'metadata_items': FLAGS.quota_metadata_items} + try: quota = db.quota_get(context, project_id) for key in rval.keys(): @@ -106,6 +113,21 @@ def allowed_metadata_items(context, num_metadata_items): return min(num_metadata_items, num_allowed_metadata_items) +def allowed_injected_files(context): + """Return the number of injected files allowed""" + return FLAGS.quota_max_injected_files + + +def allowed_injected_file_content_bytes(context): + """Return the number of bytes allowed per injected file content""" + return FLAGS.quota_max_injected_file_content_bytes + + +def allowed_injected_file_path_bytes(context): + """Return the number of bytes allowed in an injected file path""" + return FLAGS.quota_max_injected_file_path_bytes + + class QuotaError(exception.ApiError): """Quota Exceeeded""" pass |