Getting Started |
|
The VIX API allows you to automate virtual machine operations on VMware Server or VMware Workstation.
The VIX API (or "Vix") is a library for writing 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 (Windows95 or later) and Linux platforms (kernel 2.4.x or later recommended). It supports programs written in C, Perl, and COM (Visual Basic, VBscript, C#).
This release of the VIX API is compatible with VMware Server 2.0 and VMware Workstation 6.5.
The library location is not important if you use the wrapper library as recommended.
Vix Version 1.x supports programs written to version 1.x of the VIX API. Exceptions are noted on function reference pages. For example, VMware Server does not support record and replay, while VMware Workstation does not support virtual machine registration.
Vix libraries are installed with VMware Server and VMware Workstation and provide API compatibility corresponding to the product release. Vix libraries are downward compatible in most cases. If you upgrade VMware Server or VMware Workstation, you should also upgrade any separately installed Vix libraries. For instructions, see Installing the VIX API. You should also upgrade VMware Tools to match the product release.
With VMware Server, you can run Vix programs remotely. With VMware Workstation, Vix programs usually run on the host.
The VIX API provides 64-bit libraries for Linux only. Windows 32-bit libraries may work in 64-bit emulation mode.
As noted in the End User License Agreement, the VIX API allows you to build and distribute your own 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 sample code, which you can use as a starting point for your own programs. Code is delivered in the Samples directory installed with VMware VIX. A Makefile is provided for Linux, and an nMakefile for Windows.
On the VMware Server or VMware Workstation host, you do not need to install any additional VIX API components. Vix libraries are installed by default under “VMware VIX” or vmware-vix. To compile programs on these systems, see Compiling Vix Programs.
To control VMware Server remotely from another machine, you need header files vix.h and vm_basic_types.h, as well as one or more library files. You can get these files in one of two ways:
To install the VIX API files on Linux:
wget http://www.vmware.com/downloads/server/VMware-vix-110068.i386.tar.gz
sudo tar zxpf VMware-vix-110068.i386.tar.gz
cd vmware-vix-distrib
sudo ./vmware-install.pl
To uninstall the VIX API, run the vmware-uninstall-vix.pl script. The uninstaller is at /usr/bin/vmware-uninstall-vix.pl by default.
If you are using older Vix libraries, VMware recommends that you upgrade those libraries using the standalone installer. The standalone installer provides a current version of the wrapper library, which allows programs to communicate with any Vix library, regardless of version or target architecture. The wrapper library dynamically loads appropriate library files at connection time.
Otherwise you must link your program to a Vix library that matches the server version. This gets inconvenient if your program communicates with more than one version of the server.
VMware Tools in virtual machines should be kept up-to-date with the VMware version on the host. When upgrading, also update VMware Tools in all guest operating systems. The VIX API relies on a current matching version of VMware Tools to perform many operations.
Upgrading the Vix libraries replaces the older header files, vix.h and vm_basic_types.h with newer header files. The header files are installed at the following locations by default:
Whether or not you use the wrapper library, your programs may call only the functions supported by the host. If you communicate with an older host, you cannot use newer features.
On Windows, the sample programs are installed in C:\Program Files\VMware\VMware VIX\Samples by default. An nMakefile is provided to compile all sample programs using nmake and the Visual Studio C compiler.
On Linux, the sample programs are installed in /usr/share/doc/vmware-vix/VMwareVix/samples/ by default. A Makefile is provided to compile all sample programs using make and the GNU C compiler.
Vix includes a wrapper library, which enables Vix programs to work with multiple supported VMware products and versions. If you link your program with this library, it dynamically loads the appropriate Vix library for a VMware product at runtime, during the VixHost_Connect() call.
VMware recommends that you use the wrapper library, although you can compile Vix programs without it.
To use the wrapper library with VIX 1.6, you need Visual Studio 2005 (Visual C release 8.0) or later. To compile code on Windows using the wrapper library, use the following procedure. Files are in the C:\Program Files\VMware\VMware VIX folder.
#include "vix.h"
... program code here ...
This procedure assumes that you have installed Vix components in the default directories. If you made different choices during the installation, specify your directory choices instead.
If you do not use the wrapper, you need to link the appropriate Vix libraries for the VMware product to which your Vix program connects. Workstation 6.5 is able to link a debug version of the C runtime library.
To compile your code for use with Workstation 6.5:
#include "vix.h"
... program code here ...
To compile your code for use with Workstation 6.0.x:
#include "vix.h"
... program code here ...
To compile your code for use with VMware Server 1.0:
#include "vix.h"
... program code here ...
To compile your code with VMware Server or VMware Workstation installed:
#include "vix.h"
... program code here ...
gcc -I/usr/include/vmware-vix -o vixapp vixapp.c /usr/lib/vmware-vix/Workstation-6.5.0/32bit/libvix.so
gcc -I/usr/include/vmware-vix -o vixapp vixapp.c /usr/lib/vmware-vix/lib/VIServer-2.0.0/32bit/libvix.so
gcc -I/usr/include/vmware-vix -o vixapp vixapp.c /usr/lib/vmware-vix/lib/server-1/32bit/libvix.so