How do I integrate a solution with
vCenter Server Extensions

You can use the vSphere Web Services API to add a solution to
vCenter Server Extensions
.

Add a solution to
vCenter Server Extensions

You add a solution to
vCenter Server Extensions
by setting the
shownInSolutionManager
property in the implementation of the
Extension
data object that manages the solution.
You can set the
shownInSolutionManager
property in the
MyManager.java
class.
  1. Call the
    ExtSolutionManagerInfo()
    constructor to create an instance of
    ExtSolutionManagerInfo
    in the class that implements
    Extension
    .
    You can add the following code to the
    MyManager.java
    class to create an instance of
    ExtSolutionManagerInfo
    for your solution.
    private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] }
  2. Call the
    setSolutionManagerInfo()
    method to set the
    ExtSolutionManagerInfo
    instance in the solution implementation.
    You can add the following code to the
    MyManager.java
    class to call the
    setSolutionManagerInfo()
    method.
    private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] extension.setSolutionManagerInfo(extSolutionManagerInfo); }
  3. Set the value of the
    shownInSolutionManager
    property to true by calling the
    setShownInSolutionManager()
    method on the implementation of the
    Extension
    object.
    You can add the following code to the
    MyManager.java
    class to set the
    shownInSolutionManager
    property.
    private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] extension.setSolutionManagerInfo(extSolutionManagerInfo); extension.setShownInSolutionManager(true); [...] }
You set the
shownInSolutionManager
property in the implementation of the
Extension
data object that defines the solution. By setting the
shownInSolutionManager
property to
true
, a solution appears in
vCenter Server Extensions
when it registers with
vCenter Server
.

Set the icon for a type of virtual machine or vApp that an extension manages

You can provide an icon for each type of virtual machine or vApp that an extension manages by setting the
smallIconUrl
property of
ExtManagedEntityInfo
.
The icon that you set with the
smallIconUrl
property of
ExtManagedEntityInfo
allows you to identify the types of virtual machines or vApps that your extension deploys. If an extension deploys different types of virtual machines, you can create several
ExtManagedEntityInfo
instances, with a different icon for each type. The virtual machines that the extension deploys appear in the
vCenter Server
inventory with the icons that you set.
The icon image must be in the PNG format and must measure 16 by 16 pixels. You must save the icon image to an appropriate location in the Web application that defines the extension. You provide a URL or path to the image to the
ExtManagedEntityInfo
instance for the type of virtual machine or vApp that this icon represents. Extensions access the icon image by using HTTP. Extensions do not support HTTPS URLs to icon images.
  1. Create an icon image of type
    PNG
    and of dimensions 16 by 16 pixels.
  2. Save the icon image to an appropriate location in the Web application that defines your extension.
  3. Call
    ExtManagedEntityInfo.setSmallIconUrl()
    to set the
    smallIconUrl
    property for a type of virtual machine or vApp that the extension deploys.
    Extension extension = new Extension(); ExtManagedEntityInfo extManagedEntityInfo = new ExtManagedEntityInfo(); extManagedEntityInfo.setType("my_vm_type"); extManagedEntityInfo.setDescription("Description of this type of virtual machine or vApp."); extManagedEntityInfo.setSmallIconUrl("path_to_PNG_image"); extension.getManagedEntityInfo().add(extManagedEntityInfo);
Virtual machines and vApps that your extension deploys appear in the
vCenter Server
inventory with the icon that you set.

Add tabs to a solution

When you create a solution, you can add tabs to your solution to allow users to configure the solution and to access the functions of the solution in the
vSphere Client
.
You define the content of tabs as dynamic Web pages. For example, you can define tabs that allow you to perform the following kinds of actions.
  • Configure the solution.
  • Show events triggered by the solution events or
    vCenter Server
    .
  • Deploy predefined virtual machines or vApps of different types.
  • Monitor the solution application or the virtual machines that it deploys.
  • Uninstall the solution.
You create tabs by implementing the
ExtSolutionManagerInfoTabInfo
data object in the program that manages the solution. You set properties in
ExtSolutionManagerInfoTabInfo
to provide a label for the tabs and a URL to the dynamic Web pages that provide the content of the tabs. You create one
ExtSolutionManagerInfoTabInfo
instance for each tab that you add to your solution. You pass that instance to
ExtSolutionManagerInfo
in an array.
How you define the content of the tabs depends on the function of the application that the solution adds to
vCenter Server
.
You can implement
ExtSolutionManagerInfoTabInfo
in the
MyManager.java
class.
  1. Create an instance of
    ExtSolutionManagerInfo
    in the program that manages the solution.
    Add the following lines in the
    MyManager.java
    class to create an instance of
    ExtSolutionManagerInfo
    .
    private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtSolutionManagerInfo extSolutionManagerInfo = new ExtSolutionManagerInfo(); [...] }
  2. Create an instance of
    ExtSolutionManagerInfoTabInfo
    to contain the name of the page and a link to the Web page that defines its contents.
    ExtSolutionManagerInfoTabInfo extSolutionManagerInfoTabInfo = new ExtSolutionManagerInfoTabInfo();
  3. Call the
    ExtSolutionManagerInfoTabInfo.setLabel()
    method to provide a name for the page.
    Add the following line to
    MyManager.java
    to name your solution Configuration page.
    extSolutionManagerInfoTabInfo.setLabel("Configuration");
  4. Call the
    ExtSolutionManagerInfoTabInfo.setUrl()
    method to provide a URL to the Web page that defines the contents of your solution Configuration page.
    You can set in
    MyManager.java
    that your solution uses the
    config.html
    Web page to define the contents of the configuration page.
    extSolutionManagerInfoTabInfo.setUrl("/config.html");
  5. Add the tab to the array of
    ExtSolutionManagerInfoTabInfo
    instances that define the tabs for the solution in the
    ExtSolutionManagerInfo
    object.
    extSolutionManagerInfo.getTab().add(extSolutionManagerInfoTabInfo);
