summaryrefslogtreecommitdiff
path: root/cinderclient/v2/shell.py
diff options
context:
space:
mode:
authorNate Potter <nathaniel.potter@intel.com>2015-10-19 20:17:35 +0000
committerNate Potter <nathaniel.potter@intel.com>2015-10-20 19:17:55 +0000
commit8690e41c222a49fa1d989eaca3f36e49913eabb1 (patch)
tree5709338fa3c8937b6956020068ea8636cf7edf2b /cinderclient/v2/shell.py
parentcfecd8ebe0c3baf259142615e94d698fc0b4169f (diff)
downloadpython-cinderclient-8690e41c222a49fa1d989eaca3f36e49913eabb1.tar.gz
Adding backup-reset-state to CLI
This patch adds the ability to reset the state of a backup with the command backup-reset-state. DocImpact Change-Id: I5851bb21c62252f61ad6a09f01859582e774a9db Closes-Bug: #1279764
Diffstat (limited to 'cinderclient/v2/shell.py')
-rw-r--r--cinderclient/v2/shell.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py
index b4447d9..584902f 100644
--- a/cinderclient/v2/shell.py
+++ b/cinderclient/v2/shell.py
@@ -1429,6 +1429,36 @@ def do_backup_import(cs, args):
utils.print_dict(info)
+@utils.arg('backup', metavar='<backup>', nargs='+',
+ help='Name or ID of the backup to modify.')
+@utils.arg('--state', metavar='<state>',
+ default='available',
+ help='The state to assign to the backup. Valid values are '
+ '"available", "error", "creating", "deleting", and '
+ '"error_deleting". Default=available.')
+@utils.service_type('volumev2')
+def do_backup_reset_state(cs, args):
+ """Explicitly updates the backup state."""
+ failure_count = 0
+
+ single = (len(args.backup) == 1)
+
+ for backup in args.backup:
+ try:
+ _find_backup(cs, backup).reset_state(args.state)
+ except Exception as e:
+ failure_count += 1
+ msg = "Reset state for backup %s failed: %s" % (backup, e)
+ if not single:
+ print(msg)
+
+ if failure_count == len(args.backup):
+ if not single:
+ msg = ("Unable to reset the state for any of the specified "
+ "backups.")
+ raise exceptions.CommandError(msg)
+
+
@utils.arg('volume', metavar='<volume>',
help='Name or ID of volume to transfer.')
@utils.arg('--name',