Merge "Add print to the upload-to-image command"
This commit is contained in:
@@ -86,6 +86,10 @@ def _print_volume_snapshot(snapshot):
|
|||||||
utils.print_dict(snapshot._info)
|
utils.print_dict(snapshot._info)
|
||||||
|
|
||||||
|
|
||||||
|
def _print_volume_image(image):
|
||||||
|
utils.print_dict(image[1]['os-volume_upload_image'])
|
||||||
|
|
||||||
|
|
||||||
def _translate_keys(collection, convert):
|
def _translate_keys(collection, convert):
|
||||||
for item in collection:
|
for item in collection:
|
||||||
keys = list(item.__dict__.keys())
|
keys = list(item.__dict__.keys())
|
||||||
@@ -683,10 +687,10 @@ def _find_volume_type(cs, vtype):
|
|||||||
def do_upload_to_image(cs, args):
|
def do_upload_to_image(cs, args):
|
||||||
"""Upload volume to image service as image."""
|
"""Upload volume to image service as image."""
|
||||||
volume = _find_volume(cs, args.volume_id)
|
volume = _find_volume(cs, args.volume_id)
|
||||||
volume.upload_to_image(args.force,
|
_print_volume_image(volume.upload_to_image(args.force,
|
||||||
args.image_name,
|
args.image_name,
|
||||||
args.container_format,
|
args.container_format,
|
||||||
args.disk_format)
|
args.disk_format))
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('volume', metavar='<volume>',
|
@utils.arg('volume', metavar='<volume>',
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ class Volume(base.Resource):
|
|||||||
def upload_to_image(self, force, image_name, container_format,
|
def upload_to_image(self, force, image_name, container_format,
|
||||||
disk_format):
|
disk_format):
|
||||||
"""Upload a volume to image service as an image."""
|
"""Upload a volume to image service as an image."""
|
||||||
self.manager.upload_to_image(self, force, image_name, container_format,
|
return self.manager.upload_to_image(self, force, image_name,
|
||||||
disk_format)
|
container_format, disk_format)
|
||||||
|
|
||||||
def force_delete(self):
|
def force_delete(self):
|
||||||
"""Delete the specified volume ignoring its current state.
|
"""Delete the specified volume ignoring its current state.
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ def _print_volume_snapshot(snapshot):
|
|||||||
utils.print_dict(snapshot._info)
|
utils.print_dict(snapshot._info)
|
||||||
|
|
||||||
|
|
||||||
|
def _print_volume_image(image):
|
||||||
|
utils.print_dict(image[1]['os-volume_upload_image'])
|
||||||
|
|
||||||
|
|
||||||
def _translate_keys(collection, convert):
|
def _translate_keys(collection, convert):
|
||||||
for item in collection:
|
for item in collection:
|
||||||
keys = list(item.__dict__.keys())
|
keys = list(item.__dict__.keys())
|
||||||
@@ -759,10 +763,10 @@ def _find_volume_type(cs, vtype):
|
|||||||
def do_upload_to_image(cs, args):
|
def do_upload_to_image(cs, args):
|
||||||
"""Upload volume to image service as image."""
|
"""Upload volume to image service as image."""
|
||||||
volume = _find_volume(cs, args.volume_id)
|
volume = _find_volume(cs, args.volume_id)
|
||||||
volume.upload_to_image(args.force,
|
_print_volume_image(volume.upload_to_image(args.force,
|
||||||
args.image_name,
|
args.image_name,
|
||||||
args.container_format,
|
args.container_format,
|
||||||
args.disk_format)
|
args.disk_format))
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('volume', metavar='<volume>',
|
@utils.arg('volume', metavar='<volume>',
|
||||||
|
|||||||
@@ -90,8 +90,8 @@ class Volume(base.Resource):
|
|||||||
def upload_to_image(self, force, image_name, container_format,
|
def upload_to_image(self, force, image_name, container_format,
|
||||||
disk_format):
|
disk_format):
|
||||||
"""Upload a volume to image service as an image."""
|
"""Upload a volume to image service as an image."""
|
||||||
self.manager.upload_to_image(self, force, image_name, container_format,
|
return self.manager.upload_to_image(self, force, image_name,
|
||||||
disk_format)
|
container_format, disk_format)
|
||||||
|
|
||||||
def force_delete(self):
|
def force_delete(self):
|
||||||
"""Delete the specified volume ignoring its current state.
|
"""Delete the specified volume ignoring its current state.
|
||||||
|
|||||||
Reference in New Issue
Block a user