summaryrefslogtreecommitdiff
path: root/openstackclient/common
diff options
context:
space:
mode:
authorSteve Martinelli <stevemar@ca.ibm.com>2015-04-03 03:12:27 -0400
committerSteve Martinelli <stevemar@ca.ibm.com>2015-04-15 01:42:00 -0400
commit8bd8a8dfd7d330573740f7610ea28ae291d1e4e2 (patch)
tree911efe8fd5d7026928394e848bc410abd08c3e4d /openstackclient/common
parentd5f2c50c0f2de6d741f86113fc5260bdb7895102 (diff)
downloadpython-openstackclient-8bd8a8dfd7d330573740f7610ea28ae291d1e4e2.tar.gz
Add support to specify volume quotas per volume type
Add a --volume-type option to quota set, this will allow users to set quotas for volume attributes on a per volume-type basis. for example: openstack quota set admin --volume-type myvol --volumes 12 Change-Id: I3ce9cf82a65d4f012b339f0e0dedb752cb132c33 Closes-Bug: 1438377
Diffstat (limited to 'openstackclient/common')
-rw-r--r--openstackclient/common/quota.py12
1 files changed, 10 insertions, 2 deletions
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")