diff options
Diffstat (limited to 'cinderclient/v3/volumes.py')
-rw-r--r-- | cinderclient/v3/volumes.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cinderclient/v3/volumes.py b/cinderclient/v3/volumes.py index 42527f7..0479dc3 100644 --- a/cinderclient/v3/volumes.py +++ b/cinderclient/v3/volumes.py @@ -67,6 +67,10 @@ class Volume(volumes_base.Volume): metadata=metadata, bootable=bootable, cluster=cluster) + def reimage(self, image_id, reimage_reserved=False): + """Rebuilds the volume with the new specified image""" + self.manager.reimage(self, image_id, reimage_reserved) + class VolumeManager(volumes_base.VolumeManager): resource_class = Volume @@ -282,3 +286,21 @@ class VolumeManager(volumes_base.VolumeManager): search_opts=options) return self._get(url, None) + + @api_versions.wraps('3.68') + def reimage(self, volume, image_id, reimage_reserved=False): + """Reimage a volume + + .. warning:: This is a destructive action and the contents of the + volume will be lost. + + :param volume: Volume to reimage. + :param reimage_reserved: Boolean to enable or disable reimage + of a volume that is in 'reserved' state otherwise only + volumes in 'available' status may be re-imaged. + :param image_id: The image id. + """ + return self._action('os-reimage', + volume, + {'image_id': image_id, + 'reimage_reserved': reimage_reserved}) |