Red Hat Bugzilla – Bug 972784
virsh vol-clone [isovol] fails, tries to do qemu-img convert -f 'iso'
Last modified: 2017-03-10 20:08:38 EST
$ sudo virsh vol-dumpxml /mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso
$ sudo virsh vol-clone /mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso test.iso
error: Failed to clone vol from Fedora-16-x86_64-Live-KDE.iso
error: internal error Child process (/usr/bin/qemu-img convert -f iso -O iso /mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso /mnt/data/devel/media/test.iso) unexpected exit status 1: qemu-img: Unknown file format 'iso'
qemu-img: Could not open '/mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso'
Not a big issue in practice since virt-manager doesn't try to clone readonly disks by default, and ISO media is almost always attached to a readonly disk.
The storage cloning bits need some tweaking:
- We should drop the illusion that BuildVolFrom is for anything but cloning or converting a disk image. Right now for raw images we support growing the image after completing the clone operation, but we should just tell any concerned user to use VolResize if they want that.
- If we drop that, we can simplify the code a bit and fix this bug by just doing a byte for byte copy if the source and destination volume have the same format. Right now we only really do that for 'raw', and for everything else call out to qemu-img convert. Which isn't going to work for a readonly image type like VDI even though we should be able to support it easily.
Still relevant. The bigger issues mentioned at the end of the comment should probably be separate bugs.
The simplest fix for this is to convert format=iso to format=raw when handing it off to qemu-img, because they are effectively the same thing. In src/storage/storage_backend.c virStorageBackendCreateQemuImgCmdFromVol there's code like this alread:
/* Treat output block devices as 'raw' format */
if (vol->type == VIR_STORAGE_VOL_BLOCK)
info.format = VIR_STORAGE_FILE_RAW;
We need to do something similar for converting iso -> raw, both on 'vol' and 'inputvol'
Patch sent upstream: