Introduction to the VIX API |
|
The VIX API allows users to automate virtual machine operations on VMware Server or VMware Workstation.
The VIX API (also known as "Vix") is an API that lets users write scripts and programs to manipulate virtual machines. It is high-level, easy to use, and practical for both script developers and application programmers. The VIX API is designed for three kinds of users:
The VIX API runs on Microsoft Windows (Win95 or later) and Linux platforms (kernel 2.4.x or later recommended). This release supports clients written in C, Perl, and COM.
This release of the VIX API is compatible with VMware Server and VMware Workstation 6.x.
The library location is not important if you use the wrapper library as recommended.
Version 1.x of the VIX API supports Vix clients written to version 1.0 of the VIX API, excepting features present in VMware Server that are not present in VMware Workstation (such as registration of virtual machines). Vix libraries installed with VMware Workstation 6.x provide the 1.x versions of the VIX API.
Vix libraries installed with VMware Server 1.0 provide the 1.0 version of the VIX API, which does not support a number of new functions available with versions 1.x of the VIX API. Consequently, the following limitations exist when using version 1.0 of the VIX API:
For instructions on installing Vix libraries on standalone clients, refer to Installing the VIX API.
The VIX API provides 64-bit libraries for Linux clients only. Windows clients can compile only 32-bit libraries in this release.
As noted in the End User License Agreement, the VIX API allows you to build and distribute your own client applications. To facilitate this, the following files are designated as redistributable for the purpose of that agreement:
Redistribution of the open source libraries included with the VIX API is governed by their respective open source license agreements.
The VIX API also includes some sample code, which you may use as a starting point for your own programs. This is included in the Samples directory installed with the VIX API.
Vix is easy to install. It includes components for both client and server. With VMware Server, the client can be a virtual machine. VMware Workstation acts as client and server.
To install the VIX API client files, do the following steps as the root user
wget http://www.vmware.com/downloads/ws/VMware-vix-xxx-nnnnn.i386.tar.gz
tar zxf VMware-vix-xxx-nnnnn.i386.tar.gz
cd vmware-vix-distrib/
./vmware-install.pl
less /usr/share/doc/vmware-vix/EULA
To uninstall the VIX API, run the vmware-uninstall-vix.pl script. By default, the uninstaller is at /usr/bin/vmware-uninstall-vix.pl.
If you are using older client libraries, VMware recommends that you upgrade your client libraries using the standalone installer. The standalone installer provides a current version of the wrapper library, which allows clients to communicate with any VIX API server, regardless of version.
If you choose not to use the wrapper library, you need to link your clients to a Vix library file that matches the version of the server. If your client communicates with more than one server version, you need to change the dynamic library linkage whenever you run the client with a different server version.
The standalone installer does not remove the old client library file. By default, the old library file was installed at /usr/lib/libvmware-vix.so.0. The wrapper library dynamically links to the old library file when you call VixHost_Connect() specifying VIX_SERVICEPROVIDER_VMWARE_SERVER. If you specify VIX_SERVICEPROVIDER_VMWARE_WORKSTATION, the wrapper library dynamically links to the new library file. The new library file is selected by the installer to match the architecture of the client machine. You can find it from a symlink, which is installed by default at /usr/lib/vmware-vix/lib/libvix.so.
You should replace the older header files (vix.h and vm_basic_types.h from version 1.0) with the newer header files, and compile those into your client. You can get copies of the newer header files from a host with Workstation 6 installed. By default, the header files are installed at the following locations.
Whether or not you use the wrapper library, your clients can call only the functions supported by the server. If you communicate with an older server, you cannot use some of the functions provided by a newer server.
Vix includes a wrapper library, which enables your Vix program to work with multiple supported VMware products and versions. If you link your program with this library, it dynamically loads the appropriate Vix library to connect to the VMware product at run-time, when you call VixHost_Connect().
You can compile a Vix client with or without the wrapper library. VMware recommends that you use the wrapper library, which allows clients to communicate with any product compatible with the VIX API, regardless of version.
To compile your client code on a Microsoft Windows machine using the wrapper library, use the following steps. By default, you can find the files in the directory:
C:\Program Files\VMware\VMware VIX
#include "vix.h"
... client code here ...
If you do not use the wrapper, you need to link to the appropriate Vix libraries for the VMware product that you want your Vix client program to connect to. Workstation 6.x has the additional capability to link a debug version of the C runtime library.
To compile your client code for use with Workstation 6.x:
#include "vix.h"
... client code here ...
To compile your client code for use with Workstation 6.0:
#include "vix.h"
... client code here ...
To compile your client code for use with VMware Server 1.0:
#include "vix.h"
... client code here ...
This procedure assumes that you have installed the Vix client files in the default directories. If you made different choices during the installation, specify those directories instead.
To compile your client code with VMware Server or VMware Workstation installed:
#include "vix.h"
... client code here ...
gcc -I/usr/include/vmware-vix -o myprogram main.c \
/usr/lib/vmware-vix/lib/ws-2/32bit/libvix.so
gcc -I/usr/include/vmware-vix -o myprogram main.c \
/usr/lib/vmware-vix/lib/server-1/32bit/libvix.so