Created
September 7, 2017 22:24
-
-
Save anonymous/d8eaff052d315b2925ea7bc56b0413d6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jgriffith@os-1:/opt/stack/python-cinderclient$ git diff | |
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py | |
index 97740e4..bcf9778 100644 | |
--- a/cinderclient/v3/shell.py | |
+++ b/cinderclient/v3/shell.py | |
@@ -1712,9 +1712,15 @@ def do_snapshot_list(cs, args): | |
sort=args.sort) | |
shell_utils.translate_volume_snapshot_keys(snapshots) | |
sortby_index = None if args.sort else 0 | |
- utils.print_list(snapshots, | |
- ['ID', 'Volume ID', 'Status', 'Name', 'Size'], | |
- sortby_index=sortby_index) | |
+ if cs.api_version >= api_versions.APIVersion("3.41"): | |
+ utils.print_list(snapshots, | |
+ ['ID', 'Volume ID', 'Status', | |
+ 'Name', 'Size', 'User ID'], | |
+ sortby_index=sortby_index) | |
+ else: | |
+ utils.print_list(snapshots, | |
+ ['ID', 'Volume ID', 'Status', 'Name', 'Size'], | |
+ sortby_index=sortby_index) | |
@api_versions.wraps('3.27') | |
@@ -2005,3 +2011,68 @@ def do_service_get_log(cs, args): | |
args.prefix) | |
columns = ('Binary', 'Host', 'Prefix', 'Level') | |
utils.print_list(log_levels, columns) | |
+ | |
+ | |
+@api_versions.wraps('3.43') | |
+@utils.arg('volume', metavar='<volume>', | |
+ help='Name or ID of volume to backup.') | |
+@utils.arg('--container', metavar='<container>', | |
+ default=None, | |
+ help='Backup container name. Default=None.') | |
+@utils.arg('--display-name', | |
+ help=argparse.SUPPRESS) | |
+@utils.arg('--name', metavar='<name>', | |
+ default=None, | |
+ help='Backup name. Default=None.') | |
+@utils.arg('--display-description', | |
+ help=argparse.SUPPRESS) | |
+@utils.arg('--description', | |
+ metavar='<description>', | |
+ default=None, | |
+ help='Backup description. Default=None.') | |
+@utils.arg('--incremental', | |
+ action='store_true', | |
+ help='Incremental backup. Default=False.', | |
+ default=False) | |
+@utils.arg('--force', | |
+ action='store_true', | |
+ help='Allows or disallows backup of a volume ' | |
+ 'when the volume is attached to an instance. ' | |
+ 'If set to True, backs up the volume whether ' | |
+ 'its status is "available" or "in-use". The backup ' | |
+ 'of an "in-use" volume means your data is crash ' | |
+ 'consistent. Default=False.', | |
+ default=False) | |
+@utils.arg('--snapshot-id', | |
+ metavar='<snapshot-id>', | |
+ help='ID of snapshot to backup. Default=None.') | |
+@utils.arg('--metadata', | |
+ nargs='*', | |
+ metavar='<key=value>', | |
+ default=None, | |
+ help='Metadata key and value pairs. Default=None.') | |
+def do_backup_create(cs, args): | |
+ """Creates a volume backup.""" | |
+ | |
+ if args.display_name is not None: | |
+ args.name = args.display_name | |
+ | |
+ if args.display_description is not None: | |
+ args.description = args.display_description | |
+ | |
+ 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) | |
+ | |
+ info = {"volume_id": volume.id} | |
+ info.update(backup._info) | |
+ | |
+ if 'links' in info: | |
+ info.pop('links') | |
+ | |
+ utils.print_dict(info) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment