Bug 1257895 - [RHEV][V2V] virt-v2v ignores NIC if interface source/@network or source/@bridge is an empty string
Summary: [RHEV][V2V] virt-v2v ignores NIC if interface source/@network or source/@brid...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.2
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-28 10:59 UTC by Anand Nande
Modified: 2019-08-15 05:15 UTC (History)
7 users (show)

Fixed In Version: libguestfs-1.28.1-1.50.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 07:03:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2183 0 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-11-19 08:18:42 UTC

Description Anand Nande 2015-08-28 10:59:11 UTC
Created attachment 1067953 [details]
v2v-debug log

Description of problem:

Customer already tried to use the 'Tech Preview' version contained in the Richard Jones' repository [1] with no success. The result is  the imported vm doesn't have a vNic even if it was present on the vmware side.

These are the package versions installed in our v2v-proxy host:

rpm -qa | egrep 'virt-v2v|libvirt*|libguest*' | sort
libguestfs-1.28.1-1.49.el7.x86_64
libguestfs-tools-c-1.28.1-1.49.el7.x86_64
libguestfs-winsupport-7.2-1.el7.x86_64
libvirt-client-1.2.17-3.el7.x86_64
libvirt-daemon-1.2.17-3.el7.x86_64
libvirt-daemon-driver-interface-1.2.17-3.el7.x86_64
libvirt-daemon-driver-network-1.2.17-3.el7.x86_64
libvirt-daemon-driver-nodedev-1.2.17-3.el7.x86_64
libvirt-daemon-driver-nwfilter-1.2.17-3.el7.x86_64
libvirt-daemon-driver-qemu-1.2.17-3.el7.x86_64
libvirt-daemon-driver-secret-1.2.17-3.el7.x86_64
libvirt-daemon-driver-storage-1.2.17-3.el7.x86_64
libvirt-daemon-kvm-1.2.17-3.el7.x86_64
libvirt-glib-0.1.7-3.el7.x86_64
libvirt-python-1.2.8-7.el7_1.1.x86_64
virt-v2v-1.28.1-1.49.el7.x86_64

Now the v2v conversion of a rhel5 vm ends successfully but during the import phase on the RHEV side, the vm doesn't have a vnic and we had to manually create it. It also happens during the conversion of a rhel6 .

This is the command we used to launch the v2v conversion:

virt-v2v -ic 'vpx://EXAMPLE%5Cuser@vcenter/DATACENTER/CLUSTER/esxi-02.example.local?no_verify=1';  TEST-V2V-RHEL5 -o rhev -os netapp:/vol/L_RHEV_IMP_EXP_vol --network rhevm

Customer relaunced again a v2v conversion with the debug option enabled (-v switch). Output attached to the bug and the vmx file which describes the origin VM on the vmware side (before the conversion to the libvirt xml format)

How reproducible: Always

Steps to Reproduce:
1. On the v2v conversion server:

# virt-v2v -ic 'vpx://EXAMPLE%5Cuser@vcenter/DATACENTER/CLUSTER/esxi-02.example.local?no_verify=1';  TEST-V2V-RHEL5 -o rhev -os netapp:/vol/L_RHEV_IMP_EXP_vol --network rhevm

2. From the RHEV EXport-Domain, import the VM 
3. Check the NetworkInterfaces of the VM. There is no vNIC attached to it.

Actual results: No vNIC attached to the imported VM.

Expected results: vNIC should be attached to the imported VM.

[1] https://www.redhat.com/archives/libguestfs/2014-May/msg00090.html

Comment 3 Richard W.M. Jones 2015-08-28 11:50:14 UTC
What's happening is the source guest has a network interface defined:

    <interface type='bridge'>
      <mac address='xx:xx:xx:xx:xx:xx'/>
      <source bridge=''/>
      <model type='vmxnet3'/>
    </interface>

but because the <source bridge=''/> attribute is an empty string
that hits a corner case in the code where it ignores the interface
completely.

Here's a small reproducer of the bug:

