]> git.ipfire.org Git - thirdparty/libvirt.git/commit
vmx: Expose VMware Managed Object Reference (moref) in XML.
authorRichard W.M. Jones <rjones@redhat.com>
Fri, 25 Aug 2017 13:36:58 +0000 (14:36 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 4 Sep 2017 08:48:32 +0000 (09:48 +0100)
commit4c10c38275349805fac325b5c701c399cec0c9a3
treebec46fd3bc65e8eb80b80198927a948865162ddf
parent4ee36c33ed371a1d9dfb9cd97b2af0ee08abd3f3
vmx: Expose VMware Managed Object Reference (moref) in XML.

If you use the VDDK library to access virtual machines remotely, you
really need to know the Managed Object Reference ("moref") of the VM.
This must be passed each time you connect to the API.

For example nbdkit's VDDK plugin requires a moref to be passed to
mount up a VM's disk remotely:

 nbdkit vddk user=root password=+/tmp/rootpw \
             server=esxi.example.com thumbprint=xx:xx:xx:... \
             vm=moref=2 \
             file="[datastore1] Fedora/Fedora.vmdk"

Getting the moref is a huge pain.  To get some idea of what it is, why
it is needed, and how much trouble it is to get it, see:
https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-1-overview.html
https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-2-technical.html

However the moref is available conveniently in the internals of the
libvirt VMX driver.  This patch exposes it as a custom XML element
using the same "vmware:" namespace which was previously used for the
datacenterpath (see libvirt commit 636a99058758a044).

It appears in the XML like this:

<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>Fedora</name>
...
  <vmware:datacenterpath>ha-datacenter</vmware:datacenterpath>
  <vmware:moref>2</vmware:moref>
</domain>

Note that the moref can appear as either a simple ID (for esx://
connections) or as a "vm-<ID>" (for vpx:// connections).  It should be
treated by users as an opaque string.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
src/esx/esx_driver.c
src/esx/esx_vi.c
src/esx/esx_vi.h
src/vmx/vmx.c
src/vmx/vmx.h