Bug 1263574 - vpx: Include dcpath output in libvirt XML
Summary: vpx: Include dcpath output in libvirt XML
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: Virtualization Bugs
Depends On:
Blocks: TRACKER-bugs-affecting-libguestfs 952703 1154205 1236075 1256823 1292096 1292437 1305489
TreeView+ depends on / blocked
Reported: 2015-09-16 08:39 UTC by Richard W.M. Jones
Modified: 2016-11-03 18:23 UTC (History)
14 users (show)

Fixed In Version: libvirt-1.3.1-1.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 feature enables accessing disk images on the VMware vCenter server without the need for the "--dcpath" command-line option.
Clone Of:
: 1305489 (view as bug list)
Last Closed: 2016-11-03 18:23:55 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description Richard W.M. Jones 2015-09-16 08:39:32 UTC
Description of problem:

vpx:// paths looks like this:


but to connect to the datastore to read the underlying disk image,
libguestfs must form a URL like this:


All parts of this URL can be worked out from the URL or the libvirt
XML *except* the ?dcPath=... parameter.

The problem is that dcPath isn't a straight mapping from the vpx://
path.  The particular problem is that if there is a cluster name in
the path (eg 'MyCluster') it appears that we have to remove it.  ie:

  dcPath=MyFolder/MyDatacenter/MyCluster   - does not work
  dcPath=MyFolder/MyDatacenter             - works

That would be OK if there was always a cluster name at the end of the
path, but there isn't.  Clusters are completely optional, and AFAIK
you can't tell if something is a cluster path element just by
examining the name, since clusters can be given arbitrary names by the
vCenter admin.

Can we add some way to more easily map from vpx:// paths to
datastore URLs?  The whole process is very complex even without the
ambiguity - it takes a couple of pages of code to do the mapping.

A patch for this has been proposed and tested upstream:


but is not yet included upstream nor in RHEL 7.

Version-Release number of selected component (if applicable):


Additional info:


Comment 1 Richard W.M. Jones 2015-09-17 10:37:13 UTC
Pushed upstream in commit 636a99058758a0447482f3baad94de8de3ab1151.

Comment 3 Richard W.M. Jones 2015-10-09 11:55:17 UTC
Patches for libguestfs to use this field:

This feature will be available in libguestfs RHEL 7.3.  There
is no separate bug for this, since it will be picked up in the
libguestfs rebase (bug 1218766).

Comment 4 Michal Skrivanek 2015-12-17 08:57:07 UTC
is this feasible for a 7.2.z backport?

Comment 5 Richard W.M. Jones 2015-12-17 09:04:34 UTC
The libvirt patch is fairly straightforward.

It needs a libguestfs backport too, because I didn't include
the patch to virt-v2v which gets the data from libvirt.

Comment 7 Richard W.M. Jones 2015-12-17 09:46:20 UTC
It needs another bug against libguestfs.  Just backporting
the libvirt fix is not sufficient.

Comment 15 mxie@redhat.com 2016-02-26 10:06:48 UTC
Verify the bug with the build:

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

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

2.Check the dcpath of guest rhel6.7-mxie in via vCenter server's web address, eg: https://vcenter/folder

2.1 Read the underlying disk image,the URL is :  

2.2 encode URL,dcpath=mxie/mxie-data

3.Check dcpath in libvirt xml:

3.1 #virsh -c vpx://root@ 
Enter root's password for 
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
 -     rhel6.7-mxie                    shut off

3.2 Check dcpath in guest xml
virsh # dumpxml rhel6.7-mxie
<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>1</vcpu>
    <type arch='x86_64'>hvm</type>
  <clock offset='utc'/>
    <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'/>
    <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'/>
      <model type='vmvga' vram='8192'/>

Result now:
dcpath "<vmware:datacenterpath>mxie/mxie-data</vmware:datacenterpath>" has added in libvirt xml and match with the above one encoded from URL

So move the bug from ON_QA to VERIFIED

Comment 17 errata-xmlrpc 2016-11-03 18:23:55 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.


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