Bug 1419395 - Failed to force clone a guest with ISO file
Summary: Failed to force clone a guest with ISO file
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-02-06 03:15 UTC by Xiaodai Wang
Modified: 2018-04-10 10:39 UTC (History)
11 users (show)

Fixed In Version: libvirt-3.2.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 10:39:40 UTC
Target Upstream Version:


Attachments (Terms of Use)
virt-clone debug (16.84 KB, text/plain)
2017-02-06 03:16 UTC, Xiaodai Wang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2018-04-10 15:57:35 UTC

Description Xiaodai Wang 2017-02-06 03:15:53 UTC
Description of problem:
Failed to force clone a guest with ISO file

Version-Release number of selected component (if applicable):
virt-manager-1.4.0-2.el7.noarch

How reproducible:
100%

Steps to Reproduce:
1. Prepare a guest with a cdrom disk.
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/rhel7.3-3.qcow2'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/root/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso'/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
2. Clone the guest by below command.
# virt-clone -o rhel7.3 -n testclone -f /var/lib/libvirt/images/rhel7.3-3.qcow2 -f /root/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso --debug --force-copy=hda

Actual results:
RuntimeError: Couldn't create storage volume 'cloned.iso': 'internal error: Child process (/usr/bin/qemu-img convert -f iso -O iso /root/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso /tmp/cloned.iso) unexpected exit status 1: qemu-img: Could not open '/root/SLE-12-SP1-Server-DVD-x86_64-GM-DVD1.iso': Unknown driver 'iso'

Expected results:
virt-clone should run successfully.

Additional info:

Comment 1 Xiaodai Wang 2017-02-06 03:16:32 UTC
Created attachment 1247933 [details]
virt-clone debug

Comment 2 Cole Robinson 2017-03-06 21:55:04 UTC
There's a similar against upstream libvirt: https://bugzilla.redhat.com/show_bug.cgi?id=972784

virsh vol-clone [isovol] fails as well. I think the best thing to do is teach libvirt that format=iso should just be format=raw when we pass the format to qemu-img

Comment 3 Cole Robinson 2017-03-06 21:59:40 UTC
I sent a libvirt patch upstream:

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

Comment 4 Pavel Hrdina 2017-09-06 07:08:47 UTC
Upstream commit:

commit 0e5db76262729e4c199e62c6cb00c90391073b4e
Author: Cole Robinson <crobinso@redhat.com>
Date:   Mon Mar 6 16:50:53 2017 -0500

    storage: Don't pass 'iso' format to qemu-img

Comment 6 yisun 2017-10-31 06:19:45 UTC
test with:
libvirt-3.8.0-1.virtcov.el7.x86_64
qemu-kvm-rhev-2.10.0-3.el7.x86_64

1. prepare a iso image
## mkisofs -o /var/lib/libvirt/images/aaa.iso /tmp
## ll -h /var/lib/libvirt/images/aaa.iso 
-rw-r--r--. 1 qemu qemu 8.5M Oct 31 14:10 /var/lib/libvirt/images/aaa.iso
## file /var/lib/libvirt/images/aaa.iso
/var/lib/libvirt/images/aaa.iso: # ISO 9660 CD-ROM filesystem data 'CDROM'

2. prepare a vm with following disks:
## virsh dumpxml v | grep disk -a5
...
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/RHEL-7.5-x86_64-latest.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/aaa.iso'/>
      <backingStore/>
      <target dev='hda' bus='ide'/>
      <readonly/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
...

3. do the virt-clone with vm shutoff:
## virt-clone -o v -n testclone -f /var/lib/libvirt/images/clone.qcow2 -f /var/lib/libvirt/images/clone.iso --debug --force-copy=hda
...
[Tue, 31 Oct 2017 14:17:15 virt-clone 25422] DEBUG (storage:816) Creating storage volume 'clone.iso' with xml:
<volume>
  <name>clone.iso</name>
  <capacity>8812544</capacity>
  <allocation>8814592</allocation>
  <target>
    <format type="iso"/>
  </target>
</volume>

[Tue, 31 Oct 2017 14:17:15 virt-clone 25422] DEBUG (storage:880) Couldn't lookup storage volume in prog thread.
Allocating 'clone.iso'                                                                                                                                                 | 8.4 MB  00:00:00     
[Tue, 31 Oct 2017 14:17:15 virt-clone 25422] DEBUG (storage:854) Storage volume 'clone.iso' install complete.
[Tue, 31 Oct 2017 14:17:15 virt-clone 25422] DEBUG (cloner:491) Duplicating finished.

Clone 'testclone' created successfully.
[Tue, 31 Oct 2017 14:17:15 virt-clone 25422] DEBUG (virt-clone:216) end clone
...

4. check the clone.iso same with original aaa.iso
## file /var/lib/libvirt/images/clone.iso 
/var/lib/libvirt/images/clone.iso: # ISO 9660 CD-ROM filesystem data 'CDROM'\

## diff /var/lib/libvirt/images/aaa.iso /var/lib/libvirt/images/clone.iso; echo $?
0

Comment 10 errata-xmlrpc 2018-04-10 10:39:40 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0704


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