Bug 972784 - virsh vol-clone [isovol] fails, tries to do qemu-img convert -f 'iso'
Summary: virsh vol-clone [isovol] fails, tries to do qemu-img convert -f 'iso'
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Libvirt Maintainers
QA Contact:
URL:
Whiteboard: LibvirtFirstBug
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-10 15:21 UTC by Cole Robinson
Modified: 2017-03-11 01:08 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-03-11 01:08:38 UTC
Embargoed:


Attachments (Terms of Use)

Description Cole Robinson 2013-06-10 15:21:55 UTC
$ sudo virsh vol-dumpxml /mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso 
<volume>
  <name>Fedora-16-x86_64-Live-KDE.iso</name>
  <key>/mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso</key>
  <source>
  </source>
  <capacity unit='bytes'>729808896</capacity>
  <allocation unit='bytes'>729812992</allocation>
  <target>
    <path>/mnt/data/devel/media/Fedora-16-x86_64-Live-KDE.iso</path>
    <format type='iso'/>
    <permissions>
      <mode>0664</mode>
      <owner>107</owner>
      <group>107</group>
      <label>system_u:object_r:virt_content_t:s0</label>
    </permissions>
    <timestamps>
      <atime>1370873447.730808726</atime>
      <mtime>1327456833.533731606</mtime>
      <ctime>1369755636.470550602</ctime>
    </timestamps>
  </target>
</volume>

$ 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.

Comment 1 Cole Robinson 2016-04-15 18:39:06 UTC
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'

Comment 2 Cole Robinson 2017-03-06 21:59:30 UTC
Patch sent upstream:

http://www.redhat.com/archives/libvir-list/2017-March/msg00251.html

Comment 3 Cole Robinson 2017-03-11 01:08:38 UTC
Upstream now


Note You need to log in before you can comment on or make changes to this bug.