Upload
alan-renouf
View
7.503
Download
0
Embed Size (px)
DESCRIPTION
Presentation given on Oct 8th in London by Preetham Gopalaswamy on the VMware APIs
Citation preview
1
London WorkshopExploring VMware APIsPreetham GopalaswamyGroup Product Manager vCenter Server and vSphere API sOctober 8, 2010 Managing Large vSphere Environments using SDKs / Po werCLI
2
Disclaimer
� This session may contain product features that are currently under development.
� This session/overview of the new technology represent s no commitment from VMware to deliver these features in any generally available product.
� Features are subject to change, and must not be inclu ded in contracts, purchase orders, or sales agreements of any k ind.
� Technical feasibility and market demand will affect final delivery.
� Pricing and packaging for any new technologies or feat ures discussed or presented have not been determined.
“THESE FEATURES ARE REPRESENTATIVE OF FEATURE AREAS UNDER DEVELOPMENT. FEATURE COMMITMENTS ARE SUBJECT TO CHA NGE, AND MUST NOT BE INCLUDED IN CONTRACTS, PURCHASE ORD ERS,OR SALES AGREEMENTS OF ANY KIND. TECHNICAL FEASIBIL ITY AND MARKET DEMAND WILL AFFECT FINAL.”
3
VMware API Overview
VMware vSphere: Foundation for Cloud Computing
vCenter vShield vCloud Director
vCloud Datacenter
vCloud Express
Spring vFabric HypericVMforce
Oher PaaSPartners
Google App Engine
Other cloud infrastructure providers
SaaSApplications
Other SaaSProviders
View Thin App Zimbra
VMware EnabledPublic Clouds
IndependentPublic Clouds
VMware End-User Computing
VMware Cloud Application Platform
VMware Cloud Infrastructure and Management
Secure Private Cloud
Virtualization/Hardware Health/Cloud API/CLI
Application API
Solution API/CLI
4
Some Much That I Can Do…
Management capabilities available in the vSphere pla tform
• Virtual Machine management
• Host configuration (storage, networking)
• Performance monitoring and management
• Events and Alarms
• Host hardware management and health monitoring
• Virtual Storage management
• Virtual machine content back-up and restore
• User management (on hosts)
• Virtual Disk manipulation
• Communication from the host to the guest
• Hypervisor information from inside the guest
5
… But Which API Do I Use?
What is your role and what are you trying to do?
• System Administrator managing a few virtualized servers
• Using the command-line to troubleshoot
• Trying to configure an aspect of your infrastructure that does not have a GUI
• Datacenter administrator in a Cloud Service Provider or large enterprise
• Automate provisioning and management of 100s of hosts and 1000s of VMs
• Monitor the hardware in your datacenter
• Software developer in an ISV or large datacenter
• Developing a management application that monitors and manages a virtual datacenter
• Testing software in multiple VMs each running different a different OS
• Creating a smart guest application that is virtualization-aware
6
Agenda
� Guiding principles
� Virtualization Management through the Web Services API
� Hardware Health Monitoring and Management (CIM SMASH)
� Automation through CLIs (vCLI, PowerCLI)
� Language Specific SDKs (Perl, .NET, Java)
� Bridging the Hypervisor and the Guest (Guest SDK, VIX)
7
Introduction
� Some core principles of the vSphere management capabil ities:
• They will be exposed by the server as a web-accessible interface
• Any SDK that is distributed by VMware will leverage one or moreof these interfaces
• All capabilities available on ESXi will also be available on ESX and through the same interfaces
• Management tools must integrate through vCenter where-ever possible
8
vSphere Web Services SDK
� Once known as the VI API
• Always available
• Secure
• Firewall friendly
• Designed for network access
• Standards based
• Governed by access control rules
Web
Service
9
vSphere Web Services SDK
� Available on ESX, ESXi, vCenterand VMware Server 2.0
� Comprehensive interface for vSpherevirtualization management
� Server (ESX/ESXi or vCenter) authentication credentials mustbe provided to access this interface
� The Web Services SDK will be refreshed each time the vSphereinterface is enhanced to include new features – typica lly duringmajor and minor vSphere releases
� This interface will maintain backward and forward c ompatibilityfor 2 releases
Web
Service
10
vSphere Web Services SDK
� Provides interfaces to do the following:
• Inventory retrieval (Hosts, VMs, Virtual Devices)
• Virtual Machine management
• Host configuration (storage, networking)
• Performance monitoring and management
� Sample utilities are included with the vSphere SDK pa ckageto demonstrate use of the APIs. We are happy to enha nce the samples based on input from our partners
� Clients can monitor the infrastructure through this API so thatthey are informed any time there is a change – through e ventsor through the PropertyCollector
� vCenter enables the creation and configuration of ala rmsin response to specific events. The response to an a larmcan be configured
Web
Service
11
Hardware Health Monitoring and Management
� Hardware asset information and health information is exposed through the standards-based CIM SMASH interface (Systems Management Architecture for Server Hardware)
� This API is accessible on the hosts through an https interface
� VMware’s implementation uses the SFCB CIMOM and the default providers that ship in-box are open-source OMC providers
� VMware supports both CIM XML over http and WSMan
� While several management tools support CIM data, not many support CIM Indications or WSEventing. So, all CIM In dications are also available as SNMP traps
� VMware partners with all its OEM vendors and IHV partners to enable them to create CIM providers that enhance the h ardware data available in vSphere
H/WHealth
12
What is CIM
� CIM stands for “Common Information Model”, an industry standard, object-oriented data modelthat provides a UML-based framework for describingmanagement data
� CIM schemas are defined in a language called Managed Object Format (MOF). The Distributed Management Task Force (D MTF)is a standards body defining the CIM Schema with ov er1000 classes and associations
� Web-based Enterprise Management (WBEM) is a set of st andards defining web-based CIM implementations. Transport bet ween the CIM server and client can be CIM XML over http/https o r WSman
� WBEM profiles define a collection of CIM elements an d rules pertaining to a specific area of management
13
Hardware Health Monitoring and Management
� CPU details
� Fan
� Battery
� Local RAID storage
� Power Supply
� Power State Management
� System logs
� System Memory
� Firmware
� Temperature Sensors
H/WHealth
14
vSphere CIM SMASH API
� vCenter includes a monitoring Service that aggregateshardware information (primarily health) from eachof the hosts that it manages
� This service exposes information to the vSphere Client through a proprietary HTML interface
� The service is also integrated with the vCenter Alarmsinfrastructure so that key hardware events can trigge r alarms
� The hardware health data is available only on the ho st. API users are encouraged to authenticate against vCenter and use the AcquireCIMTicket method to work against a host – rather t han authenticate against the host
H/WHealth
15
Hardware Health Providers
� VMware provides a set of default hardwarehealth providers
� Server and IHV partners often supply additionalhardware health providers
� Experience enhanced if you install the partners’ providers
� Providers may need to be installed separately
� Server vendors often distribute an ESXi image customized for their hardware
� Each hardware vendor (server or IHV) is responsible for dev eloping additional providers are installed if the default set of hardware health data does not give you all the information
H/WHealth
16
Command Line Interfaces
� VMware offers 2 types of command line interfaces
• vSphere CLI/vCLI – once known as RCLI or VI CLI
• PowerCLI – previously known as the VI Toolkit (for Windows) CLI
17
vCLIs
� vSphere CLI offers the capabilities previouslyavailable only on the COS (Console OperatingSystem) in Classic ESX, through a remote interface.This CLI is supported on both ESX and ESXi
� Functionally, they are mainly focused on host config uration
� Most of the vSphere CLI commands are currentlyavailable through vCenter. VMware plans to supportall of them through vCenter in a future release
� Most of the commands are Perl scripts and hence run in Linuxand Windows
� The vSphere CLI can be downloaded and installed sepa ratelyor as part of a VMware supplied virtual machine vMA (vS phere Management Assistant)
CLI
18
vCLI: The Next Generation - esxcli
� esxcli was first introduced in vSphere 4.0
� At its simplest it can be described as CLIs that run o nthe server with an XML front-end
� The CLI functionality is broken into logical namespa ceswith actions specific to each namespace. To run su ch acommand, one would say:esxcli [generic options] <namespace> <action> [specific options]
� Enables easy extensibility/upgrade of the command-li ne functionality without changing the client
� The goal is to transition all the current vCLI command s to the esxcli style in the future
CLI
19
vSphere PowerCLI
� PowerCLI offers a command-line/scripting interface tovSphere management based on Microsoft PowerShell
� VMware has created over 250 cmdlets that exposethe most common management use-cases
� Cmdlets are simple, intuitive and can be easily andelegantly chained to accomplish complex management tasks
� This product boasts of a large, extremely active user c ommunity,that is enhancing our base implementation with new s cripts that are available on the forum and at http://blogs.vmware.com/vipowershell
CLI
20
The Simple Elegance of PowerCLI
� The script below shows how one can createsnapshots for all VMs that are currently powered on
� The same task would be several 100 linesof code using the vSphere Web Services SDK(Java binding)
CLI
connect
get-vm | where {$_.powerstate eq “poweredOn”} | new-sn apshot
get-cluster -name “mycluster” | get-vmhost | Get-VMHostStorage -RescanAllHBA
disconnect
� The PowerCLI model will form the basis for all the lan guage specific SDKs that VMware will offer the ecosystem
21
vSphere [Language Specific] SDKs
� VMware offers its customers SDKs for differentprogramming languages
� The following SDKs are currently available:
• Perl (previously known as the VI Perl Toolkit)
• .NET (available as part of the PowerCLI)
• Java (now available as a Technology preview)
� These SDKs define a client-side data model specific to the particular programming language (Perl objects, .NET obj ects,Java objects)
SDKs
22
vSphere SDKs Architecture
vCenter
Utility Applications and Samples
Runtime Layerinterfaces with the web services
maps VMware entities into native objects
provides a simple API to retrieve objects
Abstraction Layer
vSph
ere
SD
K
vSphere Web Services SDK
ESX ESX ESX ESX
VMware CLIs and Customer/Partner Solutions
vSphere CIM SMASH API
SDKs
23
vSphere SDK for Perl (example)
# login
Util::connect();
# get VirtualMachine views for all powered on VM's
my $vm_views = Vim::find_entity_views(view_type => 'V irtualMachine',
filter => { 'runtime.powerState' => 'poweredOn' });
# snapshot each VM
foreach my $vm (@$vm_views) {
$vm->CreateSnapshot(name => 'snapshot sample',
description => 'Snapshot created from workshop samp le',
memory => 0,
quiesce => 0);
print "Snapshot complete for VM: " . $vm->name . "\ n";
}
# logout
Util::disconnect();
SDKs
24
Vitual Disk Development Kit (VDDK)
� Use the Virtual Disk Libraries to
• Access/modify virtual disks (VixDiskLib)
• Mount a volume/disk (ViMntapi)
� The vmdk file format is public… but
• Let us avoid everyone implementing VMDK readers/writers
• Avoid updating the readers/writers for every format update
• Optimized code from VMware which has already done all this work
• Low threshold to let ISV’s use VMDK as their native format (e.g. for backup)
25
Vitual Disk Development Kit (VDDK)
1. Login
2a. GetTicket(Vm, Vmdk,…)
2. Open(VM, vmdk, …)
3. Open(vmdk, Ticket, …)
4. Read(handle, …)
VDDK App
vCenter
26
vSphere Guest SDK
� API available to developers writing applicationsthat will run in a virtual machine on a vSphere platfo rm
� Available as a C or a Java library
� Provides information about the virtual machineand limited information about the host that the mach ineis running on
� Enables customers to write smart applications that res pond to changes at the virtual environment layer
� This SDK is available in guest operating systems (Wi ndows and Linux) where VMware Tools is installed
SDK
27
vSphere Guest SDK
� Data that is displayed includes:
• Resources that the host has allocated to this virtual machine
• Actual resource utilization by the VM
• Elapsed time since this VM was last powered on or reset
• CPU time scheduled on the host system for a particular VM’s CPU(this information combined with other available statistics allows youto estimate how fast this VM’s CPU is running relative to the host CPU)
� Since vSphere 4.0, the Guest SDK now reports on more VM-specific performance statistics than were previously available
� Strong security rules prevent a virtual machine from hav ing complete knowledge of the host that it runs on
� Applications requiring host level data must use the v Sphere Web Services SDK (which would require host/vCenter authent ication)
SDK
28
VIX API
� The VIX API offers 2 categories of capabilities:
• VM operations
• Ability to transfer files between the hypervisor and the guest
• Start and stop applications inside the guest (needs VMware tools)
� The first category of actions are available through th e vSphere Web Services API (already discussed earlier)
� The latter categories of actions will be available i n the WS API ina future release – at that point, the VIX API will be come defunct
� Communications with the guest require a valid credent ial againstthe Guest Operating System
SDK
29
vSphere Management Automation Interfaces
vSphere Management Assistant (vMA)Guest SDK
SDK for Java SDK for .NET SDK for Perl
vSphere CLIPower CLI
Partner Agents/Tools/CLIs
vSphere (ESX/ESXi + vCenter) Virtual Disk Development Kit
Client Plug-in API VIX API Web Services API H/W Mgmt APIs
HostHardware
Platform Memory Network Storage Other
Partner GUI Plug-in
30
Helpful Resources
� For all your integration needs go to http://developer.vmware.com
� Developer Support can be purchased from the GSS organizat ion. They answer questions like• Can I automate the following use-case using the APIs?
• If so, where is the documentation/samples to help me?
• I tried it and it does not work. Can you help me troubleshoot?
• I think I found a bug in vSphere
� Some other related sessions that may be of interest• PPC-02: Best Practices in Using the vSphere Web Services SDK
• PPC-03: All about vSphere Events, Alarms and Tasks
• PPC-04: vSphere APIs for Performance Monitoring
• PPC-05: Demystifying Property Collector
• PPC-07: War Stories from the Trenches (from our Developer Support team)
• PPC-14: vCloud API – SDK to Improve Efficiency when Building Your Clouds
• PPC-17: Hardware Health Monitoring – Present and Future
31
Support and Training available for PowerCLI and SDK s
� Scripting / development support for SDKs and PowerCLI http://vmware.com/go/sdksupport
� PowerCLI Training: http://vmware.com/go/vsphereautomation