Red Hat Bugzilla – Bug 1365005
Guest name is incorrect if convert guest from disk image by virt-v2v
Last modified: 2016-11-03 14:03:29 EDT
Created attachment 1188632 [details] guest-name.log Description of problem: Guest name is incorrect if convert guest from disk image by virt-v2v Version-Release number of selected component (if applicable): libvirt-2.0.0-4.el7.x86_64 libguestfs-1.32.6-5.el7.x86_64 qemu-kvm-rhev-2.6.0-18.el7.x86_64 virt-v2v-1.32.6-5.el7.x86_64 How reproducible: 100% Steps to Reproduce: 1.Convert guest from disk image which has name esx5.1-win7-i386-sda by virt-v2v # virt-v2v -i disk esx5.1-win7-i386-sda -os mxie -v -x |& tee > guest-name.log 2.After converion, the guest name is esx5 which converted by step1 # virsh list --all Id Name State ---------------------------------------------------- 80 network running 83 kvm-win7-i386-qcow2 running - esx5 shut off - esx5.1-win7-i386 shut off - juzhou-2012r2-efi shut off - win10 shut off 3.Convert guest from disk image which has name m.m.m-sda by virt-v2v # virt-v2v -i disk m.m.m-sda -os mxie [ 0.0] Opening the source -i disk m.m.m-sda [ 0.1] Creating an overlay to protect the source from being modified [ 0.8] Initializing the target -o libvirt -os mxie [ 0.8] Opening the overlay [ 3.7] Inspecting the overlay [ 5.7] Checking for sufficient free disk space in the guest [ 5.7] Estimating space required on target for each disk [ 5.7] Converting Windows 7 Ultimate to run on KVM virt-v2v: This guest has virtio drivers installed. [ 7.5] Mapping filesystem data to avoid copying unused and blank areas [ 8.1] Closing the overlay [ 8.1] Checking if the guest needs BIOS or UEFI to boot [ 8.1] Assigning disks to buses [ 8.1] Copying disk 1/1 to /var/lib/libvirt/images/mxie/m.m-sda (qcow2) (100.00/100%) [ 217.2] Creating output metadata Pool mxie refreshed Domain m.m defined from /tmp/v2vlibvirtc486e8.xml [ 218.2] Finishing of 4.After converion, the guest name is m.m which converted by step3 # virsh list --all Id Name State ---------------------------------------------------- 80 network running 83 kvm-win7-i386-qcow2 running - esx5 shut off - esx5.1-win7-i386 shut off - juzhou-2012r2-efi shut off - m.m shut off - win10 shut off Actual results: Guest name is defined by all characters before the last point when convert guest from disk image by virt-v2v Expected results: Guest name should be correct when convert guest from disk image by virt-v2v Additional info:
This is caused by the way we derive the name from the filename, chopping off the "extension". https://github.com/libguestfs/libguestfs/blob/master/v2v/input_disk.ml#L41 Possibly better to only chop known extensions, or 3/4 character extensions, or something along those lines.
Posted a simple approach based on comment #1: https://www.redhat.com/archives/libguestfs/2016-August/msg00043.html
Fixed with https://github.com/libguestfs/libguestfs/commit/98dea4978d96c373b01bf61b16eaca3146da5306 which is libguestfs >= 1.35.1.
Since it looks as if we'll do another RHEL build, and the patch is simple, moving to 7.3.
I can reproduce this issue with package: virt-v2v-1.32.6-5.el7.x86_64 libguestfs-1.32.6-5.el7.x86_64 Then try to verify this bug with build: libvirt-2.0.0-4.el7.x86_64 libguestfs-1.32.7-1.el7.x86_64 virt-v2v-1.32.7-1.el7.x86_64 qemu-kvm-rhev-2.6.0-19.el7.x86_64 steps: 1.Convert guest from disk image which has name esx6.0-rhel7.2-x86_64-sda and m.m.m-sda-sda by virt-v2v. 1.1 esx6.0-rhel7.2-x86_64-sda (original guest name is:esx6.0-rhel7.2-x86_64) # virt-v2v -i disk esx6.0-rhel7.2-x86_64-sda -os opt [ 0.0] Opening the source -i disk esx6.0-rhel7.2-x86_64-sda [ 0.0] Creating an overlay to protect the source from being modified [ 0.2] Initializing the target -o libvirt -os opt [ 0.2] Opening the overlay [ 2.9] Inspecting the overlay [ 14.6] Checking for sufficient free disk space in the guest [ 14.6] Estimating space required on target for each disk [ 14.6] Converting Red Hat Enterprise Linux Server 7.2 (Maipo) to run on KVM virt-v2v: warning: /files/boot/grub2/device.map/hd0 references unknown device "vda". You may have to fix this entry manually after conversion. virt-v2v: This guest has virtio drivers installed. [ 84.0] Mapping filesystem data to avoid copying unused and blank areas [ 84.3] Closing the overlay [ 84.3] Checking if the guest needs BIOS or UEFI to boot [ 84.3] Assigning disks to buses [ 84.3] Copying disk 1/1 to /opt/esx6.0-rhel7.2-x86_64-sda (raw) (100.00/100%) [ 169.5] Creating output metadata Pool opt refreshed Domain esx6.0-rhel7.2-x86_64 defined from /tmp/v2vlibvirtd4e3d4.xml [ 169.7] Finishing off 1.2 m.m.m-sda-sda (original guest name is:m.m.m-sda) # virt-v2v -i disk m.m.m-sda-sda -os opt [ 0.0] Opening the source -i disk m.m.m-sda-sda [ 0.0] Creating an overlay to protect the source from being modified [ 0.6] Initializing the target -o libvirt -os opt [ 0.7] Opening the overlay [ 5.8] Inspecting the overlay [ 21.6] Checking for sufficient free disk space in the guest [ 21.6] Estimating space required on target for each disk [ 21.6] Converting Red Hat Enterprise Linux Server release 6.7 Beta (Santiago) to run on KVM virt-v2v: warning: /files/boot/grub/device.map/hd0 references unknown device "vda". You may have to fix this entry manually after conversion. virt-v2v: warning: /files/etc/sysconfig/grub/boot references unknown device "vda". You may have to fix this entry manually after conversion. virt-v2v: This guest has virtio drivers installed. [ 132.2] Mapping filesystem data to avoid copying unused and blank areas [ 132.4] Closing the overlay [ 132.6] Checking if the guest needs BIOS or UEFI to boot [ 132.6] Assigning disks to buses [ 132.6] Copying disk 1/1 to /opt/m.m.m-sda-sda (raw) (100.00/100%) [ 182.2] Creating output metadata Pool opt refreshed Domain m.m.m-sda defined from /tmp/v2vlibvirt43a9bd.xml [ 182.8] Finishing off 2. After conversion check guest name. # virsh list --all Id Name State ---------------------------------------------------- - esx6.0-rhel7 shut off-------------->bug issue - esx6.0-rhel7.2-x86_64 shut off-------------->right one - m.m shut off-------------->bug issue - m.m.m-sda shut off-------------->right one Since guest name is correct when convert from disk image by virt-v2v, move this bug to VERIFIED.
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://rhn.redhat.com/errata/RHSA-2016-2576.html