summaryrefslogtreecommitdiff
path: root/openstackclient/volume
diff options
context:
space:
mode:
authorroot <ranasheel2000@gmail.com>2016-03-09 20:59:40 +0530
committerSteve Martinelli <stevemar@ca.ibm.com>2016-03-16 14:17:34 +0000
commit4d5c5d9dcb6421e56823aad932bff5d87b728bb2 (patch)
treeacd9941d7abf4fd67f3ac0e326a031cc9a08afef /openstackclient/volume
parentd88284c86d5a750a82b207da321f9df249e90ac0 (diff)
downloadpython-openstackclient-4d5c5d9dcb6421e56823aad932bff5d87b728bb2.tar.gz
Add support for setting Image-property
OSC does not support to set volume's image property. This patch will provide support for adding image property to existing volume. Closes-Bug:#1554877 Implements: bp cinder-command-support Change-Id: I4ff5532c228f010789b81c7587dd4a2838a90f20
Diffstat (limited to 'openstackclient/volume')
-rw-r--r--openstackclient/volume/v2/volume.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/openstackclient/volume/v2/volume.py b/openstackclient/volume/v2/volume.py
index 8f2122eb..9b58d73d 100644
--- a/openstackclient/volume/v2/volume.py
+++ b/openstackclient/volume/v2/volume.py
@@ -345,6 +345,13 @@ class SetVolume(command.Command):
help='Property to add or modify for this volume '
'(repeat option to set multiple properties)',
)
+ parser.add_argument(
+ '--image-property',
+ metavar='<key=value>',
+ action=parseractions.KeyValueAction,
+ help='To add or modify image properties for this volume '
+ '(repeat option to set multiple image properties)',
+ )
return parser
def take_action(self, parsed_args):
@@ -365,6 +372,9 @@ class SetVolume(command.Command):
if parsed_args.property:
volume_client.volumes.set_metadata(volume.id, parsed_args.property)
+ if parsed_args.image_property:
+ volume_client.volumes.set_image_metadata(
+ volume.id, parsed_args.image_property)
kwargs = {}
if parsed_args.name:
@@ -374,7 +384,8 @@ class SetVolume(command.Command):
if kwargs:
volume_client.volumes.update(volume.id, **kwargs)
- if not kwargs and not parsed_args.property and not parsed_args.size:
+ if (not kwargs and not parsed_args.property
+ and not parsed_args.image_property and not parsed_args.size):
self.app.log.error("No changes requested\n")