49
Nimish Sheth Manas Kelshikar Session ID vSphere Client Plug-ins

Creating v sphere client plug ins

Embed Size (px)

DESCRIPTION

Creating vSphere Client Plugins

Citation preview

Page 1: Creating v sphere client plug ins

Nimish Sheth

Manas Kelshikar

Session ID

vSphere Client Plug-ins

Page 2: Creating v sphere client plug ins

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.

Page 3: Creating v sphere client plug ins

About Us

Nimish Sheth, MTSI 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, MTSI 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

Page 4: Creating v sphere client plug ins

Overview

Two flavors of vSphere client plug-insWhat plug-ins can do and can’t do?Extension PointsWalk-through a couple of partner plug-insWeb plug-ins

Key features

How to create and deploy web plug-ins

C# plug-insAPI discussionDeployment methods

Plug-ins RoadmapPlug-ins style scorecardResourcesQuestions

Page 5: Creating v sphere client plug ins

Two flavors of Plug-ins

Web plug-ins.

Embed an Internet Explorer browser within vSphere Client.

Make it easy to integrate existing web apps.

.Net plug-ins.

All the rich functionality of a thick client.

Similar look and feel to vSphereClient.

Page 6: Creating v sphere client plug ins

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.

Page 7: Creating v sphere client plug ins

Plug-in extension points

To get the list of all the extension points, go to http://www.vmware.com/support/developer/vc-sdk/vcplugin/vSphere_Plugin_40_Technote.pdf

Page 8: Creating v sphere client plug ins

Plug-in extension points

Page 9: Creating v sphere client plug ins

Let’s look at web plug-ins.

Page 10: Creating v sphere client plug ins

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:

Page 11: Creating v sphere client plug ins

Screenshot Courtesy ServerEngines LLC (http://www.serverengines.com)

Possibilities

ServerEnginesvMaestro 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.

Page 12: Creating v sphere client plug ins

Key features

Localization support

Display Constraints

Nested Menus

Data channel

Navigate within vSphere client inventory

Page 13: Creating v sphere client plug ins

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>

Page 14: Creating v sphere client plug ins

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 exte nsion should only be seen by the administrator

To do so, a privilege constraint can be used

Three types of constraintsInventory view constraintPrivilege-based constraintCustom-value based constraintArbitrary 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

Page 15: Creating v sphere client plug ins

Display constraints

TypesInventory 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 constraintFiltering 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>

Page 16: Creating v sphere client plug ins

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>

Page 17: Creating v sphere client plug ins

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=https://10.20.104.142/sdk

Page 18: Creating v sphere client plug ins

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 (lik e summary, performance etc.)

window.external.Navigate(‘HostSystem:host-23’, ‘Summary’)

Page 19: Creating v sphere client plug ins

Installing web plug-ins.

3rd Party Web Server

Admin Station

vSphere API

VMware vCenter

Note: vCenter never calls outto the 3rd Party Web Server.

Step 1:Install the plug-in XML fileon a 3rd party web server.

Step 2:Register the XML plug-in

configuration with vCenterusing the vSphere API.

Page 20: Creating v sphere client plug ins

Deploying web plug-ins to clients.

HTT

PS

vSphere API

vSphere API

A

3rd Party Web ServerVMware vCenter

VMware vSphere Client

Note: vCenter has still not talkedto the 3rd Party Web Server.

Step 1:vSphere Client logs in to

vCenter.

Step 2:vCenter assembles a list of

web plug-ins and returns them to vSphere Client.

Step 3:vSphere Client downloads the

plug-ins from the 3rd Party Webserver that was registered

earlier.

Page 21: Creating v sphere client plug ins

Using web plug-ins.

vSphere API

vSphere API

VMware vCenter

VMware vSphere Client

HTTPS3rd Party Web Server

HTTPS

User token.Object selected (MoRef)Action selected.

Step 1:When you click on a plug-in element in vSphere Client, a

web request is made.Note: vCenter has no

knowledge of this!

Step 2:The application hosted on the 3rd Party Webserver logs in to vCenter using the user’s token

(and identity).

Step 3:vCenter responds to the

request.

Step 4:The 3rd Party Web app

processes the response and makes its response to vSphere

Client.

Page 22: Creating v sphere client plug ins

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 mo re value.

This approach usually requires new development.

This approach requires little web programming skill, but deep understanding of vSphere API.

Page 23: Creating v sphere client plug ins

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.

Page 24: Creating v sphere client plug ins

Let’s look at .net plug-ins.

Page 25: Creating v sphere client plug ins

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.

vSphere 4: .net Plug-in Support

Page 26: Creating v sphere client plug ins

Screenshot Courtesy NetApp (http://www.netapp.com/us/)

Possibilities

Page 27: Creating v sphere client plug ins

.Net Plug-in API

Page 28: Creating v sphere client plug ins

VMware.VIClient.Plugins2.PluginPrimary 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.

Plug-in API

Page 29: Creating v sphere client plug ins

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.

Plug-in API

Page 30: Creating v sphere client plug ins

VMware.VIClient.Plugins2.ExtensionWrapper 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.

Plug-in API

Page 31: Creating v sphere client plug ins

VMware.VIClient.Plugins2.DisplayConstraintTo 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.

Plug-in API

Page 32: Creating v sphere client plug ins

VMware.VIClient.Plugins2.InventoryRepresents 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.

Plug-in API

Page 33: Creating v sphere client plug ins

VMware.VIClient.Plugins2.ExtensionContextContains a reference to the VIM SDK object currently in focus.

VMware.VIClient.Plugins2.ManagedObjectReferenceUniquely identifies the server object and usually passed to a plug-in embedded in the ExtensionContext.

VMware.VIClient.Plugins2.ServerInfoInformation of the vSphere server that the client is connect with. vSphere client will only supply relevant ServerInfo’s.

VMware.VIClient.Plugins2.UserSessionContains 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)

Plug-in API

Page 34: Creating v sphere client plug ins

Using .net plug-ins.

VMware vCenter VMware vSphere Client

vSphere API

Shares vSphere Client’s login

Page 35: Creating v sphere client plug ins

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.

Assembly Attributes

Page 36: Creating v sphere client plug ins

Other Goodies

Page 37: Creating v sphere client plug ins

VMware.CustomControls

ViewEx

ListViewEx

GridViewEx

VpxClientCommon

ViewData

ListViewData

(You will find the relevant libraries in the vSphere Client installation folder)

vSphere Client Controls

Page 38: Creating v sphere client plug ins

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)

