Bug 1598350 - RFE: virt-v2v should preserve <genid>
Summary: RFE: virt-v2v should preserve <genid>
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.1
Hardware: All
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
Depends On: 1118825 vmgenid vmgenid-libvirt 1621895
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-05 07:50 UTC by Richard W.M. Jones
Modified: 2019-08-06 12:44 UTC (History)
28 users (show)

Fixed In Version: libguestfs-1.40.1-1.el7
Doc Type: Enhancement
Doc Text:
Clone Of: vmgenid-libvirt
Environment:
Last Closed: 2019-08-06 12:44:11 UTC
Target Upstream Version:


Attachments (Terms of Use)
VMGENID.EXE (90.79 KB, application/x-ms-dos-executable)
2018-07-05 12:22 UTC, Richard W.M. Jones
no flags Details
windows.png (37.92 KB, image/png)
2018-07-05 12:23 UTC, Richard W.M. Jones
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2019:2096 None None None 2019-08-06 12:44:35 UTC

Description Richard W.M. Jones 2018-07-05 07:50:59 UTC
Description:

The VM Generation ID (<genid> in libvirt XML) should follow
a guest around when it is V2V'd over to a new hypervisor.  See:

http://go.microsoft.com/fwlink/?LinkId=260709

However virt-v2v ignores this metadata and does not preserve it
on the target hypervisor.

Comment 2 Richard W.M. Jones 2018-07-05 08:10:00 UTC
See also:
https://libvirt.org/formatdomain.html#elementsMetadata

Also this is present in VMX files as in these examples:

vm.genid = "7344585841658099715"
vm.genidX = "-8483171368186442967"

vm.genid = "-570734802784577186"
vm.genidx = "-5042519231342505152"

These are two signed 64 bit numbers, but I don't have a clear
idea how these are mapped to ACPI data or UUIDs.

Also these VMware slides are interesting, especially the slide
about what operations trigger VM GenID to change:

https://download3.vmware.com/vmworld/2014/downloads/session-pdfs/VAPP1340_Final_US.pdf

Comment 3 Richard W.M. Jones 2018-07-05 12:22:41 UTC
Created attachment 1456759 [details]
VMGENID.EXE

Attached is a Windows binary which can be used to read the
VM Generation ID from inside a Windows guest.  It was constructed
by following the instructions here (but using MinGW instead of
a Windows compiler):

https://social.technet.microsoft.com/Forums/windowsserver/en-US/7270df3c-642a-429c-80c4-540a8f2e1777/how-to-get-the-vmgeneration-id-from-vm-or-hypervisor?forum=winserver8gen

I created a Win2016 VM and booted it using:

qemu ... -device vmgenid,guid=01020304-0506-0708-090a-0b0c0d0e0f00,id=vmgenid0

Inside the guest this program printed:

C:\>VMGENID.EXE
VmCounterValue: 708050601020304:f0e0d0c0b0a09

Comment 4 Richard W.M. Jones 2018-07-05 12:23:45 UTC
Created attachment 1456760 [details]
windows.png

Screenshot of VMGENID.EXE running in the Windows guest.

Comment 5 Richard W.M. Jones 2018-07-05 13:43:56 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2018-July/msg00011.html

Comment 6 Richard W.M. Jones 2018-07-09 08:01:53 UTC
I pushed the initial patch upstream.

https://github.com/libguestfs/libguestfs/commit/b11b870166b7ae27f728dbb58b6498788bf97329

NB: this does not support any RHV targets.  Also the bug
for RHV support has been closed, so I am going to move
this to RHEL 7.7.

Comment 7 Pino Toscano 2019-01-17 12:07:12 UTC
This bug will be fixed by the rebase scheduled for RHEL 7.7, see bug 1621895.

Comment 9 mxie@redhat.com 2019-02-26 10:09:58 UTC
Test the bug with below builds:
virt-v2v-1.40.2-1.el7.x86_64
libguestfs-1.40.2-1.el7.x86_64
virtio-win-1.9.6-1.el7.noarch
libvirt-4.5.0-10.el7_6.4.x86_64
qemu-kvm-rhev-2.12.0-18.el7_6.3.x86_64

