Skip to content

Commit b72f2fb

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add support to specify volume quotas per volume type"
2 parents 8b44d34 + 8bd8a8d commit b72f2fb

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎doc/source/command-objects/quota.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Set quotas for project
3030
[--gigabytes <new-gigabytes>]
3131
[--snapshots <new-snapshots>]
3232
[--volumes <new-volumes>]
33+
[--volume-type <volume-type>]
3334
3435
<project>
3536
@@ -121,6 +122,10 @@ Set quotas for class
121122

122123
New value for the snapshots quota
123124

125+
.. option:: --volume-type <volume-type>
126+
127+
Set quotas for a specific <volume-type>
128+
124129
quota show
125130
----------
126131

‎openstackclient/common/quota.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ def get_parser(self, prog_name):
8282
type=int,
8383
help='New value for the %s quota' % v,
8484
)
85+
parser.add_argument(
86+
'--volume-type',
87+
metavar='<volume-type>',
88+
help='Set quotas for a specific <volume-type>',
89+
)
8590
return parser
8691

8792
def take_action(self, parsed_args):
@@ -97,8 +102,11 @@ def take_action(self, parsed_args):
97102

98103
volume_kwargs = {}
99104
for k, v in VOLUME_QUOTAS.items():
100-
if v in parsed_args:
101-
volume_kwargs[k] = getattr(parsed_args, v, None)
105+
value = getattr(parsed_args, v, None)
106+
if value is not None:
107+
if parsed_args.volume_type:
108+
k = k + '_%s' % parsed_args.volume_type
109+
volume_kwargs[k] = value
102110

103111
if compute_kwargs == {} and volume_kwargs == {}:
104112
sys.stderr.write("No quotas updated")

0 commit comments

Comments
 (0)