[libvirt] [PATCH v2] vmx: Expose VMware Managed Object Reference (moref) in XML.

Michal Privoznik mprivozn at redhat.com
Mon Sep 4 08:46:02 UTC 2017


On 09/01/2017 01:06 PM, Richard W.M. Jones wrote:
> 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.
> ---
>  src/esx/esx_driver.c |  7 +++++++
>  src/esx/esx_vi.c     | 13 +++++++++++++
>  src/esx/esx_vi.h     |  4 ++++
>  src/vmx/vmx.c        | 43 +++++++++++++++++++++++++++++++++----------
>  src/vmx/vmx.h        |  2 ++
>  5 files changed, 59 insertions(+), 10 deletions(-)

ACK

Michal




More information about the libvir-list mailing list