diff options
| author | Zuul <zuul@review.openstack.org> | 2018-03-27 08:10:24 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2018-03-27 08:10:24 +0000 |
| commit | cd87e5d4b41d96f2db2df51d923ec2b5821692fd (patch) | |
| tree | 50125baa7a3264c9dbfd74a7ac9ee9026c7e0de6 /cinderclient/v3/shell.py | |
| parent | b2dbf457c2f4db555ef58b7f03c035b230454a37 (diff) | |
| parent | 2c774cc015cb6624fe37823b586864c63525c379 (diff) | |
| download | python-cinderclient-cd87e5d4b41d96f2db2df51d923ec2b5821692fd.tar.gz | |
Merge "Support cross AZ backups"
Diffstat (limited to 'cinderclient/v3/shell.py')
| -rw-r--r-- | cinderclient/v3/shell.py | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py index cd385b4..f012cc8 100644 --- a/cinderclient/v3/shell.py +++ b/cinderclient/v3/shell.py @@ -2332,6 +2332,11 @@ def do_service_get_log(cs, args): default=None, start_version='3.43', help='Metadata key and value pairs. Default=None.') +@utils.arg('--availability-zone', + default=None, + start_version='3.51', + help='AZ where the backup should be stored, by default it will be ' + 'the same as the source.') def do_backup_create(cs, args): """Creates a volume backup.""" if args.display_name is not None: @@ -2340,25 +2345,22 @@ def do_backup_create(cs, args): if args.display_description is not None: args.description = args.display_description - volume = utils.find_volume(cs, args.volume) - if hasattr(args, 'metadata') and args.metadata: - backup = cs.backups.create(volume.id, - args.container, - args.name, - args.description, - args.incremental, - args.force, - args.snapshot_id, - shell_utils.extract_metadata(args)) - else: - backup = cs.backups.create(volume.id, - args.container, - args.name, - args.description, - args.incremental, - args.force, - args.snapshot_id) + kwargs = {} + if getattr(args, 'metadata', None): + kwargs['metadata'] = shell_utils.extract_metadata(args) + az = getattr(args, 'availability_zone', None) + if az: + kwargs['availability_zone'] = az + volume = utils.find_volume(cs, args.volume) + backup = cs.backups.create(volume.id, + args.container, + args.name, + args.description, + args.incremental, + args.force, + args.snapshot_id, + **kwargs) info = {"volume_id": volume.id} info.update(backup._info) |
