summaryrefslogtreecommitdiff
path: root/openstackclient/volume
diff options
context:
space:
mode:
authorHuanxuan Ao <huanxuan.ao@easystack.cn>2016-07-06 16:54:13 +0800
committerHuanxuan Ao <huanxuan.ao@easystack.cn>2016-07-06 20:46:31 +0800
commit3222ffc157b6e686249fb2e3d4375c89384bfb97 (patch)
tree60ebbd508ff6d2dd6457f6dc9e4ac68b3b7cee8e /openstackclient/volume
parent4ce7dd53e8bbd70a97a667c7b39078d73495ec1f (diff)
downloadpython-openstackclient-3222ffc157b6e686249fb2e3d4375c89384bfb97.tar.gz
Add "--property" option to "snapshot create" command in volumev2
Add "--property" option to "snapshot create" command in volumev2 (v2 only) to support adding properties to a new snapshot. Change-Id: Ie0e90c9ccc2ac89b3b7b0ac89751fd864aada9a4 Closes-Bug: #1597192
Diffstat (limited to 'openstackclient/volume')
-rw-r--r--openstackclient/volume/v2/snapshot.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/openstackclient/volume/v2/snapshot.py b/openstackclient/volume/v2/snapshot.py
index 5aba04ae..5e6949d4 100644
--- a/openstackclient/volume/v2/snapshot.py
+++ b/openstackclient/volume/v2/snapshot.py
@@ -51,6 +51,13 @@ class CreateSnapshot(command.ShowOne):
help=_("Create a snapshot attached to an instance. "
"Default is False")
)
+ parser.add_argument(
+ "--property",
+ metavar="<key=value>",
+ action=parseractions.KeyValueAction,
+ help=_("Set a property to this snapshot "
+ "(repeat option to set multiple properties)"),
+ )
return parser
def take_action(self, parsed_args):
@@ -61,7 +68,8 @@ class CreateSnapshot(command.ShowOne):
volume_id,
force=parsed_args.force,
name=parsed_args.name,
- description=parsed_args.description
+ description=parsed_args.description,
+ metadata=parsed_args.property,
)
snapshot._info.update(
{'properties': utils.format_dict(snapshot._info.pop('metadata'))}