Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1365005 - Guest name is incorrect if convert guest from disk image by virt-v2v
Guest name is incorrect if convert guest from disk image by virt-v2v
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.3
x86_64 Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
V2V
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-08 07:04 EDT by mxie@redhat.com
Modified: 2016-11-03 14:03 EDT (History)
6 users (show)

See Also:
Fixed In Version: libguestfs-1.32.7-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-03 14:03:29 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
guest-name.log (398.64 KB, text/plain)
2016-08-08 07:04 EDT, mxie@redhat.com
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2576 normal SHIPPED_LIVE Moderate: libguestfs and virt-p2v security, bug fix, and enhancement update 2016-11-03 08:06:51 EDT

  None (edit)
Description mxie@redhat.com 2016-08-08 07:04:43 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:
Comment 1 Richard W.M. Jones 2016-08-08 07:08:55 EDT
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.
Comment 2 Pino Toscano 2016-08-08 10:45:32 EDT
Posted a simple approach based on comment #1:

https://www.redhat.com/archives/libguestfs/2016-August/msg00043.html
Comment 3 Pino Toscano 2016-08-08 11:41:20 EDT
Fixed with
https://github.com/libguestfs/libguestfs/commit/98dea4978d96c373b01bf61b16eaca3146da5306
which is libguestfs >= 1.35.1.
Comment 4 Richard W.M. Jones 2016-08-08 11:51:49 EDT
Since it looks as if we'll do another RHEL build, and the patch is
simple, moving to 7.3.
Comment 6 zhoujunqin 2016-08-10 05:44:51 EDT
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.
Comment 8 errata-xmlrpc 2016-11-03 14:03:29 EDT
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

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