Background:
According to the patch in comment5, have below conclusion:
1.virt-v2v can't write genid in guest xml after conversion if convert guest from VMware via vpx because of bug1598348
2.Virt-v2v only support to write the genid to libvirt (‘-o libvirt’, ‘-o local’) and QEMU (‘-o qemu’).
3.Virt-v2v are missing support currently for all OVF-based formats (hence ‘-i ova’, and all oVirt/RHV output modes).


Steps:
1.Mount the nfs storage which stores the guest images of VMware hosts on virt-v2v conversion server


2.Found some windows guests have both vm.genid and vm.genidX, some windows guests have only vm.genidX, and some windows guests have no vm.genid info in vmx. Besides, the genid existing status for same windows guest may have different result in different ESXi hosts.For example,vmx file of win2016 guest has only vm.genidX on ESXi6.7; vmx file of win2016 guest has both vm.genid and vm.genidX on ESXi6.5; vmx file of win2016 guest has no any info about vm.genid on ESXi5.5.


3.Using v2v to convert a windows guest which have both vm.genid and vm.genidX in vmx to libvirt managed by kvm 
# cat esx6.7-win2019-x86_64/esx6.7-win2019-x86_64.vmx |grep "genid"
vm.genid = "-8536691797830587195"
vm.genidX = "-1723453263670062919"
# virt-v2v -i vmx esx6.7-win2019-x86_64/esx6.7-win2019-x86_64.vmx -of qcow2

3.1 Check guest libvirtxml after v2v conversion, there is genid attribute in the xml
# virsh dumpxml esx6.7-win2019-x86_64
<domain type='kvm'>
  <name>esx6.7-win2019-x86_64</name>
  <uuid>ed32d2d1-bf7d-474c-a278-7240ce312ab3</uuid>
  <genid>09512cc5-940a-8987-b950-f54f631015e8</genid>
  ....

3.2 Power on guest after finishing conversion, checkpoints of guest are passed 


4.Using v2v to convert a windows guest which only have vm.genidX in vmx to libvirt managed by kvm 
# cat esx6.7-win10-x86_64/esx6.7-win10-x86_64.vmx |grep "genid"
vm.genidX = "659290513475213646"
# virt-v2v -i vmx esx6.7-win10-x86_64/esx6.7-win10-x86_64.vmx -of qcow2

4.1 Check guest libvirtxml after v2v conversion, there is no genid attribute in the xml
# virsh dumpxml esx6.7-win10-x86_64
<domain type='kvm'>
  <name>esx6.7-win10-x86_64</name>
  <uuid>e6115ffb-9a63-4285-ac9f-888f7441c675</uuid>
  <metadata>
....

4.2 Power on guest after finishing conversion, checkpoints of guest are passed 


5.Using v2v to convert a windows guest which has no any vm.genid in vmx to libvirt managed by kvm 
# cat esx5.5-win2012R2-x86_64/esx5.5-win2012R2-x86_64.vmx |grep "genid"
nothing
# virt-v2v -i vmx esx5.5-win2012R2-x86_64/esx5.5-win2012R2-x86_64.vmx -of raw -n default

5.1 Check guest libvirtxml after v2v conversion, there is no genid attribute in the xml
# virsh dumpxml esx5.5-win2012r2-x86_64
<domain type='kvm'>
  <name>esx5.5-win2012r2-x86_64</name>
  <uuid>5c889b8d-8480-460e-88dc-426fa433464d</uuid>
  <metadata>

5.2 Power on guest after finishing conversion, checkpoints of guest are passed 


Result:
    As Pino said in mail, at the moment virt-v2v gets the VM Generation ID from a vmx file only when both vm.genid and vm.genidX are present. If any of them is
missing, then virt-v2v cannot get the VM Generation ID.

Comment 10 Richard W.M. Jones 2019-04-01 09:03:49 UTC
> As Pino said in mail, at the moment virt-v2v gets the VM Generation ID from a vmx file only when both
> vm.genid and vm.genidX are present. If any of them is
> missing, then virt-v2v cannot get the VM Generation ID.

