Merge "Add support to specify volume quotas per volume type"
This commit is contained in:
commit
b72f2fb7ee
@ -30,6 +30,7 @@ Set quotas for project
|
|||||||
[--gigabytes <new-gigabytes>]
|
[--gigabytes <new-gigabytes>]
|
||||||
[--snapshots <new-snapshots>]
|
[--snapshots <new-snapshots>]
|
||||||
[--volumes <new-volumes>]
|
[--volumes <new-volumes>]
|
||||||
|
[--volume-type <volume-type>]
|
||||||
|
|
||||||
<project>
|
<project>
|
||||||
|
|
||||||
@ -121,6 +122,10 @@ Set quotas for class
|
|||||||
|
|
||||||
New value for the snapshots quota
|
New value for the snapshots quota
|
||||||
|
|
||||||
|
.. option:: --volume-type <volume-type>
|
||||||
|
|
||||||
|
Set quotas for a specific <volume-type>
|
||||||
|
|
||||||
quota show
|
quota show
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
@ -82,6 +82,11 @@ class SetQuota(command.Command):
|
|||||||
type=int,
|
type=int,
|
||||||
help='New value for the %s quota' % v,
|
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
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
@ -97,8 +102,11 @@ class SetQuota(command.Command):
|
|||||||
|
|
||||||
volume_kwargs = {}
|
volume_kwargs = {}
|
||||||
for k, v in VOLUME_QUOTAS.items():
|
for k, v in VOLUME_QUOTAS.items():
|
||||||
if v in parsed_args:
|
value = getattr(parsed_args, v, None)
|
||||||
volume_kwargs[k] = 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 == {}:
|
if compute_kwargs == {} and volume_kwargs == {}:
|
||||||
sys.stderr.write("No quotas updated")
|
sys.stderr.write("No quotas updated")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user