the vix api - vmware virtualization for desktop & server, public
TRANSCRIPT
The VIX API
Dawson Dean and Matt LaMantia
Agenda
What is the VIX API?Use CasesAPI overviewConclusion
What is the VIX API?
A programming interface for automating both…VM operations• Things you would do through the Workstation UIand guest operations • Making things happen inside the guest OS
VIX-basedapplication
or script
VIXLibrary
VMwareVirtualization Platform
Application
Operating SystemGuest ops
Host ops
What Products does VIX Support?
Server 1.0Workstation 6.0 (currently in beta)
6.0
Beta now!
Key Themes
Simplicity The API is smallWorks with VMware Workstation. Requires no special infrastructure
Focus on what customers use VMs forPower operationsSnapshot operationsRun a program in the guest OSCopy files between host and guest OS
Language and platform independentC, Perl, shellCOM (coming soon)
Asynchronous, but easy to use synchronously
Comparison to Other VMware APIs
VIX API VI SDK vmPerl, vmCOM
Deprecated
ESX ServerGSX Server
PerlCOM
Target customer and scale
Connectivity (current)
Language bindings
Stand-alone customer – controls individual instances
VMware WorkstationVMware Server
CPerlCOM
Enterprise customer
ESX ServerVirtualCenter
Web service protocol,multiple client-side language bindings (Java, VB .net, C#, C++, Perl, Python) through third-party toolkits
Different Customers for VIX and VIM
VI SDK - Enterprise Management CustomerVMs are managed in a data center. There is always a server and a networkManagement tools for resource control, VM deployment, VM control
VIX API - Stand-alone (personal) customerVMs are unmanaged• Just files that can be copied by the userNo official list of hosts• Hosts may be added, removed, started or stopped at any time• Could be a laptop• There may be no network, and no central serverVMs may be integrated with tools like IDEsGuest OS functionality
Agenda
What is the VIX API?Use CasesAPI overviewConclusion
VIX Lets You Integrate Virtualization into Your Own Solutions
You are the innovatorsCustomers: Build tools and scripts on our APIs • meet needs not provided by our UI• automate processes in VMsISVs: Build software on top of our platform• add even more value
Full Object Model APIC, Perl, COM (VB, C#, VBScript)We use these same APIs to build our own GUIs!
Example: IDE integration
Both Visual Studio and Eclipse
Example: IDE integration
A VM becomes a runtime environment for a host application
Select and configure a VM
Write code in IDE
Select “Debug in VM”
VMware extension
Launches the selected VM
Shares a folder in the guest
Runs program via shared folder
Attaches debugger to guest process
VIX Lets You Use VMs for Special-Purpose Solutions
A VM can encapsulate a specific task, not a just “simulated computer” Each bug repro caseEach test caseEach build environmentEach untrusted applicationEach customer configuration from a support call
Change the way you work with VMsEach person can have hundreds or thousands of VM’s• Search, automation, etc.You need to do things in the guest, not just on the virtual hardware
Example: Nightly Build Script
Power on a VMSet up data files, like source code or config files
Copy data files from host to guestSet up shared folders between VM and local host
Run an application inside the VMCheck to see the application completed successfullyCopy result files back to the host
Test result files
Variations on the Scenario
Different applicationsPatch installersTest suitesA large application that requires special environmentAn untrusted application
Run it as a scriptFrom a cron jobOn demandFrom another application, like VisualStudio
Different VMsWrite on one platform, then test on every Windows OSRun Linux application as a script from windows
A VM makes any script into a self-contained environment
Agenda
What is the VIX API?Use CasesAPI overviewConclusion
Object Types
HostOne host machine – may contain several VMs
VMOne VM, running or notRepresents both the VM configuration and guest OS
JobThe state of a currently executing asynchronous operation
SnapshotThe state of one VM snapshotMay be only one, or several of these for a VM
More in future releases
Simple object model
Object Handles
All objects are opaque handlesEach handle has a “type”, VM, Team, Job, etc.Handles are reference counted
All handles have propertiesTyped Name/Value pairsNames are defined by us• There is a separate mechanism for customer metadataValue Types are integer, int64, string, bool, handle• (In the future we will add blobs)All configuration state of any handle type is available through properties
Basic Handle Operations
AddRef and ReleaseGetHandleTypeGetPropertyType (metadata)GetProperties, SetPropertiesSubscribe, unsubscribe to events
Basic Host Operations
Connect, DisconnectLocal or remote hostWorkstation, Server
Register and Unregister VMsOnly on server
FindItemsFind running VMs
PumpEvents
Basic VM Operations
OpenPower operations
PowerOn, Off, Suspend, ResetDeleteSnapshots
Create, revert, delete, get Misc.
UpgradeVirtualHardware, InstallTools
Guest OS Functions
Process OperationsRun programs on guestList processesKill a process
File OperationsCopy files between host and guestDelete files on guest or test if file exists
OtherGet and set environment variables LoginToGuest, LogoutFromGuest
Basic Job Operations
WaitCheckCompletionGetErrorStatus
C Sample Code – Run a Program in the Guest
VixError err = VIX_OK;VixHandle hostHandle, jobHandle, vmHandle;
jobHandle = VixHost_Connect(....);err = VixJob_Wait(jobHandle, ..., &hostHandle, ...);
jobHandle = VixVM_Open(hostHandle, "c:\\vm\myVM.vmx", ...);err = VixJob_Wait(jobHandle, ..., &vmHandle, ...);
jobHandle = VixVM_WaitForToolsInGuest(vmHandle, ...);err = VixJob_Wait(jobHandle, …);
jobHandle = VixVM_LoginInGuest(vmHandle, "name", "password", ...); err = VixJob_Wait(jobHandle, …);
jobHandle = VixVM_RunProgramInGuest(vmHandle, "c:\\myProgram.exe", ...);err = VixJob_Wait(jobHandle, ..., &exitCode, ...);
jobHandle = VixVM_PowerOff(vmHandle, ...);err = VixJob_Wait(jobHandle, …);
Perl Sample Code - Run a Program in the Guestuse VMware::Vix::Simple;use VMware::Vix::API::Constants;my $err;my $vmHandle;my $hostHandle;
($err, $hostHandle) = HostConnect(VIX_API_VERSION, VIX_SERVICEPROVIDER_VMWARE_SERVER,"10.17.161.143", 902, "myUserName", "myPassword",0, VIX_INVALID_HANDLE);
($err, $vmHandle) = VMOpen($hostHandle, "/vms/Red Hat Enterprise Linux 4.vmx");
$err = VMPowerOn($vmHandle, 0, VIX_INVALID_HANDLE);
$err = VMWaitForToolsInGuest($vmHandle, 10);
$err = VMLoginInGuest($vmHandle, "username", "userPassword", 0);
$err = VMRunProgramInGuest($vmHandle, "/usr/bin/X11/xclock", "-update 1", VIX_RUNPROGRAM_RETURN_IMMEDIATELY, VIX_INVALID_HANDLE);
Shell Sample Code – Run a Program in the Guest
vmrun runProgramInGuest -gu <guest-user> -gp <guest-password> c:\vm\myVM.vmx c:\program.exe
Agenda
What is the VIX API?Use CasesAPI overviewConclusion
Future Plans – You Tell Us What You Want
More functions in the guest OSWindows Registry? Environment variables? UI Windows?
More language bindingsCOM (we are currently investigating) Java? Python?
Embedding virtualization UI?Virtualization as a runtime component for apps
VM creation and configurationInsert/eject disks?Create VMs?Add or remove devices?Change a SCSI controller to IDE?
Different ProductsWorkstation, player, ESX, server?
Teams functions
We Want Your Feedback
Customer forum Ask questions, give suggestions, tell us about your use casesImmediately after this talk – follow signsJoin us for a snack!
EmailDawson Dean, technical lead: [email protected] LaMantia, manager: [email protected]
Presentation Download
Please remember to complete yoursession evaluation form
and return it to the room monitorsas you exit the session
The presentation for this session can be downloaded at http://www.vmware.com/vmtn/vmworld/sessions/
Enter the following to download (case-sensitive):
Username: cbv_rep Password: cbvfor9v9r
Some or all of the features in this document may be representative of feature areas under development. Feature commitments must not be included in contracts, purchase orders, or sales agreements of any kind. Technical feasibility and market demand will affect final delivery.