summaryrefslogtreecommitdiff
path: root/cinderclient/v3/shell.py
diff options
context:
space:
mode:
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)