Exploring VMware APIs by Preetham Gopalaswamy

8,593 views

Published on

Presentation given on Oct 8th in London by Preetham Gopalaswamy on the VMware APIs

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total views
8,593
On SlideShare
0
From Embeds
0
Number of Embeds
581
Actions
Shares
0
Downloads
266
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

Exploring VMware APIs by Preetham Gopalaswamy

  1. 1. London Workshop Exploring VMware APIs Preetham Gopalaswamy Group Product Manager vCenter Server and vSphere APIs October 8, 2010 Managing Large vSphere Environments using SDKs / PowerCLI 1
  2. 2. Disclaimer This session may contain product features that are currently under development. This session/overview of the new technology represents no commitment from VMware to deliver these features in any generally available product. Features are subject to change, and must not be included in contracts, purchase orders, or sales agreements of any kind. Technical feasibility and market demand will affect final delivery. Pricing and packaging for any new technologies or features discussed or presented have not been determined. “THESE FEATURES ARE REPRESENTATIVE OF FEATURE AREAS UNDER DEVELOPMENT. FEATURE COMMITMENTS ARE SUBJECT TO CHANGE, AND MUST NOT BE INCLUDED IN CONTRACTS, PURCHASE ORDERS, OR SALES AGREEMENTS OF ANY KIND. TECHNICAL FEASIBILITY AND MARKET DEMAND WILL AFFECT FINAL.” 2
  3. 3. VMware API Overview VMware Enabled Independent Secure Private Cloud Public Clouds Public Clouds Solution API/CLI View Thin App Zimbra SaaS Other SaaS Applications Providers VMware End-User Computing Application API Google App VMforce Engine Spring vFabric Hyperic Other cloud Oher PaaS infrastructure VMware Cloud Application Platform Partners providers Virtualization/Hardware Health/Cloud API/CLI VMware Cloud Infrastructure and Management vCloud Datacenter vCenter vShield vCloud Director vCloud Express VMware vSphere: Foundation for Cloud Computing 3
  4. 4. Some Much That I Can Do… Management capabilities available in the vSphere platform • 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 4
  5. 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 5
  6. 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) 6
  7. 7. Introduction Some core principles of the vSphere management capabilities: • They will be exposed by the server as a web-accessible interface • Any SDK that is distributed by VMware will leverage one or more of 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 7
  8. 8. vSphere Web Services SDK Once known as the VI API Service Web • Always available • Secure • Firewall friendly • Designed for network access • Standards based • Governed by access control rules 8
  9. 9. vSphere Web Services SDK Available on ESX, ESXi, vCenter Service and VMware Server 2.0 Web Comprehensive interface for vSphere virtualization management Server (ESX/ESXi or vCenter) authentication credentials must be provided to access this interface The Web Services SDK will be refreshed each time the vSphere interface is enhanced to include new features – typically during major and minor vSphere releases This interface will maintain backward and forward compatibility for 2 releases 9
  10. 10. vSphere Web Services SDK Provides interfaces to do the following: Service Web • 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 package to demonstrate use of the APIs. We are happy to enhance the samples based on input from our partners Clients can monitor the infrastructure through this API so that they are informed any time there is a change – through events or through the PropertyCollector vCenter enables the creation and configuration of alarms in response to specific events. The response to an alarm can be configured 10
  11. 11. Hardware Health Monitoring and Management Hardware asset information and health information H He /W is exposed through the standards-based CIM a lt h 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 Indications 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 hardware data available in vSphere 11
  12. 12. What is CIM CIM stands for “Common Information Model”, an industry standard, object-oriented data model that provides a UML-based framework for describing management data CIM schemas are defined in a language called Managed Object Format (MOF). The Distributed Management Task Force (DMTF) is a standards body defining the CIM Schema with over1000 classes and associations Web-based Enterprise Management (WBEM) is a set of standards defining web-based CIM implementations. Transport between the CIM server and client can be CIM XML over http/https or WSman WBEM profiles define a collection of CIM elements and rules pertaining to a specific area of management 12
  13. 13. Hardware Health Monitoring and Management CPU details H He /W a lt h Fan Battery Local RAID storage Power Supply Power State Management System logs System Memory Firmware Temperature Sensors 13
  14. 14. vSphere CIM SMASH API vCenter includes a monitoring Service that aggregates H He /W hardware information (primarily health) from each a lt h of 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 Alarms infrastructure so that key hardware events can trigger alarms The hardware health data is available only on the host. API users are encouraged to authenticate against vCenter and use the AcquireCIMTicket method to work against a host – rather than authenticate against the host 14
  15. 15. Hardware Health Providers VMware provides a set of default hardware H He /W health providers a lt h Server and IHV partners often supply additional hardware 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 developing additional providers are installed if the default set of hardware health data does not give you all the information 15
  16. 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) CL I 16
  17. 17. vCLIs vSphere CLI offers the capabilities previously available only on the COS (Console Operating System) in Classic ESX, through a remote interface. CL This CLI is supported on both ESX and ESXi I Functionally, they are mainly focused on host configuration Most of the vSphere CLI commands are currently available through vCenter. VMware plans to support all of them through vCenter in a future release Most of the commands are Perl scripts and hence run in Linux and Windows The vSphere CLI can be downloaded and installed separately or as part of a VMware supplied virtual machine vMA (vSphere Management Assistant) 17
  18. 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 on the server with an XML front-end CL I The CLI functionality is broken into logical namespaces with actions specific to each namespace. To run such a command, one would say: esxcli [generic options] <namespace> <action> [specific options] Enables easy extensibility/upgrade of the command-line functionality without changing the client The goal is to transition all the current vCLI commands to the esxcli style in the future 18
  19. 19. vSphere PowerCLI PowerCLI offers a command-line/scripting interface to vSphere management based on Microsoft PowerShell VMware has created over 250 cmdlets that expose CL I the most common management use-cases Cmdlets are simple, intuitive and can be easily and elegantly chained to accomplish complex management tasks This product boasts of a large, extremely active user community, that is enhancing our base implementation with new scripts that are available on the forum and at http://blogs.vmware.com/vipowershell 19
  20. 20. The Simple Elegance of PowerCLI The script below shows how one can create snapshots for all VMs that are currently powered on The same task would be several 100 lines CL I of code using the vSphere Web Services SDK (Java binding) connect get-vm | where {$_.powerstate eq “poweredOn”} | new-snapshot get-cluster -name “mycluster” | get-vmhost | Get-VMHostStorage -RescanAllHBA disconnect The PowerCLI model will form the basis for all the language specific SDKs that VMware will offer the ecosystem 20
  21. 21. vSphere [Language Specific] SDKs VMware offers its customers SDKs for different programming languages The following SDKs are currently available: SD K s • 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 objects, Java objects) 21
  22. 22. vSphere SDKs Architecture VMware CLIs and Customer/Partner Solutions SD K s vSphere SDK Utility Applications and Samples Abstraction Layer maps VMware entities into native objects provides a simple API to retrieve objects Runtime Layer interfaces with the web services vSphere Web Services SDK vSphere CIM SMASH API vCenter ESX ESX ESX ESX 22
  23. 23. vSphere SDK for Perl (example) # login Util::connect(); SD K s # get VirtualMachine views for all powered on VM's my $vm_views = Vim::find_entity_views(view_type => 'VirtualMachine', filter => { 'runtime.powerState' => 'poweredOn' }); # snapshot each VM foreach my $vm (@$vm_views) { $vm->CreateSnapshot(name => 'snapshot sample', description => 'Snapshot created from workshop sample', memory => 0, quiesce => 0); print "Snapshot complete for VM: " . $vm->name . "n"; } # logout Util::disconnect(); 23
  24. 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) 24
  25. 25. Vitual Disk Development Kit (VDDK) VDDK App 1. Login vCenter 2. Open(VM, vmdk, …) 4. Read(handle, …) 2a. GetTicket(Vm, Vmdk,…) 3. Open(vmdk, Ticket, …) 25
  26. 26. vSphere Guest SDK API available to developers writing applications that will run in a virtual machine on a vSphere platform Available as a C or a Java library SD K Provides information about the virtual machine and limited information about the host that the machine is running on Enables customers to write smart applications that respond to changes at the virtual environment layer This SDK is available in guest operating systems (Windows and Linux) where VMware Tools is installed 26
  27. 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 SD K • 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 you to 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 having complete knowledge of the host that it runs on Applications requiring host level data must use the vSphere Web Services SDK (which would require host/vCenter authentication) 27
  28. 28. VIX API The VIX API offers 2 categories of capabilities: • VM operations • Ability to transfer files between the hypervisor and the guest SD K • Start and stop applications inside the guest (needs VMware tools) The first category of actions are available through the vSphere Web Services API (already discussed earlier) The latter categories of actions will be available in the WS API in a future release – at that point, the VIX API will become defunct Communications with the guest require a valid credential against the Guest Operating System 28
  29. 29. vSphere Management Automation Interfaces vSphere Management Guest SDK Assistant (vMA) Partner Agents/Tools/CLIs Partner GUI Plug-in Power CLI vSphere CLI SDK for Java SDK for .NET SDK for Perl Client Plug-in API VIX API Web Services API H/W Mgmt APIs vSphere (ESX/ESXi + vCenter) Virtual Disk Development Kit Platform Memory Network Storage Other Host Hardware 29
  30. 30. Helpful Resources For all your integration needs go to http://developer.vmware.com Developer Support can be purchased from the GSS organization. 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 30
  31. 31. Support and Training available for PowerCLI and SDKs Scripting / development support for SDKs and PowerCLI http://vmware.com/go/sdksupport PowerCLI Training: http://vmware.com/go/vsphereautomation 31

×