Bug 795400

Summary: virt-clone changes the image format to raw
Product: [Fedora] Fedora Reporter: Andre Naehring <naehring>
Component: python-virtinstAssignee: Cole Robinson <crobinso>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: berrange, crobinso, jforbes, pb, tom, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-15 23:55:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andre Naehring 2012-02-20 12:25:11 UTC
Description of problem:
Using virt-clone or the virt-manager changes the image format of the copied image file to raw if the source (and destination) is a qcow2 file.


Version-ReleName        : 

python-virtinst
Version     : 0.600.1
Release     : 1.fc16
Architecture: noarch
ase number of selected component (if applicable):


How reproducible:

Steps to Reproduce:
1. Create a VM with a qcow2-based image file
2. use virt-clone --auto-clone
3. try to start the clone, the harddisk is not bootable 
  
Actual results:
VM cannot boot.

Expected results:
The VM should boot.

Additional info:
changing the image-file-format back to qcow2 the VM will boot.

Comment 1 Cole Robinson 2012-02-20 18:03:08 UTC
Hmm well that's no good. Can you provide the output of virt-clone with the --debug flag when reproducing?

Comment 2 Andre Naehring 2012-02-21 06:46:36 UTC
Here is the complete output with some additional information:

# file /var/lib/libvirt/images/SLES11SP1.qcow2
/var/lib/libvirt/images/SLES11SP1.qcow2: QEMU QCOW Image (v2), 53687091200 bytes


part of the dumpxml (original machine) -> type is set to qcow2
----8<----
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/SLES11SP1.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
---->8----


# virt-clone --connect=qemu:///system --original SLES11SP1-Vorlage --auto-clone --debug
[Di, 21 Feb 2012 07:35:52 virt-clone 4451] DEBUG (cli:220) Launched with command line:
/usr/bin/virt-clone --connect=qemu:///system --original SLES11SP1-Vorlage --auto-clone --debug
[Di, 21 Feb 2012 07:35:52 virt-clone 4451] DEBUG (cli:326) Requesting libvirt URI qemu:///system
[Di, 21 Feb 2012 07:35:52 virt-clone 4451] DEBUG (cli:328) Received libvirt URI qemu:///system
[Di, 21 Feb 2012 07:35:53 virt-clone 4451] DEBUG (virt-clone:41) Auto-generated clone name 'SLES11SP1-Vorlage-clone'
[Di, 21 Feb 2012 07:35:53 virt-clone 4451] DEBUG (CloneManager:399) Validating original guest parameters
[Di, 21 Feb 2012 07:35:53 virt-clone 4451] DEBUG (CloneManager:408) Original XML:
<domain type='kvm'>
  <name>SLES11SP1-Vorlage</name>
  <uuid>03b1d319-014a-fa11-5471-0f6672f7d9c1</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.14'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/SLES11SP1.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:09:b3:cc'/>
      <source network='default'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

[Di, 21 Feb 2012 07:35:54 virt-clone 4451] DEBUG (CloneManager:416) Original paths: ['/var/lib/libvirt/images/SLES11SP1.qcow2']
[Di, 21 Feb 2012 07:35:54 virt-clone 4451] DEBUG (CloneManager:417) Original sizes: [50.0]
[Di, 21 Feb 2012 07:35:54 virt-clone 4451] DEBUG (VirtualDisk:240) Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'SLES11SP1-clone-1.qcow2'.
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (VirtualDisk:240) Path '/var/lib/libvirt/images' is target for pool 'default'. Creating volume 'SLES11SP1-clone-1.qcow2'.
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:399) Validating original guest parameters
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:408) Original XML:
<domain type='kvm'>
  <name>SLES11SP1-Vorlage</name>
  <uuid>03b1d319-014a-fa11-5471-0f6672f7d9c1</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.14'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/SLES11SP1.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:09:b3:cc'/>
      <source network='default'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:416) Original paths: ['/var/lib/libvirt/images/SLES11SP1.qcow2']
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:417) Original sizes: [50.0]
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:516) Original guest xml is
<domain type='kvm'>
  <name>SLES11SP1-Vorlage</name>
  <uuid>03b1d319-014a-fa11-5471-0f6672f7d9c1</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.14'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/SLES11SP1.qcow2'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:09:b3:cc'/>
      <source network='default'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='-1' autoport='yes'/>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
</domain>

[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:434) Validating clone parameters.
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:444) Clone paths: ['/var/lib/libvirt/images/SLES11SP1-clone-1.qcow2']
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:519) Clone guest xml is
<domain type="kvm">
  <name>SLES11SP1-Vorlage-clone</name>
  <uuid>68fdc4e3-9691-c6bb-69ed-5e6a61018cfe</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch="x86_64" machine="pc-0.14">hvm</type>
    <boot dev="hd"/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset="utc"/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="raw"/>
      <target dev="hda" bus="ide"/>
      <address type="drive" controller="0" bus="0" unit="0"/>
      <source file="/var/lib/libvirt/images/SLES11SP1-clone-1.qcow2"/>
    </disk>
    <controller type="ide" index="0">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x01" function="0x1"/>
    </controller>
    <interface type="network">
      <mac address="52:54:00:15:db:e6"/>
      <source network="default"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x03" function="0x0"/>
    </interface>
    <serial type="pty">
      <target port="0"/>
    </serial>
    <console type="pty">
      <target type="serial" port="0"/>
    </console>
    <input type="mouse" bus="ps2"/>
    <graphics type="vnc" port="-1" autoport="yes"/>
    <sound model="ich6">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x04" function="0x0"/>
    </sound>
    <video>
      <model type="cirrus" vram="9216" heads="1"/>
      <address type="pci" domain="0x0000" bus="0x00" slot="0x02" function="0x0"/>
    </video>
    <memballoon model="virtio">
      <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0"/>
    </memballoon>
  </devices>
