Bug 838057

Summary: converted XML from XEN to KVM lacks cache='none' section, leading to errors when trying to live migrate
Product: Red Hat Enterprise Linux 6 Reporter: Harald Klein <hklein>
Component: virt-v2vAssignee: Matthew Booth <mbooth>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: ddumas, dyasny, lnovich, mzhan, rjones, tzheng, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: virt-v2v-0.8.9-1.el6 Doc Type: Bug Fix
Doc Text:
Cause: When creating a new libvirt guest, virt-v2v would not disable caching for disks as is recommended. Consequence: Guests created by a virt-v2v used caching for their disks, unless explicitly disabled by the user after conversion. Fix: virt-v2v now explicitly disables caching for all disks when creating a new libvirt guest. Result: Guests create by virt-v2v now have caching disabled for all disks. The user can enable it again if required after conversion.
Story Points: ---
Clone Of:
: 852654 (view as bug list) Environment:
Last Closed: 2013-02-21 10:59:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 782183, 840699, 852654    

Description Harald Klein 2012-07-06 10:35:31 UTC
Description of problem:

When converting a XML guest configuration from XEN to KVM, the driver tag in the disc section lacks the "cache='none'" attribute. This leads to an error when trying to live migrate the guest on KVM.

Version-Release number of selected component (if applicable):

current virt-v2v on 6.3

How reproducible:

Convert a XEN domain to a KVM guest
  
Actual results:

# virsh migrate  --live guest01 qemu+ssh://host02/system
error: Unsafe migration: Migration may lead to data corruption if disks use cache != none

Expected results:

live migration should work without error

Additional info:

Adding the attribute prevents the error from occurring, change the disk section in the xml like shown:

remove:
      <driver name='qemu' type='raw'/>

add:
      <driver name='qemu' type='raw' cache='none'/>

Comment 2 yuping zhang 2012-08-13 06:31:10 UTC
I can reproduce this issue with virt-v2v-0.8.7-6.el6.x86_64.
virt-v2v convert all guests,whatever from xen or kvm,to kvm,the disk drive doesn't have cache='none'.
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/rhel6u1-64b-hv.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>
When do migration,it will fail. 
# virsh migrate --live xen-hvm-rhel6.2-x86_64 qemu+ssh://10.66.7.56/system xen-hvm-rhel6.2-x86_64
error: Unsafe migration: Migration may lead to data corruption if disks use cache != none

Comment 3 yuping zhang 2012-08-13 07:33:42 UTC
More test steps:
1.Xen guest xml,before conversion:
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/var/lib/xen/images/rhel6u1-64b-hv.img'/>
      <target dev='hda' bus='ide'/>
    </disk>
2.Xen guest,after conversion
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/rhel6u1-64b-hv.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

3.KVM guest,before conversion:
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/kvm-rhel/kvm-rhel6.2-i386.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
4.KVM guest,after conversion:
<disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/kvm-rhel6.2-i386.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

For xen guest,before conversion,the guest disk driver didn't have cache='none',I think it's reasonable that v2v doesn't add cache='none' to it.Added --safe when migrate the guest use virsh.

For KVM guest,before conversion,the guest disk drive had cache='none',but after conversion,the guest doesn't have cache='none'. I think this should be a bug,the xml should keep the same.

Comment 4 yuping zhang 2012-08-13 07:37:41 UTC
isk>
> 
> For xen guest,before conversion,the guest disk driver didn't have
> cache='none',I think it's reasonable that v2v doesn't add cache='none' to
> it.Added --safe when migrate the guest use virsh.

Typo,it should be add --unsafe parameter,not --safe.
#virsh help migrate
--unsafe         force migration even if it may be unsafe

Comment 6 Matthew Booth 2012-10-17 15:06:53 UTC
This is fixed upstream in commit d907c8a260daa0be5347bccea404d8977edd830c

Comment 8 tingting zheng 2012-10-24 10:10:56 UTC
Tested the bug with:
virt-v2v-0.8.9-2.el6.x86_64
libguestfs-1.16.32-2.el6.x86_64
libvirt-0.10.2-5.el6.x86_64

1.Prepare a xen guest.
# virsh dumpxml xen-hvm-rhel6.3-x86_64
    <disk type='file' device='disk'>
      <driver name='file'/>
      <source file='/var/lib/xen/images/xen-hvm-rhel6.3-x86_64.img'/>
      <target dev='hda' bus='ide'/>
    </disk>

2.Use virt-v2v to convert the guest to libvirt.
# virt-v2v  -ic xen+ssh://10.66.72.23 -os default -b breth0 xen-hvm-rhel6.3-x86_64xen-hvm-rhel6.3-x86_64.img: 100% [=====================================================================]D 0h02m15s
virt-v2v: WARNING: The connected hypervisor does not support feature pae.
virt-v2v: xen-hvm-rhel6.3-x86_64 configured with virtio drivers.

3.After conversion,check the xml file of the guest,there is cache='none' added.
# virsh dumpxml xen-hvm-rhel6.3-x86_64
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/xen-hvm-rhel6.3-x86_64.img'/>
      <target dev='vda' bus='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </disk>

So change the bug to VERIFIED.

Comment 10 errata-xmlrpc 2013-02-21 10:59:22 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.

http://rhn.redhat.com/errata/RHBA-2013-0477.html