diff options
| author | lin-hua-cheng <os.lcheng@gmail.com> | 2015-02-06 09:51:47 -0800 |
|---|---|---|
| committer | lin-hua-cheng <os.lcheng@gmail.com> | 2015-02-06 16:45:08 -0800 |
| commit | 60ef8b08fe183b5e4686a999da8a988ec7cca5a7 (patch) | |
| tree | b4b61490bdb37a8d0e8661a23f66959a80d28c5c /openstackclient/volume | |
| parent | 863b50cb6d35f4fdff425941e0f79646968adbf0 (diff) | |
| download | python-openstackclient-60ef8b08fe183b5e4686a999da8a988ec7cca5a7.tar.gz | |
Change volume create --snapshot-id to --snapshot
Keeping the option --snapshot-id hidden for backward compatibility.
Change-Id: Iefa0aed9be255a5626a9bbb7db77911ef5ca8595
Closes-Bug: #1418742
Diffstat (limited to 'openstackclient/volume')
| -rw-r--r-- | openstackclient/volume/v1/volume.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/openstackclient/volume/v1/volume.py b/openstackclient/volume/v1/volume.py index 3d26a5e9..ad9671e3 100644 --- a/openstackclient/volume/v1/volume.py +++ b/openstackclient/volume/v1/volume.py @@ -15,6 +15,7 @@ """Volume v1 Volume action implementations""" +import argparse import logging import six @@ -45,10 +46,16 @@ class CreateVolume(show.ShowOne): type=int, help='New volume size in GB', ) - parser.add_argument( + snapshot_group = parser.add_mutually_exclusive_group() + snapshot_group.add_argument( + '--snapshot', + metavar='<snapshot>', + help='Use <snapshot> as source of new volume', + ) + snapshot_group.add_argument( '--snapshot-id', metavar='<snapshot-id>', - help='Use <snapshot-id> as source of new volume', + help=argparse.SUPPRESS, ) parser.add_argument( '--description', @@ -130,9 +137,11 @@ class CreateVolume(show.ShowOne): parsed_args.image, ).id + snapshot = parsed_args.snapshot or parsed_args.snapshot_id + volume = volume_client.volumes.create( parsed_args.size, - parsed_args.snapshot_id, + snapshot, source_volume, parsed_args.name, parsed_args.description, |
