the vix api - vmware virtualization for desktop & server, public

36
The VIX API Dawson Dean and Matt LaMantia

Upload: others

Post on 12-Sep-2021

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The VIX API - VMware Virtualization for Desktop & Server, Public

The VIX API

Dawson Dean and Matt LaMantia

Page 2: The VIX API - VMware Virtualization for Desktop & Server, Public

Agenda

What is the VIX API?Use CasesAPI overviewConclusion

Page 3: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 4: The VIX API - VMware Virtualization for Desktop & Server, Public

What Products does VIX Support?

Server 1.0Workstation 6.0 (currently in beta)

6.0

Beta now!

Page 5: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 6: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 7: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 8: The VIX API - VMware Virtualization for Desktop & Server, Public

Agenda

What is the VIX API?Use CasesAPI overviewConclusion

Page 9: The VIX API - VMware Virtualization for Desktop & Server, Public

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!

Page 10: The VIX API - VMware Virtualization for Desktop & Server, Public

Example: IDE integration

Both Visual Studio and Eclipse

Page 11: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 12: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 13: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 14: The VIX API - VMware Virtualization for Desktop & Server, Public
Page 15: The VIX API - VMware Virtualization for Desktop & Server, Public
Page 16: The VIX API - VMware Virtualization for Desktop & Server, Public
Page 17: The VIX API - VMware Virtualization for Desktop & Server, Public
Page 18: The VIX API - VMware Virtualization for Desktop & Server, Public
Page 19: The VIX API - VMware Virtualization for Desktop & Server, Public
Page 20: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 21: The VIX API - VMware Virtualization for Desktop & Server, Public

Agenda

What is the VIX API?Use CasesAPI overviewConclusion

Page 22: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 23: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 24: The VIX API - VMware Virtualization for Desktop & Server, Public

Basic Handle Operations

AddRef and ReleaseGetHandleTypeGetPropertyType (metadata)GetProperties, SetPropertiesSubscribe, unsubscribe to events

Page 25: The VIX API - VMware Virtualization for Desktop & Server, Public

Basic Host Operations

Connect, DisconnectLocal or remote hostWorkstation, Server

Register and Unregister VMsOnly on server

FindItemsFind running VMs

PumpEvents

Page 26: The VIX API - VMware Virtualization for Desktop & Server, Public

Basic VM Operations

OpenPower operations

PowerOn, Off, Suspend, ResetDeleteSnapshots

Create, revert, delete, get Misc.

UpgradeVirtualHardware, InstallTools

Page 27: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 28: The VIX API - VMware Virtualization for Desktop & Server, Public

Basic Job Operations

WaitCheckCompletionGetErrorStatus

Page 29: The VIX API - VMware Virtualization for Desktop & Server, Public

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, …);

Page 30: The VIX API - VMware Virtualization for Desktop & Server, Public

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);

Page 31: The VIX API - VMware Virtualization for Desktop & Server, Public

Shell Sample Code – Run a Program in the Guest

vmrun runProgramInGuest -gu <guest-user> -gp <guest-password> c:\vm\myVM.vmx c:\program.exe

Page 32: The VIX API - VMware Virtualization for Desktop & Server, Public

Agenda

What is the VIX API?Use CasesAPI overviewConclusion

Page 33: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 34: The VIX API - VMware Virtualization for Desktop & Server, Public

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]

Page 35: The VIX API - VMware Virtualization for Desktop & Server, Public

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

Page 36: The VIX API - VMware Virtualization for Desktop & Server, Public

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.