Merge "Add the ability to extend volumes in osc volume set
"
This commit is contained in:
commit
c3aad41341
@ -134,6 +134,7 @@ Set volume properties
|
||||
os volume set
|
||||
[--name <name>]
|
||||
[--description <description>]
|
||||
[--size <size>]
|
||||
[--property <key=value> [...] ]
|
||||
<volume>
|
||||
|
||||
@ -145,6 +146,10 @@ Set volume properties
|
||||
|
||||
New volume description
|
||||
|
||||
.. option:: --size <size>
|
||||
|
||||
Extend volume size in GB
|
||||
|
||||
.. option:: --property <key=value>
|
||||
|
||||
Property to add or modify for this volume (repeat option to set multiple properties)
|
||||
|
@ -327,6 +327,12 @@ class SetVolume(command.Command):
|
||||
metavar='<description>',
|
||||
help='New volume description',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--size',
|
||||
metavar='<size>',
|
||||
type=int,
|
||||
help='Extend volume size in GB',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--property',
|
||||
metavar='<key=value>',
|
||||
@ -341,6 +347,13 @@ class SetVolume(command.Command):
|
||||
volume_client = self.app.client_manager.volume
|
||||
volume = utils.find_resource(volume_client.volumes, parsed_args.volume)
|
||||
|
||||
if parsed_args.size:
|
||||
if parsed_args.size <= volume.size:
|
||||
self.app.log.error("New size must be greater than %s GB" %
|
||||
volume.size)
|
||||
return
|
||||
volume_client.volumes.extend(volume.id, parsed_args.size)
|
||||
|
||||
if parsed_args.property:
|
||||
volume_client.volumes.set_metadata(volume.id, parsed_args.property)
|
||||
|
||||
@ -352,7 +365,7 @@ class SetVolume(command.Command):
|
||||
if kwargs:
|
||||
volume_client.volumes.update(volume.id, **kwargs)
|
||||
|
||||
if not kwargs and not parsed_args.property:
|
||||
if not kwargs and not parsed_args.property and not parsed_args.size:
|
||||
self.app.log.error("No changes requested\n")
|
||||
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user