diff --git a/cinderclient/v1/shell.py b/cinderclient/v1/shell.py index ec62ba286..856facbbe 100644 --- a/cinderclient/v1/shell.py +++ b/cinderclient/v1/shell.py @@ -86,6 +86,10 @@ def _print_volume_snapshot(snapshot): utils.print_dict(snapshot._info) +def _print_volume_image(image): + utils.print_dict(image[1]['os-volume_upload_image']) + + def _translate_keys(collection, convert): for item in collection: keys = list(item.__dict__.keys()) @@ -683,10 +687,10 @@ def _find_volume_type(cs, vtype): def do_upload_to_image(cs, args): """Upload volume to image service as image.""" volume = _find_volume(cs, args.volume_id) - volume.upload_to_image(args.force, - args.image_name, - args.container_format, - args.disk_format) + _print_volume_image(volume.upload_to_image(args.force, + args.image_name, + args.container_format, + args.disk_format)) @utils.arg('volume', metavar='', diff --git a/cinderclient/v1/volumes.py b/cinderclient/v1/volumes.py index 5f6c56659..9c870cb30 100644 --- a/cinderclient/v1/volumes.py +++ b/cinderclient/v1/volumes.py @@ -91,8 +91,8 @@ class Volume(base.Resource): def upload_to_image(self, force, image_name, container_format, disk_format): """Upload a volume to image service as an image.""" - self.manager.upload_to_image(self, force, image_name, container_format, - disk_format) + return self.manager.upload_to_image(self, force, image_name, + container_format, disk_format) def force_delete(self): """Delete the specified volume ignoring its current state. diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index 5dc85d379..7bf15dfda 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -80,6 +80,10 @@ def _print_volume_snapshot(snapshot): utils.print_dict(snapshot._info) +def _print_volume_image(image): + utils.print_dict(image[1]['os-volume_upload_image']) + + def _translate_keys(collection, convert): for item in collection: keys = list(item.__dict__.keys()) @@ -759,10 +763,10 @@ def _find_volume_type(cs, vtype): def do_upload_to_image(cs, args): """Upload volume to image service as image.""" volume = _find_volume(cs, args.volume_id) - volume.upload_to_image(args.force, - args.image_name, - args.container_format, - args.disk_format) + _print_volume_image(volume.upload_to_image(args.force, + args.image_name, + args.container_format, + args.disk_format)) @utils.arg('volume', metavar='', diff --git a/cinderclient/v2/volumes.py b/cinderclient/v2/volumes.py index 273668f98..14535afc9 100644 --- a/cinderclient/v2/volumes.py +++ b/cinderclient/v2/volumes.py @@ -90,8 +90,8 @@ class Volume(base.Resource): def upload_to_image(self, force, image_name, container_format, disk_format): """Upload a volume to image service as an image.""" - self.manager.upload_to_image(self, force, image_name, container_format, - disk_format) + return self.manager.upload_to_image(self, force, image_name, + container_format, disk_format) def force_delete(self): """Delete the specified volume ignoring its current state.