summaryrefslogtreecommitdiff
path: root/cinderclient/v2/shell.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-09-09 21:48:58 +0000
committerGerrit Code Review <review@openstack.org>2015-09-09 21:48:59 +0000
commitc167dda40cc65fe437a12b815ef91bbde4efb6bb (patch)
tree635638528ab9740280bd79a416b2c60b2bf52705 /cinderclient/v2/shell.py
parent68a470721654dc1ccd114b76570a90ca1395533a (diff)
parent0f1cbc9e1f72c5ecd4c21b533bb03a8a9640f4c9 (diff)
downloadpython-cinderclient-1.4.0.tar.gz
Merge "Implement reset-state for attach_status and migration_status"1.4.0
Diffstat (limited to 'cinderclient/v2/shell.py')
-rw-r--r--cinderclient/v2/shell.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py
index c2ac8bf..ee5de76 100644
--- a/cinderclient/v2/shell.py
+++ b/cinderclient/v2/shell.py
@@ -464,6 +464,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='<attach-status>', 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.
@@ -475,10 +485,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)