Generation ID is a 128 bit quantity represented in the VMX file as two numbers
(because the VMX file can only represent 64 bit numbers so it needs two entries).
If either of these numbers is missing then the file is malformed.

For more information about the craziness of gen ID and VMX see:

https://lists.nongnu.org/archive/html/qemu-devel/2018-07/threads.html#01505

Comment 11 mxie@redhat.com 2019-04-12 10:33:34 UTC
Verify the bug with below builds:
virt-v2v-1.40.2-2.el7.x86_64
libguestfs-1.40.2-2.el7.x86_64
libguestfs-winsupport-7.2-3.el7.x86_64
libvirt-4.5.0-12.el7.x86_64
qemu-kvm-rhev-2.12.0-26.el7.x86_64
nbdkit-1.8.0-1.el7.x86_64
virtio-win-1.9.7-0.el7.noarch

Background:
According to the patch in comment5, have below conclusion:
1.virt-v2v can't write genid in guest xml after conversion if convert guest from VMware via vpx because of bug1598348
2.Virt-v2v only support to write the genid to libvirt (‘-o libvirt’, ‘-o local’) and QEMU (‘-o qemu’).
3.Virt-v2v are missing support currently for all OVF-based formats 


Steps:
1.Mount the nfs storage which stores the guest images of VMware hosts on virt-v2v conversion server

2.Using v2v to convert a windows guest which have both vm.genid and vm.genidX in vmx to libvirt managed by kvm 
# cat esx6.5-win2016-2disks/esx6.5-win2016-2disks.vmx  |grep "genid"
vm.genidX = "-4858700651582282650"
vm.genid = "-2144555969512634447"

# virt-v2v -i vmx esx6.5-win2016-2disks/esx6.5-win2016-2disks.vmx  -of qcow2


2.1 Check guest libvirtxml after v2v conversion, there is genid attribute in the xml
# virsh dumpxml esx6.5-win2016-2disks
<domain type='kvm'>
  <name>esx6.5-win2016-2disks</name>
  <uuid>48b2df53-261a-491f-8531-93e962d3ad0e</uuid>
  <genid>444187b1-01b5-e23d-66a4-7af87f6d92bc</genid>
  ....

2.2 Power on guest after finishing conversion, checkpoints of guest are passed 


3.Using v2v to convert a windows guest which only have vm.genidX in vmx to libvirt managed by kvm 
# cat esx6.7-win2012r2-x86_64/esx6.7-win2012r2-x86_64.vmx |grep "genid"
vm.genidX = "-1745522437653745503"

# virt-v2v -i vmx esx6.7-win2012r2-x86_64/esx6.7-win2012r2-x86_64.vmx -of raw -os preallocated


3.1 Check guest libvirtxml after v2v conversion, there is no genid attribute in the xml
# virsh dumpxml esx6.7-win2012r2-x86_64
<domain type='kvm'>
  <name>esx6.7-win2012r2-x86_64</name>
  <uuid>43448f64-54c3-4a49-98f4-2e4b9273964b</uuid>
....

3.2 Power on guest after finishing conversion, checkpoints of guest are passed 


4.Using v2v to convert a windows guest which has no any vm.genid in vmx to libvirt managed by kvm 
# cat esx6.7-win2008r2-x86_64/esx6.7-win2008r2-x86_64.vmx |grep "genid"
nothing

# virt-v2v -i vmx esx6.7-win2008r2-x86_64/esx6.7-win2008r2-x86_64.vmx -of raw 

4.1 Check guest libvirtxml after v2v conversion, there is no genid attribute in the xml
# virsh dumpxml esx6.7-win2008r2-x86_64
<domain type='kvm'>
  <name>esx6.7-win2008r2-x86_64</name>
  <uuid>b1179d50-73b7-46a6-9dee-bd8f57d86f14</uuid>
....
4.2 Power on guest after finishing conversion, checkpoints of guest are passed 


Result:
   virt-v2v gets the VM Generation ID from a vmx file only when both vm.genid and vm.genidX which is expected result, so move the bug from ON_QA to VERIFIED

Comment 13 errata-xmlrpc 2019-08-06 12:44:11 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://access.redhat.com/errata/RHEA-2019:2096


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