RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1365005 - Guest name is incorrect if convert guest from disk image by virt-v2v
Summary: Guest name is incorrect if convert guest from disk image by virt-v2v
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.3
Hardware: x86_64
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-08 11:04 UTC by mxie@redhat.com
Modified: 2016-11-03 18:03 UTC (History)
6 users (show)

Fixed In Version: libguestfs-1.32.7-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:03:29 UTC
Target Upstream Version:
Embargoed:


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


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2576 0 normal SHIPPED_LIVE Moderate: libguestfs and virt-p2v security, bug fix, and enhancement update 2016-11-03 12:06:51 UTC

Description mxie@redhat.com 2016-08-08 11:04:43 UTC
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 11:08:55 UTC
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 14:45:32 UTC
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 15:41:20 UTC
Fixed with
https://github.com/libguestfs/libguestfs/commit/98dea4978d96c373b01bf61b16eaca3146da5306
which is libguestfs >= 1.35.1.

Comment 4 Richard W.M. Jones 2016-08-08 15:51:49 UTC
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 09:44:51 UTC
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 18:03:29 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://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.