</domain>

[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (CloneManager:613) Starting duplicate.
[Di, 21 Feb 2012 07:35:55 virt-clone 4451] DEBUG (Storage:1195) Creating storage volume 'SLES11SP1-clone-1.qcow2' with xml:
<?xml version="1.0"?>
<volume>
  <name>SLES11SP1-clone-1.qcow2</name>
  <key>/var/lib/libvirt/images/SLES11SP1.qcow2</key>
  <source>
  </source>
  <capacity>53687091200</capacity>
  <allocation>3139833856</allocation>
  <target>
    <path>/var/lib/libvirt/images/SLES11SP1.qcow2</path>
    <format type="qcow2"/>
    <permissions>
      <mode>0600</mode>
      <owner>0</owner>
      <group>0</group>
      <label>system_u:object_r:virt_image_t:s0</label>
    </permissions>
  </target>
</volume>

Allocating 'SLES11SP1-clone-1.qcow2'                                                                                                  |  50 GB     02:05     
[Di, 21 Feb 2012 07:38:01 virt-clone 4451] DEBUG (Storage:1218) Storage volume 'SLES11SP1-clone-1.qcow2' install complete.
[Di, 21 Feb 2012 07:38:01 virt-clone 4451] DEBUG (CloneManager:635) Duplicating finished.

Clone 'SLES11SP1-Vorlage-clone' created successfully.
[Di, 21 Feb 2012 07:38:01 virt-clone 4451] DEBUG (virt-clone:249) end clone




# virsh start SLES11SP1-Vorlage-clone
Domain SLES11SP1-Vorlage-clone gestartet

----> the domain starts but the vm is not able to boot the disk



# virsh dumpxml SLES11SP1-Vorlage-clone
<domain type='kvm' id='9'>
  <name>SLES11SP1-Vorlage-clone</name>
  <uuid>68fdc4e3-9691-c6bb-69ed-5e6a61018cfe</uuid>
  <memory>1048576</memory>
  <currentMemory>1048576</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='x86_64' machine='pc-0.14'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/SLES11SP1-clone-1.qcow2'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>
    <controller type='ide' index='0'>
      <alias name='ide0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:15:db:e6'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='pty'>
      <source path='/dev/pts/1'/>
      <target port='0'/>
      <alias name='serial0'/>
    </serial>
    <console type='pty' tty='/dev/pts/1'>
      <source path='/dev/pts/1'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    </console>
    <input type='mouse' bus='ps2'/>
    <graphics type='vnc' port='5900' autoport='yes'/>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='9216' heads='1'/>
      <alias name='video0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c425,c1010</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c425,c1010</imagelabel>
  </seclabel>
</domain>



---- > changing the relevant part to the vm can access the disk

    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/SLES11SP1-clone-1.qcow2'/>
      <target dev='hda' bus='ide'/>
      <alias name='ide0-0-0'/>
      <address type='drive' controller='0' bus='0' unit='0'/>
    </disk>

Comment 3 Andre Naehring 2012-02-21 06:49:15 UTC
(In reply to comment #2)
> Here is the complete output with some additional information:
> 
> ---- > changing the relevant part to the vm can access the disk
> 
>     <disk type='file' device='disk'>
>       <driver name='qemu' type='raw'/>
>       <source file='/var/lib/libvirt/images/SLES11SP1-clone-1.qcow2'/>
>       <target dev='hda' bus='ide'/>
>       <alias name='ide0-0-0'/>
>       <address type='drive' controller='0' bus='0' unit='0'/>
>     </disk>

I was to fast here. When setting the "type=" to "qcow2" the vm is able to boot. So while cloning, the original image type is used to create the destination but the XML definition is writing "raw" instead of the correct image type.

Comment 4 Cole Robinson 2012-03-01 22:34:04 UTC
Great, thanks for the info. Fixed upstream now:

http://git.fedorahosted.org/git?p=python-virtinst.git;a=commit;h=f0195e95d57deda83daed5231582ca86bde519ae

Comment 6 Cole Robinson 2012-04-25 16:30:56 UTC
*** Bug 815210 has been marked as a duplicate of this bug. ***

Comment 7 Fedora Update System 2012-06-06 20:58:13 UTC
python-virtinst-0.600.1-2.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/python-virtinst-0.600.1-2.fc16

Comment 8 Fedora Update System 2012-06-06 21:02:43 UTC
python-virtinst-0.600.1-2.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/python-virtinst-0.600.1-2.fc17

Comment 9 Fedora Update System 2012-06-07 22:51:46 UTC
Package python-virtinst-0.600.1-2.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-virtinst-0.600.1-2.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-8995/python-virtinst-0.600.1-2.fc17
then log in and leave karma (feedback).

Comment 10 Andre Naehring 2012-06-11 09:22:34 UTC
Looks good. Cloning now creates a copy of my qcow2 image and the resulting definition for the vm works.

Comment 11 Fedora Update System 2012-06-15 23:55:05 UTC
python-virtinst-0.600.1-2.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2012-06-16 00:01:27 UTC
python-virtinst-0.600.1-2.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.