Inventory Cache

Page 39: Creating v sphere client plug ins

How do I deliver my plug-in to the vSphere Client?

Page 40: Creating v sphere client plug ins

Deploying .net plug-ins: method 1.

VMware vSphere Client

Deployment ServerInternet

Note: vCenter does nothelp this install in any

way!

Pull from theInternet OR Push from a

deployment server

Page 41: Creating v sphere client plug ins

Deploying .net plug-ins: method 2.

VMware vSphere Client VMware vCenter

Hooks in to vCenter’s“Available” tab.

Page 42: Creating v sphere client plug ins

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 Files\VMware\Infrastructure\Virtual Infrastructure Client\Plugins.

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.

Deployment

Page 43: Creating v sphere client plug ins

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

}

}

}

vSphere Client Action

Page 44: Creating v sphere client plug ins

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.

Caveats

Page 45: Creating v sphere client plug ins

Roadmap

2008 2009 Future

1H 2008: Web plug-ins.

1H 2009: .net plug-ins.

Future: Flex-based portal.

The Flex model is not yetcommitted to a release.

Page 46: Creating v sphere client plug ins

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 years.

Yes No

Page 47: Creating v sphere client plug ins

Resources available for plug-ins.

Plug-in documentation.http://www.vmware.com/support/developer/vc-sdk/vcplugin-exp/

Plug-in community.http://communities.vmware.com/community/developer/viclientplugins

Plug-in FAQs.http://communities.vmware.com/docs/DOC-4510

http://communities.vmware.com/docs/DOC-4551

Plug-in quick start guide.http://communities.vmware.com/docs/DOC-4861

Page 48: Creating v sphere client plug ins

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!

Page 49: Creating v sphere client plug ins

Questions?