summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-04-16 04:37:39 +0000
committerGerrit Code Review <review@openstack.org>2015-04-16 04:37:39 +0000
commitb72f2fb7eead6287fbdd07c369c0462586f37785 (patch)
treeefa6afe5a84d2b3dada3b1e3bdcf9c198ffa0feb
parent8b44d3405466eb53b7370a96295e168de5d93be7 (diff)
parent8bd8a8dfd7d330573740f7610ea28ae291d1e4e2 (diff)
downloadpython-openstackclient-b72f2fb7eead6287fbdd07c369c0462586f37785.tar.gz
Merge "Add support to specify volume quotas per volume type"
-rw-r--r--doc/source/command-objects/quota.rst5
-rw-r--r--openstackclient/common/quota.py12
2 files changed, 15 insertions, 2 deletions
diff --git a/doc/source/command-objects/quota.rst b/doc/source/command-objects/quota.rst
index 053fb47a..5ea49f8c 100644
--- a/doc/source/command-objects/quota.rst
+++ b/doc/source/command-objects/quota.rst
@@ -30,6 +30,7 @@ Set quotas for project
[--gigabytes <new-gigabytes>]
[--snapshots <new-snapshots>]
[--volumes <new-volumes>]
+ [--volume-type <volume-type>]
<project>
@@ -121,6 +122,10 @@ Set quotas for class
New value for the snapshots quota
+.. option:: --volume-type <volume-type>
+
+ Set quotas for a specific <volume-type>
+
quota show
----------
diff --git a/openstackclient/common/quota.py b/openstackclient/common/quota.py
index dde4a9ac..ea1dc38f 100644
--- a/openstackclient/common/quota.py
+++ b/openstackclient/common/quota.py
@@ -82,6 +82,11 @@ class SetQuota(command.Command):
type=int,
help='New value for the %s quota' % v,
)
+ parser.add_argument(
+ '--volume-type',
+ metavar='<volume-type>',
+ help='Set quotas for a specific <volume-type>',
+ )
return parser
def take_action(self, parsed_args):
@@ -97,8 +102,11 @@ class SetQuota(command.Command):
volume_kwargs = {}
for k, v in VOLUME_QUOTAS.items():
- if v in parsed_args:
- volume_kwargs[k] = getattr(parsed_args, v, None)
+ value = getattr(parsed_args, v, None)
+ if value is not None:
+ if parsed_args.volume_type:
+ k = k + '_%s' % parsed_args.volume_type
+ volume_kwargs[k] = value
if compute_kwargs == {} and volume_kwargs == {}:
sys.stderr.write("No quotas updated")