You added solution-specific tabs that appear on the Summary page of your solution.
Set up health monitoring for the solution and the objects that it manages.

Set up health monitoring for a solution

vCenter Server
pulls data from solutions about their health status. Solutions expose health data by providing a URL to an XML file that defines the health model of the solution.
All solutions must provide an XML file that specifies their health model. The health specification XML file for your solution must conform to the VMware Health Service extensible schema definition (XSD). See Solution health XML schema for the complete VMware solution health schema.
Solutions expose health data about themselves to
vCenter Server
by publishing XML documents that declare different health statuses, depending on the events that occur in the solution. You provide messages to accompany each health status in the XML document that the solution exposes to
vCenter Server
. Solutions can provide the following statuses to
vCenter Server
:
  • alert
  • warning
  • info
When you develop a solution, you must include a program or function that generates the health status XML file for the solution. The health status of a solution can be red, yellow, or green.
You must pass a URL to the XML file that defines the health model for a solution to the
ExtensionHealthInfo
object in the program that manages the solution. For example, you can create the following classes as part of your solution:
  • MyHealthProvider.java
    define the health statuses for your solution.
  • MyHealthStatusServlet.java
    dynamically create the XML file in which the solution exposes health status data.
You can implement the
ExtensionHealthInfo
in the
MyManager.java
class. The
MyManager.java
class can set a URL to a health definition XML file in the
ExtensionHealthInfo
url
property. The URL that
MyManager.java
provides must be the path to the
health.xml
file that
MyHealthStatusServlet.java
will create.
  1. Create a program that defines the health statuses of the solution.
    You can define the health statuses of your solution in the
    MyHealthProvider.java
    class.
  2. Create a program that creates an XML file that exposes the health status data, conforming to the VMware health service XSD.
    You can create the health data XML file in the
    MyHealthStatusServlet.java
    class.
    MyHealthStatusServlet.java
    implements
    MyHealthProvider
    to extract the health status from the solution. The class creates an XML file,
    health.xml
    , that exposes the health data about the solution according to the health status that
    MyHealthProvider
    provides.
  3. Create an instance of
    ExtensionHealthInfo
    in the program that manages the solution.
    You can implement
    ExtensionHealthInfo
    in
    MyManager.java
    .
    private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtensionHealthInfo healthInfo = new ExtensionHealthInfo(); [...] }
  4. Call the
    ExtensionHealthInfo.setUrl()
    method to set the URL at which the solution publishes its health data XML file.
    Your solution can publish an XML file,
    health.xml
    , that the
    MyHealthStatusServlet.java
    class generates.
    healthInfo.setUrl(_url.toString() + "/health/health.xml");
  5. Call the
    Extension.setHealthInfo()
    method to add the
    ExtensionHealthInfo
    object to the solution.
    MyManager.java
    can provide a link to the
    health.xml
    XML file that the
    MyHealthStatusServlet.java
    class generates.
    private Extension createExtensionObject() { Extension extension = new Extension(); [...] ExtensionHealthInfo healthInfo = new ExtensionHealthInfo(); healthInfo.setUrl(_url.toString() + "/health/health.xml"); extension.setHealthInfo(healthInfo); [...] }
Contents of a solution health XML file
Your solution can publish health data at
http://
<solution_ip_address>
:
<solution_port>
/my_sample/health/health.xml
. The
MyHealthStatusServlet.java
class in your solution can generate this file when the solution starts. This example shows the XML file that
MyHealthStatusServlet.java
generates when your solution is running correctly.
<vimhealth schemaVersion="1.0"> <health id="com.mycompany.mysolution"> <name>My Solution</name> <status>green</status> <message id="com.mycompany.mysolution" level="info" time="<current_date_and_time>">Running</message> </health> </vimhealth>

Solution health XML schema

Solutions must provide data about their health status to
vCenter Server
in XML documents.
The health status XML documents that a solutions pushes to
vCenter Server
must conform to the VMware health schema.
<?xml version="1.0" encoding="utf-8"?> <xs:schema targetNamespace="http://www.vmware.com/vi/healthservice" elementFormDefault="qualified" xmlns="http://www.vmware.com/vi/healthservice" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0"> <xs:complexType name="healthType"> <xs:sequence> <xs:element name="name" type="xs:string" minOccurs="0" maxOccurs="1"/> <xs:element name="status" minOccurs="1" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="green" /> <xs:enumeration value="yellow" /> <xs:enumeration value="red" /> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="message" minOccurs="0" maxOccurs="unbounded"> <xs:complexType mixed="true"> <xs:sequence> <xs:element name="param" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:string" use="required"/> <xs:attribute name="level" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="info" /> <xs:enumeration value="warning" /> <xs:enumeration value="alert" /> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name="time" type="xs:dateTime" use="required"/> </xs:complexType> </xs:element> <xs:element name="health" type="healthType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="id" type="xs:string" use="required"/> </xs:complexType> <xs:element name="vimhealth"> <xs:complexType> <xs:sequence> <xs:element name="health" type="healthType" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> <xs:attribute name="schemaVersion" type="xs:decimal" use="required"/> </xs:complexType> </xs:element> </xs:schema>