Bug 1292437 - Backport virt-v2v pull dcpath from libvirt <vmware:datacenterpath>
Backport virt-v2v pull dcpath from libvirt <vmware:datacenterpath>
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.2
Unspecified Unspecified
high Severity urgent
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
V2V
: ZStream
Depends On: 1218766 1263574
Blocks: 1292096 1292438 1305489 1305526
  Show dependency treegraph
 
Reported: 2015-12-17 07:58 EST by Shahar Havivi
Modified: 2016-11-03 13:57 EDT (History)
12 users (show)

See Also:
Fixed In Version: libguestfs-1.32.2-2.el7
Doc Type: Enhancement
Doc Text:
The virt-v2v utility now processes the "<vmware:datacenterpath>" tag, newly added to the domain XML file by the libvirt library, and maps the paths to the disk image on a VMware vCenter server. This allows for accessing disk images on the VMware vCenter server without the need for the "--dcpath" command-line option.
Story Points: ---
Clone Of:
: 1292438 1305526 (view as bug list)
Environment:
Last Closed: 2016-11-03 13:57:10 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)

  None (edit)
Description Shahar Havivi 2015-12-17 07:58:22 EST
When having vmware with cluster ie: vpx://admini@1.1.1.1/DataCenter/cluster/2.2.2.2?no_verify=1

virt-v2v fail on fetching images with the following error:
Actions failed with "HTTP/1.1 404 Not Found" log error.
Comment 1 Richard W.M. Jones 2015-12-17 08:02:07 EST
Need to backport this commit to RHEL 7.2:
https://github.com/libguestfs/libguestfs/commit/ffea9f97926efc45c894a113b65b2ff467d91b04
Comment 10 mxie@redhat.com 2016-02-26 04:58:48 EST
Verify the bug with the builds:
libvirt-1.3.1-1.el7.x86_64
libguestfs-1.32.2-6.el7.x86_64
virt-v2v-1.32.2-6.el7.x86_64
qemu-kvm-rhev-2.3.0-31.el7.x86_64

Steps:

Check virt-v2v manual page:
--dcpath Folder/Datacenter
           NB: You don't need to use this parameter if you have
           libvirt ≥ 1.2.20.

           For VMware vCenter, override the "dcPath=..." parameter used to
           select the datacenter.  Virt-v2v can usually calculate this from
           the "vpx://" URI, but if it gets it wrong, then you can override it
           using this setting.  Go to your vCenter web folder interface, eg.
           "https://vcenter.example.com/folder" (without a trailing slash),
           and examine the "dcPath=" parameter in the URLs that appear on this
           page.

Result:
--dcpath is not needed if libvirt ≥ 1.2.20

Scenario1:
1. Setting up some folder structure in vCenter.  In vCenter I added this:

  v2v-vcenter
  -> Folder(my is called mxie)
     -> Datacenter(my is called mxie-data)
        -> Cluster(my is called mxie-cluster)
           -> vmware [ESXi node]


2. Check dcpath in libvirt xml 

2.1#virsh -c vpx://root@10.66.145.47/mxie/mxie-data/mxie-cluster/10.66.144.40/?no_verify=1 
Enter root's password for 10.66.145.47: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
 Id    Name                           State
----------------------------------------------------
 164   VMware-vcenter-server-app      running
 -     app_vcenter600                 shut off
 -     Auto-esx6.0-win7-efi           shut off
 -     bug1260689-win2008R2-GPO-Macfee shut off
 [etc]

2.2 virsh # dumpxml rhel6.7-mxie
<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>rhel6.7-mxie</name>
  <uuid>423f07c2-18f5-6830-09bd-bff8e75c2f9b</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <shares>1000</shares>
  </cputune>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <source file='[datastore1] rhel6.7-mxie/rhel6.7-mxie.vmdk'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='scsi' index='0' model='vmpvscsi'/>
    <interface type='bridge'>
      <mac address='00:50:56:bf:c1:73'/>
      <source bridge='VM Network'/>
      <model type='vmxnet3'/>
    </interface>
    <video>
      <model type='vmvga' vram='8192'/>
    </video>
  </devices>
  <vmware:datacenterpath>mxie/mxie-data</vmware:datacenterpath>
</domain>

Result:dcpath=mxie/mxie-data

3.Run virt-v2v command to convert a guest without --dcpath

