Failed to convert a image
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When I use image_utils.
>>> from cinder.
>>> convert_
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
out_format, run_as_
File "/usr/lib/
utils.
File "/usr/lib/
return processutils.
File "/usr/lib/
cmd=
oslo_concurrenc
Command: qemu-img convert -O raw image01 sheepdog:
Exit code: 1
Stdout: u''
Stderr: u'qemu-img: VDI exists already, test01\nqemu-img: sheepdog:
This is because the sheepdog image is already exist:
[root@controller-1 ~]# qemu-img convert -O raw image01 sheepdog:
qemu-img: VDI exists already, test01
qemu-img: sheepdog:
image: Input/output error
The qemu-img tool provides a '-n' option to skip the target volume creation, it works well when this option is used:
[root@controller-1 ~]# qemu-img convert -n -O raw image01 sheepdog:
[root@controller-1 ~]#
Ceph rbd also has this problem:
[root@ceph01 ~]# qemu-img convert -O raw image01 rbd:rbd/test01
qemu-img: rbd:rbd/test01: error while converting raw: Could not create image: File exists
works well when use '-n' option:
[root@ceph01 ~]# qemu-img convert -n -O raw image01 rbd:rbd/test01
[root@ceph01 ~]#
This is not convenient in some case, such as create volume from a image. It may need to convert a image file into the volume, but the volume is created prior to running qemu-img. Here is a case in sheepdog driver, as a workaround, it need to delete the volume first, then convert the image file to the sheepdog volume, and resize the volume to original size at last:
https:/
This is not convenient. I think it is a good way to add a optional parameter for convert_image method and add '-n' option in the final command.
Changed in cinder: | |
assignee: | nobody → zhangsong (zhangsong) |
Changed in cinder: | |
status: | New → Invalid |
Fix proposed to branch: master /review. openstack. org/342173
Review: https:/