From 0f1cbc9e1f72c5ecd4c21b533bb03a8a9640f4c9 Mon Sep 17 00:00:00 2001 From: Tomoki Sekiyama Date: Fri, 13 Mar 2015 14:40:33 -0400 Subject: Implement reset-state for attach_status and migration_status Currently the reset-state command in the client only handles the main volume status column. This adds options to set attach_status and to reset migration_status. DocImpact: Add new options to cinder reset-state command Change-Id: Ifaa04c2f8a7ff21100f7c9c51df881313e8babea Closes-Bug: #1309086 --- cinderclient/v2/shell.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'cinderclient/v2/shell.py') diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index a85d77f..6c6d7de 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -455,6 +455,16 @@ def do_force_delete(cs, args): 'NOTE: This command simply changes the state of the ' 'Volume in the DataBase with no regard to actual status, ' 'exercise caution when using. Default=available.')) +@utils.arg('--attach-status', metavar='', default=None, + help=('The attach status to assign to the volume in the DataBase, ' + 'with no regard to the actual status. Valid values are ' + '"attached" and "detached". Default=None, that means the ' + 'status is unchanged.')) +@utils.arg('--reset-migration-status', + action='store_true', + help=('Clears the migration status of the volume in the DataBase ' + 'that indicates the volume is source or destination of ' + 'volume migration, with no regard to the actual status.')) @utils.service_type('volumev2') def do_reset_state(cs, args): """Explicitly updates the volume state in the Cinder database. @@ -466,10 +476,13 @@ def do_reset_state(cs, args): unusable in the case of change to the 'available' state. """ failure_flag = False + migration_status = 'none' if args.reset_migration_status else None for volume in args.volume: try: - utils.find_volume(cs, volume).reset_state(args.state) + utils.find_volume(cs, volume).reset_state(args.state, + args.attach_status, + migration_status) except Exception as e: failure_flag = True msg = "Reset state for volume %s failed: %s" % (volume, e) -- cgit v1.2.1