# virt-v2v -ic vpx://root@10.66.145.47/mxie/mxie-data/mxie-cluster/10.66.144.40/?no_verify=1 rhel6.7-mxie --password-file /tmp/passwd
[   0.0] Opening the source -i libvirt -ic vpx://root@10.66.145.47/mxie/mxie-data/mxie-cluster/10.66.144.40/?no_verify=1 rhel6.7-mxie
[   1.0] Creating an overlay to protect the source from being modified
[   2.0] Initializing the target -o libvirt -os default
[   2.2] Opening the overlay
[ 101.9] Inspecting the overlay
[ 214.8] Checking for sufficient free disk space in the guest
[ 214.8] Estimating space required on target for each disk
[ 214.8] Converting Red Hat Enterprise Linux Server release 6.7 Beta (Santiago) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 693.2] Mapping filesystem data to avoid copying unused and blank areas
[ 694.1] Closing the overlay
[ 694.2] Checking if the guest needs BIOS or UEFI to boot
[ 694.2] Assigning disks to buses
[ 694.2] Copying disk 1/1 to /var/lib/libvirt/images/rhel6.7-mxie-sda (raw)
    (100.00/100%)
[ 899.8] Creating output metadata
Pool default refreshed

Domain rhel6.7-mxie defined from /tmp/v2vlibvirt17d9e9.xml

[ 899.9] Finishing off


Scenario2:
1. Setting up some structure in vCenter.  In vCenter I added this:

  v2v-vcenter
     -> Datacenter(my is called mxie-data)
        -> Cluster(my is called mxie-cluster)
           -> vmware [ESXi node]


2. Check dcpath in guest xml 

2.1 #virsh -c vpx://root@10.66.145.47/mxie-data/mxie-cluster/10.66.144.40/?no_verify=1 
Enter root's password for 10.66.145.47: 
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh # list --all
 Id    Name                           State
----------------------------------------------------
 164   VMware-vcenter-server-app      running
 -     app_vcenter600                 shut off
 -     Auto-esx6.0-win7-efi           shut off
 -     bug1260689-win2008R2-GPO-Macfee shut off
 [etc]

2.2 virsh # dumpxml rhel6.7-mxie
<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>rhel6.7-mxie</name>
  <uuid>423f07c2-18f5-6830-09bd-bff8e75c2f9b</uuid>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <cputune>
    <shares>1000</shares>
  </cputune>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <source file='[datastore1] rhel6.7-mxie/rhel6.7-mxie.vmdk'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='scsi' index='0' model='vmpvscsi'/>
    <interface type='bridge'>
      <mac address='00:50:56:bf:c1:73'/>
      <source bridge='VM Network'/>
      <model type='vmxnet3'/>
    </interface>
    <video>
      <model type='vmvga' vram='8192'/>
    </video>
  </devices>
  <vmware:datacenterpath>mxie-data</vmware:datacenterpath>
</domain>

Result:dcpath=mxie-data

3.Run virt-v2v command to convert a guest without --dcpath
# virt-v2v -ic vpx://root@10.66.145.47/mxie-data/mxie-cluster/10.66.144.40/?no_verify=1 rhel6.7-mxie -o null --password-file /tmp/passwd
[   0.0] Opening the source -i libvirt -ic vpx://root@10.66.145.47/mxie-data/mxie-cluster/10.66.144.40/?no_verify=1 rhel6.7-mxie
[   0.9] Creating an overlay to protect the source from being modified
[   1.8] Initializing the target -o null
[   1.8] Opening the overlay
[  17.0] Inspecting the overlay
[ 129.3] Checking for sufficient free disk space in the guest
[ 129.3] Estimating space required on target for each disk
[ 129.3] Converting Red Hat Enterprise Linux Server release 6.7 Beta (Santiago) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[ 606.0] Mapping filesystem data to avoid copying unused and blank areas
[ 606.9] Closing the overlay
[ 606.9] Checking if the guest needs BIOS or UEFI to boot
[ 606.9] Assigning disks to buses
[ 606.9] Copying disk 1/1 to /var/tmp/null.2aEIMp/sda (raw)
    (100.00/100%)
[ 823.6] Creating output metadata
[ 823.6] Finishing off

Result now :
Conversion is  finished without error, so virt-v2v could pull dcpath from libvirt xml <vmware:datacenterpath>

So move the bug from ON_QA to VERIFIED
Comment 12 errata-xmlrpc 2016-11-03 13:57:10 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.