[libvirt] VMware: Map vpx:// to dcPath

Richard W.M. Jones rjones at redhat.com
Mon Sep 7 10:18:53 UTC 2015


vpx:// paths looks like this:

  vpx://vcenter.example.com/MyFolder/MyDatacenter/MyCluster/esxi

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

  https://vcenter.example.com/folder/data/guest/guest-flat.vmdk?dcPath=MyFolder/MyDatacenter&dsName=datastore

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.

So:

(1) Is there something I'm missing here?  Maybe the libvirt VMware
driver presents this information already and I'm just missing it?

(2) 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.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the libvir-list mailing list