Change volume create --snapshot-id to --snapshot
Keeping the option --snapshot-id hidden for backward compatibility. Change-Id: Iefa0aed9be255a5626a9bbb7db77911ef5ca8595 Closes-Bug: #1418742
This commit is contained in:
		@@ -14,7 +14,7 @@ Create new volume
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    os volume create
 | 
					    os volume create
 | 
				
			||||||
        --size <size>
 | 
					        --size <size>
 | 
				
			||||||
        [--snapshot-id <snapshot-id>]
 | 
					        [--snapshot <snapshot>]
 | 
				
			||||||
        [--description <description>]
 | 
					        [--description <description>]
 | 
				
			||||||
        [--type <volume-type>]
 | 
					        [--type <volume-type>]
 | 
				
			||||||
        [--user <user>]
 | 
					        [--user <user>]
 | 
				
			||||||
@@ -29,9 +29,9 @@ Create new volume
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    New volume size in GB
 | 
					    New volume size in GB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. option:: --snapshot-id <snapshot-id>
 | 
					.. option:: --snapshot <snapshot>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Use <snapshot-id> as source of new volume
 | 
					    Use <snapshot> as source of new volume
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.. option:: --description <description>
 | 
					.. option:: --description <description>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,6 +15,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
"""Volume v1 Volume action implementations"""
 | 
					"""Volume v1 Volume action implementations"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import argparse
 | 
				
			||||||
import logging
 | 
					import logging
 | 
				
			||||||
import six
 | 
					import six
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -45,10 +46,16 @@ class CreateVolume(show.ShowOne):
 | 
				
			|||||||
            type=int,
 | 
					            type=int,
 | 
				
			||||||
            help='New volume size in GB',
 | 
					            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',
 | 
					            '--snapshot-id',
 | 
				
			||||||
            metavar='<snapshot-id>',
 | 
					            metavar='<snapshot-id>',
 | 
				
			||||||
            help='Use <snapshot-id> as source of new volume',
 | 
					            help=argparse.SUPPRESS,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        parser.add_argument(
 | 
					        parser.add_argument(
 | 
				
			||||||
            '--description',
 | 
					            '--description',
 | 
				
			||||||
@@ -130,9 +137,11 @@ class CreateVolume(show.ShowOne):
 | 
				
			|||||||
                parsed_args.image,
 | 
					                parsed_args.image,
 | 
				
			||||||
            ).id
 | 
					            ).id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        snapshot = parsed_args.snapshot or parsed_args.snapshot_id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        volume = volume_client.volumes.create(
 | 
					        volume = volume_client.volumes.create(
 | 
				
			||||||
            parsed_args.size,
 | 
					            parsed_args.size,
 | 
				
			||||||
            parsed_args.snapshot_id,
 | 
					            snapshot,
 | 
				
			||||||
            source_volume,
 | 
					            source_volume,
 | 
				
			||||||
            parsed_args.name,
 | 
					            parsed_args.name,
 | 
				
			||||||
            parsed_args.description,
 | 
					            parsed_args.description,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user