Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Creating v sphere client plug ins


Published on

Creating vSphere Client Plugins

Published in: Art & Photos

Creating v sphere client plug ins

  1. 1. Session ID vSphere Client Plug-ins Nimish Sheth Manas Kelshikar
  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.
  3. 3. About Us Nimish Sheth, MTS I have been at VMware for more than 2 years now I work for vSphere UI team I have been working on vSphere client plug-ins right from the 2.5 days I worked on devolopment of vNetwork Distributed Switch, Fault Tolerance, Storage vMotion in vSphere 4.0 Manas Kelshikar, MTS I have been at VMware for more than 2 years now I work for vSphere UI team I worked on vSphere client plug-ins in vSphere 4.0
  4. 4. Overview Two flavors of vSphere client plug-ins What plug-ins can do and can’t do? Extension Points Walk-through a couple of partner plug-ins Web plug-ins Key features How to create and deploy web plug-ins C# plug-ins API discussion Deployment methods Plug-ins Roadmap Plug-ins style scorecard Resources Questions
  5. 5. Two flavors of Plug-ins Web plug-ins. .Net plug-ins. Embed an Internet Explorer All the rich functionality of a thick browser within vSphere Client. client. Make it easy to integrate existing Similar look and feel to vSphere web apps. Client.
  6. 6. What plug-ins can and can’t do. Plug-ins can Create new home view items Create vSphere Client context menu items. Display browser panes within vSphere Client. Create new toolbar items with graphics. Plug-ins cannot Change the behavior of vCenter. Extend existing tables, summaries or reports in vSphere Client. Add to the inventory tree shown in vSphere Client.
  7. 7. Plug-in extension points To get the list of all the extension points, go to sdk/vcplugin/vSphere_Plugin_40_Technote.pdf
  8. 8. Plug-in extension points
  9. 9. Let’s look at web plug-ins.
  10. 10. What is a web plug-in? Web plug-ins are deployed as XML files. The web plug-in contents are later interpreted by vSphere Client. Based on the plug-in contents, new menus and tabs are created. Each action or element points to an external web server. Sample plug-in file:
  11. 11. Possibilities ServerEngines vMaestro software is a means for customers to create/deploy and manage virtual network and storage interfaces in a unified way, by integrating this management in the virtual infrastructure client. It also allows administrators to manage iSCSI storage targets from within VI client, and allows them to tie storage resources to virtual machines. Screenshot Courtesy ServerEngines LLC (
  12. 12. Key features Localization support Display Constraints Nested Menus Data channel Navigate within vSphere client inventory
  13. 13. Localization support By defining multiple title nodes for an extension vSphere client will pick the correct title based on the current locale <extension parent="InventoryView.VirtualMachine" treestyle="Virtual"> <title locale="en">vCenter MOB</title> <title locale=“de">German title for vCenter MOB</title> <title locale=“fr">French title for vCenter MOB</title> <url>file://C:/mob.html</url> </extension>
  14. 14. Display Constraints A way to express when the extension should be shown to the user Sort of a filtering mechanism, for e.g. a certain extension should only be seen by the administrator To do so, a privilege constraint can be used Three types of constraints Inventory view constraint Privilege-based constraint Custom-value based constraint Arbitrary constraints defined by plugin themselves (only available with C# plugins) One or more constraints can be used in combination for a single extension as well
  15. 15. Display constraints Types Inventory view constraint By default an extension is shown in all inventory views <extension parent="InventoryView.VirtualMachine" treestyle="Virtual"> <title locale="en">vCenter MOB</title> <url>file://C:/mob.html</url> </extension> Permission based constraint Filtering based on specific vCenter permissions <extension parent="InventoryView.HostSystem" privilege="Host.Config.Connection, Host.Config.Storage"> …. </extension> Custom-value based constraint <extension parent="InventoryView.VirtualMachine"> <customAttribute name="attrName">VMware</customAttribute> … </extension>
  16. 16. Nested Menus Complex nesting supported (upto any number of levels) <!-- Nested Menus --> <extension parent="InventoryMenus.Datacenter"> <title locale="en">vCenter MOB Nested</title> <!---URL will be ignored for the root level menu--> <url display="window">file://C:/mob.html</url> <!-- Child menus, parent attribute not required--> <extension> <title locale="en">vCenter MOB1</title> <url display="window">file://C:/mob.html</url> </extension> <extension> <title locale="en">vCenter MOB2</title> <url display="window">file://C:/mob.html</url> </extension> </extension>
  17. 17. Data channel Extremely loosely coupled with the vSphere client Contextual data passed to the plug-in Moref (e.g. VirtualMachine:vm-23) vCenter Server guid Locale vCenter Session id vCenter Service url Url looks like http://<Plug-in URL>/?moref=Folder:ha-folder- root&serverGuid=&sessionId=523cc164-77d4-8c77-8e95- 28e19be1363f&locale=en_US&serviceUrl=
  18. 18. Navigate Uses a javascript bridge Navigate to a specific object window.external.NavigateTo(‘HostSystem:host-23’) Navigate to a specific object and select a tab (like summary, performance etc.) window.external.Navigate(‘HostSystem:host-23’, ‘Summary’)
  19. 19. Installing web plug-ins. Note: vCenter never calls out to the 3rd Party Web Server. Step 2: Step 1: Register the XML3 plug-in Install the plug-in XMLWeb Server VMware vCenter vS Party ph file rd configuration with vCenter er on a 3rd party web server. e AP I using the vSphere API. Admin Station
  20. 20. Deploying web plug-ins to clients. Note: vCenter has still not talked to the 3rd Party Web Server. Step 3: Step 2: vSphere Client downloads the Step 1: vCenter assemblesrd list of a vS S ph TP plug-ins from the 3 Party vSphere Client logs in to VMware vCenter 3 Party Web Server rd er HT e web plug-ins and returns them AP vS I A ph Webserver vCenter. registered that was e re to vSphere Client. AP I earlier. VMware vSphere Client
  21. 21. Using web plug-ins. Step 1: vSphere API When youStep 2: a plug-in click 4: on vSphere API TheThe 3rd Party3: 3 Client,Server element in Stephostedapp the application Web on a VMware vCenter vSphere Party Web S TPrd HT S 3rd vCenter respondslogstoken. to processes the response and Party request is web Webserver to the TT User H P Object selected (MoRef) makes its responsehasvSphere vCenter using the user’s token Note: vCenter to Action selected. request. no knowledge of this! (and vSphere Client Client. VMware identity).
  22. 22. Web plug-in best practices. Creating a new tab is the fastest way to create a new plug-in. This approach relies on an existing web application. You can embed an existing Java applet or ActiveX control. If you don’t have a web app, consider tools such as Google Web Toolkit. Creating menu items provides deeper integration and more value. This approach usually requires new development. This approach requires little web programming skill, but deep understanding of vSphere API.
  23. 23. User experience of web plug-ins. The look and feel are not identical. Rich graphical elements such as pop-ups and wizards are difficult to create.
  24. 24. Let’s look at .net plug-ins.
  25. 25. vSphere 4: .net Plug-in Support Create .net plug-ins like vCenter Update Manager and vCenter Converter. Plug-in has control over its lifetime. Dynamically introduce UI elements Custom configuration of added UI element’s visibility. Rich client and plug-in interaction Integrated look and feel of the vSphere Client. Possible to access vSphere Client internal cache. Plugin Manager allows for centralized plugin deployment.
  26. 26. Possibilities Screenshot Courtesy NetApp (
  27. 27. .Net Plug-in API
  28. 28. Plug-in API VMware.VIClient.Plugins2.Plugin Primary handle to a plug-in instantiated by the vSphere Client. Load(VIApp app) Entry point into plug-in code and is invoked by the vSphere Client when a plug-in is to be enabled. This is a good time to add extensions, hooks onto some vSphere Client events exposed through the VIApp. Unload() Counterpart part of the load method invoked when the plug-in is to be disabled. Suggested to close out utilized resource like file handles, network connections etc. Don’t worry about removing extensions as the client will handle that for the plug-in.
  29. 29. Plug-in API VMware.VIClient.Plugins2.VIApp NewExtension() Factory method that returns Extension objects. This also means that the vSphere Client always creates Extension objects and the plug-in is not expected to implement the interface. AddExtension(string parentId, Extension extension) Add an extension to the vSphere Client. Unload(..) Means for a plug-in to Unload i.e disable itself in case some conditions arises that the plug-in is no longer relevant. Note once Unloaded this way the plug-in will only be loaded if the user chooses to or the client is restarted.
  30. 30. Plug-in API VMware.VIClient.Plugins2.Extension Wrapper for actual UI elements. AddNewDisplayConstraint<ConstraintType>() Add a vSphere define constraint on an Extension AddCustomDisplayConstraint() Add a plug-in defined constraint on an Extension Context The managed object context in which the UI element is visible. This is set by the vSphere Client. Content This is the actual UI elements and is to be filled by the plug-in. Activated Event fired when extension comes into view. Recommended to fill up Content the first time this event is fired.
  31. 31. Plug-in API VMware.VIClient.Plugins2.DisplayConstraint To control conditional display of extensions. Evaluate Based on the value of this property the vSphere Client determines if the extension is to be shown or hidden. DisplayStatusChanged Event fired by a constraint if some condition has caused the display status of an extension to change. vSphere Client provide a few pre-canned DisplayConstraint’s. We recommend a plug-in to implement its own DisplayConstraint if they would like to have some other conditional control over display of extensions. Note : Multiple constraints can be apply to a single extension which are logically and’ed by the vSphere client.
  32. 32. Plug-in API VMware.VIClient.Plugins2.Inventory Represents vSphere Client inventory. GetName(ManagedObjectReference) Utility method for cheap retrieval of a managed object’s name. NavigateTo(..) Use these methods to navigate to various objects in the vSphere Client inventory. Use this method in conjunction with strings defined in NavigationKeys class.
  33. 33. Plug-in API VMware.VIClient.Plugins2.ExtensionContext Contains a reference to the VIM SDK object currently in focus. VMware.VIClient.Plugins2.ManagedObjectReference Uniquely identifies the server object and usually passed to a plug-in embedded in the ExtensionContext. VMware.VIClient.Plugins2.ServerInfo Information of the vSphere server that the client is connect with. vSphere client will only supply relevant ServerInfo’s. VMware.VIClient.Plugins2.UserSession Contains details of the logged-in user and a handle to the current users session cookie with the connected server. (Use this to impersonate the client log-in)
  34. 34. Using .net plug-ins. Shares vSphere Client’s login vSphere API VMware vCenter VMware vSphere Client
  35. 35. Assembly Attributes Assembly attributes informs the vSphere Client of necessary global details. VCOnlyPluginAttribute If defined the plug-in is only loaded if the client has connected to a vCenter Server otherwise the plug-in is loaded even if it is connected to an ESX/ESXi server. MultiVCSupported Indicates to the vSphere Client that a single plug-in object can handle contexts from multiple VC server part of the linked VC group. CompatiblePluginApiSupported The client plug-in API this plug-in supports. Is a CSV therefore a plug-in can support multiple client plug-in API versions. ExtensionKeyAttribute Indicates to the client to load the plug-in only if a server extension identified by the specified key exists. SupportedServerApiVersionAttribute API of the server extension the plug-in support. If not defined client will assume plug-in supports all versions of matching extension servers.
  36. 36. Other Goodies
  37. 37. vSphere Client Controls VMware.CustomControls ViewEx ListViewEx GridViewEx VpxClientCommon ViewData ListViewData (You will find the relevant libraries in the vSphere Client installation folder)
  38. 38. Inventory Cache How do I get from ManagedObjectReference to name of a vSphere Managed Object? vSphere Client maintains a cache of server data which can also be used by plug- ins. Step 1: Get the matching VcService from AllServices. VmomiSupport.VcService service = VmomiSupport.VimServiceManager.AllServices[0]; Step 2 : Convert ManagedObjectReference to ManagedObject VirtualInfrastructure.ManagedObject mo = service.ManagedObjects[…]; Step 3 : Get access to an InventoryNode and its name property. mo.Service.Inventory.GetNode(mo).Name; (Look for these interfaces in VimVmomi.dll and VI.dll)
  39. 39. How do I deliver my plug-in to the vSphere Client?
  40. 40. Deploying .net plug-ins: method 1. Internet Deployment Server Pull from the Push from a Internet OR deployment server Note: vCenter does not help this install in any way! VMware vSphere Client
  41. 41. Deploying .net plug-ins: method 2. VMware vSphere Client VMware vCenter Hooks in to vCenter’s “Available” tab.
  42. 42. Deployment Deployed as DLLs .Net plug-ins should be deployed in a folder alongside vSphere Client installation. Typically this folder is found at a path similar to C:Program FilesVMwareInfrastructureVirtual Infrastructure ClientPlugins. Possible plug-in delivery mechanisms Drop plug-in libraires in appropriate directory Register server extension with its client info pointing to a host installer on a web-server.
  43. 43. vSphere Client Action The vSphere Client introspects the plug-in dll to identify the plug-in types Based on the plug-in contents, new menus and tabs are created. Plug-in has complete control of how to handle the action and does not necessarily have to access a network resource Typical Plug-in code - using VMware.VIClient.Plugins2; namespace vSphereClientPlugin { public class MyPlugin : Plugin { public void Load(VIApp app) { AddSomeUIExtensions(app); RegisterVIAppEvents(app); } } }
  44. 44. Caveats Caveats while developing .net plug-ins Support for developing is forum-based only. We will not consider feature requests. Only critical bug fixes will be considered.
  45. 45. Roadmap 1H 2008: Web plug-ins. Future: Flex-based portal. 2008 2009 Future The Flex model is not yet 1H 2009: .net plug-ins. committed to a release.
  46. 46. Plug-in style scorecard. If… Web .net You have an existing web app. Easy Hard You have a .net 2.0 based thick client. Hard Medium You have a Java applet. Easy Very Hard You have a Java-based thick client. Very Hard Very Hard You plan to develop something from scratch. Med-Hard Easy-Med You need thick-client like functionality. Hard Easy You need look-and-feel like vSphere Client Hard Easy Your investment horizon is 3 years or less. Yes Yes Your investment horizon is longer than 3 Yes No years.
  47. 47. Resources available for plug-ins. Plug-in documentation. Plug-in community. Plug-in FAQs. Plug-in quick start guide.
  48. 48. Next Steps… Get access to a vSphere environment consisting of vCenter Server, ESX/ESXi hosts and a few Vmware Virtual Machines Download the plug-in documentation and sample code Deploy your sample plug-in in the ‘plugins’ folder. Launch the vSphere Client and see you plug-in appear Modify code and redeploy to see how your changes manifest Convert your ideas into vSphere Plug-ins Ship it!
  49. 49. Questions?