diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-11-18 22:58:06 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-11-18 22:58:06 +0000 |
| commit | e2a64f361dd02b9e171b77b08a1dc7c54c290963 (patch) | |
| tree | a7d855448c4813eba0e097951e0d26211eb53e4d /cinderclient/v2/shell.py | |
| parent | 2be44d51e946b778c35e3f35fe4543937ee6c03e (diff) | |
| parent | 8690e41c222a49fa1d989eaca3f36e49913eabb1 (diff) | |
| download | python-cinderclient-e2a64f361dd02b9e171b77b08a1dc7c54c290963.tar.gz | |
Merge "Adding backup-reset-state to CLI"
Diffstat (limited to 'cinderclient/v2/shell.py')
| -rw-r--r-- | cinderclient/v2/shell.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index 6450bf2..26aedd9 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -1449,6 +1449,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', |
