VMware APIs

Currently there are a few APIs and this post is a short summary of them.

– vSphere Web Services SDK a.k.a. VMware VI API, last version is 4.0, released May 21st, 2009.

This is a SOAP over HTTP/S protocol that exposes everything you can do on a virtual data center: configure resources, manipulate with virtual machines, retrieve events and performance metrics etc. Complex. I work with it every day.

– vCloud API, still in preview version.

RESTful web service that is kind of meta of super API for allocating an collapsing resources of VMware-software based cloud computing implementations.

– VIX API, version 1.8.1

One of the first VMware APIs I got to know. Allows simple manipulation with virtual machines. As I understand was designed for partners making agents for VMware servers console.

– vSphere Guest SDK, now in version 4. Strange, but I have always been thinking it is a brand new API.

If you code an application that for sure will be running on a virtual machine, use this API to make your product aware of it by consuming the hypervisor resource management information.

– CIM SDK (SMASH, SMI-S) latest version is here.

If you don’t know what CIM is, this SDK won’t help you, if you do, then you don’t need anybody to tell you what you use it for.

– Also there are Chargeback, vNetwork, SNMP MIB, VDDK and little more that is of a special interest of a very special kind of people who I doubt ever read this blog.

Good summary document at VMware web site.

How to run Java samples from VMware SDK

VMware SDK a.k.a. vSphere Web Services SDK 4.0 comes with Java and C# samples. This is what it took me to get them running on Ubuntu 8.10.

1. Download the SDK from vmware.com into a separate directory:

> mkdir vi-sdk-4.0.0-161137

2. Install Java and Axis:

> apt-get install sun-java5-bin sun-java5-demo sun-java5-doc \
sun-java5-fonts sun-java5-jdk sun-java5-jre sun-java5-plugin \
tofrodos
> wget http://apache.raffsoftware.com/ws/axis/1_4/axis-bin-1_4.tar.gz
> tar xzf axis-bin-1_4.tar.gz
> ln -s /home/dmitri/projects/vi-sdk-4.0.0-161137/SDK/ visdk

3. Setup environment variables:

export AXISHOME=~/apps/apache/axis/
export JAVAHOME=~/apps/java/jdk1.5.0_19/
export SDKHOME=~/apps/visdk/
export WBEMHOME=${SDKHOME}samples/Axis/java/lib/wbem.jar
PATH=${PATH}:${AXISHOME}/bin:${JAVAHOME}\bin
export PATH
CLASSPATH=${CLASSPATH}:${AXISHOME}lib/axis.jar:\
${AXISHOME}lib/axis-ant.jar:\
${AXISHOME}lib/commons-discovery-0.2.jar:\
${AXISHOME}lib/commons-logging-1.0.4.jar:\
${AXISHOME}lib/jaxrpc.jar:${AXISHOME}lib/log4j-1.2.8.jar:\
${AXISHOME}lib/saaj.jar:${AXISHOME}lib/wsdl4j-1.5.1.jar:\
${JAVAHOME}lib/tools.jar:${SDKHOME}samples/Axis/java/vim.jar:\
${SDKHOME}samples/Axis/java/vim25.jar:\
${SDKHOME}samples/Axis/java/apputils.jar:\
${SDKHOME}samples/Axis/java/samples.jar:\
${SDKHOME}samples/Axis/java/lib/activation.jar:\
${SDKHOME}samples/Axis/java/lib/mailapi.jar:\
${SDKHOME}samples/Axis/java/lib/wbem.jar
export CLASSPATH

4. Build the samples following the Setup Guide

> cd %SDKHOME%\samples\Axis\java
> ./build.sh

5. Run the samples:

>./run.sh com.vmware.samples.general.SimpleClient --url https://123.45.67.89/sdk \
--username admin --password password

6. Pat yourself on the back.