summaryrefslogtreecommitdiff
path: root/cinderclient/v3/shell.py
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2022-02-24 20:54:44 +0000
committerGerrit Code Review <review@openstack.org>2022-02-24 20:54:44 +0000
commitd1853510c005125d112da87374df7a9a6f1a1ebf (patch)
treea7e52952667e5fc1565845ba442189db32f7b121 /cinderclient/v3/shell.py
parent1aa1ea0250b82ef6e26795de623a58a918339635 (diff)
parent12075cb71067563f60de929e61f79eae33b2c2ec (diff)
downloadpython-cinderclient-d1853510c005125d112da87374df7a9a6f1a1ebf.tar.gz
Merge "Add volume reimage command"
Diffstat (limited to 'cinderclient/v3/shell.py')
-rw-r--r--cinderclient/v3/shell.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/cinderclient/v3/shell.py b/cinderclient/v3/shell.py
index 27f2c7f..60239c7 100644
--- a/cinderclient/v3/shell.py
+++ b/cinderclient/v3/shell.py
@@ -2858,3 +2858,23 @@ def do_default_type_unset(cs, args):
except Exception as e:
print("Unset for default volume type for project %s failed: %s"
% (project_id, e))
+
+
+@api_versions.wraps('3.68')
+@utils.arg('volume',
+ metavar='<volume>',
+ help='Name or ID of volume to reimage')
+@utils.arg('image_id',
+ metavar='<image-id>',
+ help='The image id of the image that will be used to reimage '
+ 'the volume.')
+@utils.arg('--reimage-reserved',
+ metavar='<True|False>',
+ default=False,
+ help='Enables or disables reimage for a volume that is in '
+ 'reserved state otherwise only volumes in "available" '
+ ' or "error" status may be re-imaged. Default=False.')
+def do_reimage(cs, args):
+ """Rebuilds a volume, overwriting all content with the specified image"""
+ volume = utils.find_volume(cs, args.volume)
+ volume.reimage(args.image_id, args.reimage_reserved)