$ cat > vnic.xml <<"EOF"
<domain type='vmware'>
  <name>BZ1257895</name>
  <devices>
    <disk type='file' device='disk'>
      <source file='/dev/null'/>
      <target dev='sda' bus='scsi'/>
    </disk>
    <interface type='bridge'>
      <mac address='00:01:02:03:04:05:06'/>
      <source bridge=''/>
    </interface>
  </devices>
</domain>
EOF

$ virt-v2v -i libvirtxml vnic.xml -o null --print-source
[   0.0] Opening the source -i libvirtxml vnic.xml
Source guest information (--print-source option):

    source name: BZ1257895
hypervisor type: vmware
         memory: 1073741824 (bytes)
       nr vCPUs: 1
   CPU features: 
       firmware: unknown
        display: 
          sound: 
disks:
	/dev/null [scsi]
removable media:

NICs:

Notice that the 'NICs' section is empty.  It should contain 1 NIC.

Comment 4 Richard W.M. Jones 2015-08-28 13:19:43 UTC
Patches posted:

https://www.redhat.com/archives/libguestfs/2015-August/msg00159.html

Comment 5 Richard W.M. Jones 2015-08-28 13:20:33 UTC
After applying those patches, the output of the reproducer (comment 3) is:

[   0.0] Opening the source -i libvirtxml vnic.xml
Source guest information (--print-source option):

    source name: BZ1257895
hypervisor type: vmware
         memory: 1073741824 (bytes)
       nr vCPUs: 1
   CPU features: 
       firmware: unknown
        display: 
          sound: 
disks:
	/dev/null [scsi]
removable media:

NICs:
	Bridge "eth0" mac: 00:01:02:03:04:05:06

Note the "eth0" network interface has appeared.

Comment 6 Richard W.M. Jones 2015-08-29 21:17:55 UTC
Upstream commits:

00e1260d343e1f70d6541347ba61ecb072fef799
261d05749fb75e60d56d3c2d92589de9dca7ca09
18b019e3dd808393cda510b6d80212ff5bdbed76

Comment 8 tingting zheng 2015-09-08 05:28:15 UTC
I can reproduce this bug with:
libguestfs-1.28.1-1.49.el7.x86_64
virt-v2v-1.28.1-1.49.el7.x86_64

1.Prepare a guest with network source as empty.
    <interface type='network'>
      <mac address='52:54:00:22:b6:17'/>
      <source network=''/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>


# virt-v2v -o null --print-source rhel7.2
[   0.0] Opening the source -i libvirt rhel7.2
Source guest information (--print-source option):

    source name: rhel7.2
hypervisor type: kvm
         memory: 1073741824 (bytes)
       nr vCPUs: 1
   CPU features: apic,acpi
       firmware: unknown
        display: spice
          sound: ich6
disks:
	/var/lib/libvirt/images/rhel7.2.qcow2 (qcow2) [virtio]
removable media:

NICs:

2.Use virt-v2v to convert the above guest to rhev.

3.Import the guest to rhev,there is no network showed.

Tested the bug with 
libguestfs-1.28.1-1.51.el7.x86_64
virt-v2v-1.28.1-1.51.el7.x86_64

# virt-v2v -o null --print-source rhel7.2
[   0.0] Opening the source -i libvirt rhel7.2
Source guest information (--print-source option):

    source name: rhel7.2
hypervisor type: kvm
         memory: 1073741824 (bytes)
       nr vCPUs: 1
   CPU features: apic,acpi
       firmware: unknown
        display: spice
          sound: ich6
disks:
	/var/lib/libvirt/images/rhel7.2.qcow2 (qcow2) [virtio]
removable media:

NICs:
	Network "eth0" mac: 52:54:00:22:b6:17

Tried the above steps with bridge type of interface,the NICs can show network.

Use virt-v2v to convert guest to rhev,network shows in rhev GUI.

Refer to the above comments,move this bug to VERIFIED.

Comment 15 errata-xmlrpc 2015-11-19 07:03:20 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/RHBA-2015-2183.html


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