Download SDKs

July 23, 2010 in citrix, virtualization, xen by admin

Page edited by Ewan Mellor

Overview

XenServer includes a XML-RPC based API, providing programmatic access to the extensive set of XenServer management features and tools. The XenServer API can be called from a remote system as well as local to the XenServer host. Remote calls are generally made securely over HTTPS, using port 443.

There are five SDKs available, one for each of C, C#, Java, PowerShell, and Python. These are provided under an open-source license (LGPL or GPL with the common linking exception). This allows use (unmodified) in both closed-and open-source applications.

There are also several example code samples also provided for download. Some of the code samples demonstrate creating a VM, running VM power operations, and watching for events.

The XenServer 5.6 SDKs are suitable not just for 5.6, but for use with XenServer 4.0, 4.1, 5.0 and 5.5 servers too, making it possible to address multiple XenServer versions with a single binary. There are, of course, features missing on the older versions, and client programs are expected to check host.software_version["product_version"] to gracefully fall back when appropriate.

XenServer 5.6


  XenServer.NET: The XenServer SDK for C#.NET
       Download XenServer.NET binaries
       Download XenServer.NET samples
       Download XenServer.NET source

  XenServerJava: The XenServer SDK for Java
       Download XenServerJava binaries
       Download XenServerJava samples
       Download XenServerJava source

  libxenserver: The XenServer SDK for C
       Download libxenserver binaries
       Download libxenserver samples and source

  XenServerPSSnapIn: The XenServer SDK for PowerShell
       Download XS-PS Windows installer
       Download XS-PS source

  XenAPI.py: The XenServer Python module
       Download XenAPI.py
       Browse XenServer API examples using Python

  API Reference
       PDF
       HTML
       Javadoc (zip)

  XenServerConsole: A Java client for XenServer consoles
       Download XenServerConsole source


XenServer SDK VM


We also publish an appliance-style virtual machine, ready to be imported into a XenServer host. This contains the SDKs above, plus a XenServer simulator, and a complete Linux-based development environment.

  Download SDK VM: Version 5.6.0. 365 MB.
  XenServer SDK Guide
       PDF
       HTML


Citrix StorageLink SDK


What is Citrix StorageLink?
Citrix StorageLink lets users automate the configuration and provisioning of the virtual machine storage, taking advantage of advanced features of the attached storage array. StorageLink enables the user to create virtual machines from logical vendor-specific storage repositories that support advanced capabilities such as snapshots, cloning, thin provisioning, and data deduplication. StorageLink also uses advanced storage capabilities to rapidly create virtual machines, increase storage utilization, and provide improved business continuity while lowering total cost of ownership.

Citrix StorageLink seamlessly integrates with storage arrays using either the standards-based SMI-S interface or via a custom vendor-specific StorageLink Storage Adapter.


Citrix StorageLink Gateway SDK (v2.0)

  • Documentation for Web Services/SOAP interface for Citrix StorageLink Gateway.


Citrix StorageLink Storage Adapter SDK (v2.0)

  • Citrix StorageLink SDK for storage partners.


Citrix StorageLink Gateway SDK (v2.1)

  • Documentation for Web Services/SOAP interface for Citrix StorageLink Gateway.


Citrix StorageLink Storage Adapter SDK (v2.1)

  • Citrix StorageLink SDK for storage partners.


Further Resources


XenServer Documentation Index

XenServer SDK Forum

Browse and Share Scripts and Samples on the CDN Script Exchange

xvp: An open-source web interface for XenServer, developed at Durham University



Older Releases


Note that the XenServer 5.6 SDKs are also suitable for use with XenServer 4.0, 4.1, 5.0 and 5.5 servers. These older releases are here for historical purposes only.

XenServer SDK Archive





Changes between revision 53 and revision 54:

 *Overview*
  
 XenServer includes a XML-RPC based API, providing programmatic access to the extensive set of XenServer management features and tools. The XenServer API can be called from a remote system as well as local to the XenServer host. Remote calls are generally made securely over HTTPS, using port 443.
  
 There are five SDKs available, one for each of C, C#, Java, PowerShell, and Python. These are provided under an open-source license (LGPL or GPL with the common linking exception). This allows use (unmodified) in both closed-and open-source applications.
  
 There are also several example code samples also provided for download. Some of the code samples demonstrate creating a VM, running VM power operations, and watching for events.
  
 The XenServer 5.6 SDKs are suitable not just for 5.6, but for use with XenServer 4.0, 4.1, 5.0 and 5.5 servers too, making it possible to address multiple XenServer versions with a single binary. There are, of course, features missing on the older versions, and client programs are expected to check host.software_version\["product_version"\] to gracefully fall back when appropriate.
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. XenServer 5.6
 {div}
 \\
  
 !btn_search.png!  *XenServer.NET*: The XenServer SDK for C#.NET
        [Download XenServer.NET binaries|^XenServer.NET-5.6.0-1.zip]
        [Download XenServer.NET samples|^XenServer.NET-5.6.0-1-samples.zip]
        [Download XenServer.NET source|^XenServer.NET-5.6.0-1-src.zip]
  
 !btn_search.png!  *XenServerJava*: The XenServer SDK for Java
        [Download XenServerJava binaries|^XenServerJava-5.6.0-1.zip]
        [Download XenServerJava samples|^XenServerJava-5.6.0-1-samples.zip]
        [Download XenServerJava source|^XenServerJava-5.6.0-1-src.zip]
  
 !btn_search.png!  *libxenserver*: The XenServer SDK for C
        [Download libxenserver binaries|^libxenserver-5.6.0-1.tar.bz2]
        [Download libxenserver samples and source|^libxenserver-5.6.0-1-src.tar.bz2]
  
 !btn_search.png!  *XenServerPSSnapIn*: The XenServer SDK for PowerShell
        [Download XS-PS Windows installer|^XenServerPSSnapIn-5.6.0-1.msi]
        [Download XS-PS source|^XenServerPSSnapIn-5.6.0-1-src.zip]
  
 !btn_search.png!  *XenAPI.py*: The XenServer Python module
         [Download XenAPI.py|XenServer Python API Samples^XenAPI.py]
         [Download XenAPI.py|^XenAPI.py]
        [Browse XenServer API examples using Python|XenServer Python API Samples]
  
 !btn_search.png!  *API Reference*
        [PDF|^xenenterpriseapi.pdf]
        [HTML|http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/api/]
        [Javadoc (zip)|^XenServerJavadoc-5.6.0.zip]
  
 !btn_search.png!  *XenServerConsole*: A Java client for XenServer consoles
        [Download XenServerConsole source|^XenServerConsole-src.zip]
  
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. XenServer SDK VM
 {div}
 \\
  
 We also publish an appliance-style virtual machine, ready to be imported into a XenServer host. This contains the SDKs above, plus a XenServer simulator, and a complete Linux-based development environment.
  
 !btn_search.png!  [*Download SDK VM*|http://www.citrix.com/lang/English/lp/lp_1688621.asp]: Version 5.6.0. 365 MB.
 !btn_search.png!  *XenServer SDK Guide*
        [PDF|http://support.citrix.com/article/CTX124890]
        [HTML|http://docs.vmd.citrix.com/XenServer/5.6.0/1.0/en_gb/sdk.html]
  
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. Citrix StorageLink SDK
 {div}
 \\
  
 What is Citrix StorageLink?
 Citrix StorageLink lets users automate the configuration and provisioning of the virtual machine storage, taking advantage of advanced features of the attached storage array. StorageLink enables the user to create virtual machines from logical vendor-specific storage repositories that support advanced capabilities such as snapshots, cloning, thin provisioning, and data deduplication. StorageLink also uses advanced storage capabilities to rapidly create virtual machines, increase storage utilization, and provide improved business continuity while lowering total cost of ownership.
  
 Citrix StorageLink seamlessly integrates with storage arrays using either the standards-based SMI-S interface or via a custom vendor-specific StorageLink Storage Adapter.
  
 \\
 !btn_search.png! [*Citrix StorageLink Gateway SDK (v2.0)*|http://community.citrix.com/download/attachments/38633496/storagelink_gateway_sdk_v2.0.zip|]
 * Documentation for Web Services/SOAP interface for Citrix StorageLink Gateway.
  
 \\
 !btn_search.png! [*Citrix StorageLink Storage Adapter SDK (v2.0)*|http://community.citrix.com/download/attachments/38633496/storagelink_adapter_sdk_v2.0.zip|]
 * Citrix StorageLink SDK for storage partners.
  
 \\
 !btn_search.png! [*Citrix StorageLink Gateway SDK (v2.1)*|http://community.citrix.com/download/attachments/38633496/storagelink_gateway_sdk_v2.1.zip|]
 * Documentation for Web Services/SOAP interface for Citrix StorageLink Gateway.
  
 \\
 !btn_search.png! [*Citrix StorageLink Storage Adapter SDK (v2.1)*|http://community.citrix.com/download/attachments/38633496/storagelink_adapter_sdk_v2.1.zip|]
 * Citrix StorageLink SDK for storage partners.
  
  
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. Further Resources
 {div}
 \\
 !btn_search.png! [*XenServer Documentation Index*|http://docs.vmd.citrix.com/XenServer/5.6.0/]
  
 !btn_search.png! [*XenServer SDK Forum*|http://forums.citrix.com/forum.jspa?forumID=175&start=0]
  
 !btn_search.png! [*Browse and Share Scripts and Samples on the CDN Script Exchange*|http://community.citrix.com/cdn/script-exchange/]
  
 !btn_search.png! [*xvp*|xvp]: An open-source web interface for XenServer, developed at Durham University
  
 \\
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. Older Releases
 {div}
 \\
  
 Note that the XenServer 5.6 SDKs are also suitable for use with XenServer 4.0, 4.1, 5.0 and 5.5 servers. These older releases are here for historical purposes only.
  
 [XenServer SDK Archive]
  
 \\
 \\
 \\
 \\

XenCenter Plugins

July 22, 2010 in citrix, virtualization, xen by admin

Page edited by Stephen Rice

In XenCenter 5.6 it is now possible to add custom menu items or even whole tabs to the main window. You might do this as an ISV to integrate your own product with XenCenter, or as an end-user to integrate with your company's existing inventory management, for example.

A menu item can run a Microsoft PowerShell script or even an arbitrary executable on the client machine. Tabs are populated with a web page, and can call out to other services on your network or to your VMs.

We welcome your feedback on this new feature, and would love to hear of any use cases that you have. Please comment at the bottom of this page.



Specification

XenCenter Plugins Specification

Tutorials and Examples

HelloWorld Example - PowerShell
HelloWorld Example - C Sharp
XenCenter Plugins - WebUI Tab Example
Citrix Console Plugins for Access Gateway, Netscaler and Branch Repeater
Parameters Hints and Tips
MessageBoard Example - JavaScript

Known issues

PowerShell plugins can sometimes fail to run properly. The symptom is that the plugin appears to run for ever without doing anything.

The underlying cause is that a required folder is never created: the workaround is to create the folder yourself. The folder is XenServerPSSnapIn within the Citrix application data directory. For example, it can normally be found at

C:\Documents and Settings\<user>\Application Data\Citrix\XenServerPSSnapIn

on Windows XP, or

C:\Users\<user>\AppData\Roaming\Citrix\XenServerPSSnapIn

on Windows Vista.





Changes between revision 20 and revision 21:

 !MenuItemSmall.png|align=right!
  
 In XenCenter 5.6 it is now possible to add custom menu items or even whole tabs to the main window. You might do this as an ISV to integrate your own product with XenCenter, or as an end-user to integrate with your company's existing inventory management, for example.
  
 A menu item can run a Microsoft PowerShell script or even an arbitrary executable on the client machine. Tabs are populated with a web page, and can call out to other services on your network or to your VMs.
  
 We welcome your feedback on this new feature, and would love to hear of any use cases that you have. Please comment at the bottom of this page.
  
 \\
 \\
  
 h2. Specification
  
 !arrow.png! *[*XenCenter Plugins Specification*|^xc_plugins.pdf]*
  
 h2. Tutorials and Examples
  
 !arrow.png! [HelloWorld Example - PowerShell]
 !arrow.png! [HelloWorld Example - C Sharp]
 !arrow.png! [XenCenter Plugins - WebUI Tab Example]
 !arrow.png! [Citrix Console Plugins for Access Gateway, Netscaler and Branch Repeater|Citrix Console Plugins]
 !arrow.png! [Parameters Hints and Tips]
  !arrow.png! [MessageBoard Example - JavaScript]
 \\
  
 h2. Known issues
  
 PowerShell plugins can sometimes fail to run properly. The symptom is that the plugin appears to run for ever without doing anything.
  
 The underlying cause is that a required folder is never created: the workaround is to create the folder yourself. The folder is XenServerPSSnapIn within the Citrix application data directory. For example, it can normally be found at
  
 C:\Documents and Settings\<user>\Application Data\Citrix\XenServerPSSnapIn
  
 on Windows XP, or
  
 C:\Users\<user>\AppData\Roaming\Citrix\XenServerPSSnapIn
  
 on Windows Vista.
  
  
 \\
 \\
 \\
 \\

Citrix Console Plugins

July 9, 2010 in citrix, virtualization, xen by admin

Page edited by Stephen Turner

The following plugins have been written using the XenCenter Plugin specification to add a new tab inside XenCenter to access the console of Access Gateway, Net Scaler and Branch Repeater VMs:

Each of the plugins works in a similar way. A XenSearch in the plugin configuration xml toggles enablement of the plugin based on whether the correct tag is present on a selected running VM.

As an example, here is the Access Gateway configuration xml:

<?xml version="1.0" encoding="UTF-8"?>
  <XenCenterPlugin xmlns="http://www.citrix.com/XenCenter/Plugins/schema" version="2" plugin_version="1.0.0.0">
    <TabPage name="webui-tab" url="https://{$ip_address}:9001" search="967e62a3-45a0-4cc9-b7a7-de941ae754b1" />
    <MenuItem name="ui-menu-item" menu="vm" serialized="none" search="967e62a3-45a0-4cc9-b7a7-de941ae754b1">
      <Shell filename="https://{$ip_address}:9001" />
    </MenuItem>
    <MenuItem name="web-menu-item" menu="help" serialized="none">
      <Shell filename="http://citrix.com/accessgateway" />
    </MenuItem>
    <Search uuid="967e62a3-45a0-4cc9-b7a7-de941ae754b1" name="Access Gateway VPX" major_version="2" minor_version="0" show_expanded="yes">
    <Query>
      <QueryScope>
        <VM />
      </QueryScope>
      <GroupQuery type="And">
        <EnumPropertyQuery property="power_state" equals="yes" query="Running" />
        <StringListContainsQuery property="tags" query="Access Gateway VPX" contains="yes" />
      </GroupQuery>
    </Query>
  </Search>
</XenCenterPlugin>

Here are the resources and configuration files for each of the plugins:
NetScalerVPX.xcplugin.xml
NetScalerVPX.resx
BranchRepeaterVPX.xcplugin.xml
BranchRepeaterVPX.resx
AccessGatewayVPX.xcplugin.xml
AccessGatewayVPX.resx

Changes between revision 2 and revision 3:

 The following plugins have been written using the XenCenter Plugin specification to add a new tab inside XenCenter to access the console of Access Gateway, Net Scaler and Branch Repeater VMs:
 * [^AccessGatewayVPX.msi]
 * [^NetScalerVPX.msi]
 * [^BranchRepeaterVPX.msi]
  
 Each of the plugins works in a similar way. A XenSearch in the plugin configuration xml toggles enablement of the plugin based on whether the correct tag is present on a selected running VM.
  
 As an example, here is the Access Gateway configuration xml:
 {code}
 <?xml version="1.0" encoding="UTF-8"?>
  <XenCenterPlugin xmlns="http://www.citrix.com/XenCenter/Plugins/schema" version="2" plugin_version="1.0.0.0">
  <TabPage name="webui-tab" url="https://{$ip_address}:9001" search="967e62a3-45a0-4cc9-b7a7-de941ae754b1" />
  <MenuItem name="ui-menu-item" menu="vm" serialized="none" search="967e62a3-45a0-4cc9-b7a7-de941ae754b1">
  <Shell filename="https://{$ip_address}:9001" />
  </MenuItem>
  <MenuItem name="web-menu-item" menu="help" serialized="none">
  <Shell filename="http://citrix.com/accessgateway" />
  </MenuItem>
  <Search uuid="967e62a3-45a0-4cc9-b7a7-de941ae754b1" name="Access Gateway VPX" major_version="2" minor_version="0" show_expanded="yes">
  <Query>
  <QueryScope>
  <VM />
  </QueryScope>
  <GroupQuery type="And">
  <EnumPropertyQuery property="power_state" equals="yes" query="Running" />
  <StringListContainsQuery property="tags" query="Access Gateway VPX" contains="yes" />
  </GroupQuery>
  </Query>
  </Search>
 </XenCenterPlugin>
 {code}
 Here are the resources and configuration files for each of the plugins:
 [^NetScalerVPX.xcplugin.xml]
 [^NetScalerVPX.resx]
 [^BranchRepeaterVPX.xcplugin.xml]
 [^BranchRepeaterVPX.resx]
 [^AccessGatewayVPX.xcplugin.xml]
 [^AccessGatewayVPX.resx]

Parameters Hints and Tips

July 8, 2010 in citrix, virtualization, xen by admin

Page edited by Stephen Turner

XenCenter provides parameter sets to your plugin to describe the current selection in the XenCenter resource list. See the plugin specification for the full details of the data in a parameter set.

This page details how to deal with this information using a Shell command, which requires some thought as there are no handy global variables separating everything out as is the case with the PowerShell commands.

Shell commands and parameters

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
<XenCenterPlugin
	xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
	version="1">
	<MenuItem
		name="hello-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="1, goodbye"
		/>
	</MenuItem>
</XenCenterPlugin>

When using a Shell command, your parameters are passed directly as arguments to the plugin executable. In addition to the parameter sets, you will also receive any parameters you define in the param attribute on your XML. Outlined here are several approaches you might take to parse these arguaments, with examples in C#.

Option 1 - No extra params

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
<XenCenterPlugin
	xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
	version="1">
	<MenuItem
		name="hello-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
		/>
	</MenuItem>
</XenCenterPlugin>

This is the simple option. We know that parameter sets come in groups of four arguments so if none of the menu item commands which call that executable define anything in the param attribute we can just read them off in groups.

private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets)
{
     ParamSets = new List<ParameterSet>();
     for (int i = 0; i < args.Length; i += 4)
     {
           ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
     }
}

Option 2 - Fixed number of extra parameters

If you want to use extra parameters in your plugin commands, one option is to define a fixed number of extra parameters that each command must pass.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
<XenCenterPlugin
	xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
	version="1">
	<MenuItem
		name="goodbye-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="goodbye"
		/>
	</MenuItem>
	<MenuItem
		name="hello-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="hello"
		/>
	</MenuItem>
	<MenuItem
		name="quiet-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="BLANK_PARAM"
		/>
	</MenuItem>
</XenCenterPlugin>

In this example you can see each command passes exactly one extra parameter, so we can read that off before moving onto the parameter sets. Commands that don't want to use all the parameters you are expecting can use a dummy keyword to keep the number of parameters consistent.

private static int numberOfExtraParams = 1;
private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets, out List<string> ExtraParams)
        {
            ExtraParams = new List<string>();
            for (int i = 0; i < numberOfExtraParams; i++)
            {
                ExtraParams.Add(args[i]);
            }
            ParamSets = new List<ParameterSet>();
            for (int i = numberOfExtraParams; i < args.Length; i += 4)
            {
                ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
            }
        }

Option 3 - Variable number of extra parameters

Here we are going to use some sort of indicator to help us know how many extra parameters there are going to be before the parameter sets start in our list of arguments. There are several ways to do this, but here we are going to use the first extra parameter as an indicator for how many further extra parameters we should expect.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
<XenCenterPlugin
	xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
	version="1">
	<MenuItem
		name="hello-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="1, goodbye"
		/>
	</MenuItem>
	<MenuItem
		name="busy-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="2, hello, goodbye"
		/>
	</MenuItem>
</XenCenterPlugin>
private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets, out List<string> ExtraParams)
        {
            int numberOfExtraParams = 0;
            numberOfExtraParams = int.Parse(args[0]);
            ExtraParams = new List<string>();
            for (int i = 0; i < numberOfExtraParams; i++)
            {
                ExtraParams.Add(args[i + 1]);
            }
            ParamSets = new List<ParameterSet>();
            for (int i = numberOfExtraParams + 1; i < args.Length; i += 4)
            {
                ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
            }
        }

This is a good technique as it only requires one extra parameter to encode the information and allows flexibility. Another alternative would be to have a marker which signifies that the extra parameters have finished:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
<XenCenterPlugin
	xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
	version="1">
	<MenuItem
		name="hello-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="goodbye, END_EXTRA_PARAMS"
		/>
	</MenuItem>
	<MenuItem
		name="busy-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
			param="hello, goodbye, END_EXTRA_PARAMS"
		/>
	</MenuItem>
</XenCenterPlugin>

Changes between revision 3 and revision 4:

 XenCenter provides parameter sets to your plugin to describe the current selection in the XenCenter resource list. See the plugin specification for the full details of the data in a parameter set.
  XenCenter provides parameter sets to your plugin to describe the current selection in the XenCenter resource list. See the [plugin specification|XenCenter Plugins] for the full details of the data in a parameter set.
  
 This page details how to deal with this information using a Shell command, which requires some thought as there are no handy global variables separating everything out as is the case with the PowerShell commands.
  
 h2. Shell commands and parameters
  
 {code}
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
 <XenCenterPlugin
  xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
  version="1">
  <MenuItem
  name="hello-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="1, goodbye"
  />
  </MenuItem>
 </XenCenterPlugin>
 {code}
When using a Shell command, your parameters are passed directly as arguments to the plugin executable. In addition to the parameter sets, you will also recieve any parameters you define in the _param_ attribute on your XML. Outlined here are several approaches you might take to parse these arguaments, with examples in C#.
  When using a Shell command, your parameters are passed directly as arguments to the plugin executable. In addition to the parameter sets, you will also receive any parameters you define in the _param_ attribute on your XML. Outlined here are several approaches you might take to parse these arguaments, with examples in C#.
  
 h4. Option 1 - No extra params
  
 {code}
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
 <XenCenterPlugin
  xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
  version="1">
  <MenuItem
  name="hello-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  />
  </MenuItem>
 </XenCenterPlugin>
 {code}
This is the simple option. We know that parameter sets come in groups of four arguaments so if none of the menu item commands which call that executable define anything in the _param_ attribute we can just read them off in groups.
  This is the simple option. We know that parameter sets come in groups of four arguments so if none of the menu item commands which call that executable define anything in the _param_ attribute we can just read them off in groups.
 {code}
 private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets)
 {
  ParamSets = new List<ParameterSet>();
  for (int i = 0; i < args.Length; i += 4)
  {
  ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
  }
 }
 {code}
  
 h4. Option 2 - Fixed number of extra parameters
  
 If you want to use extra parameters in your plugin commands, one option is to define a fixed number of extra parameters that each command must pass.
 {code}
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
 <XenCenterPlugin
  xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
  version="1">
  <MenuItem
  name="goodbye-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="goodbye"
  />
  </MenuItem>
  <MenuItem
  name="hello-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="hello"
  />
  </MenuItem>
  <MenuItem
  name="quiet-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="BLANK_PARAM"
  />
  </MenuItem>
 </XenCenterPlugin>
 {code}
 In this example you can see each command passes exactly one extra parameter, so we can read that off before moving onto the parameter sets. Commands that don't want to use all the parameters you are expecting can use a dummy keyword to keep the number of parameters consistent.
 {code}
 private static int numberOfExtraParams = 1;
 private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets, out List<string> ExtraParams)
  {
  ExtraParams = new List<string>();
  for (int i = 0; i < numberOfExtraParams; i++)
  {
  ExtraParams.Add(args[i]);
  }
  ParamSets = new List<ParameterSet>();
  for (int i = numberOfExtraParams; i < args.Length; i += 4)
  {
  ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
  }
  }
 {code}
  
 h4. Option 3 - Variable number of extra parameters
  
Here we are going to use some sort of indicator to help us know how many extra parameters there are going to be before the parameter sets start in our list of arguaments. There are several ways to do this, here we are going to use the first extra parameter as an indicator for how many further extra parameters we should expect.
  Here we are going to use some sort of indicator to help us know how many extra parameters there are going to be before the parameter sets start in our list of arguments. There are several ways to do this, but here we are going to use the first extra parameter as an indicator for how many further extra parameters we should expect.
 {code}
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
 <XenCenterPlugin
  xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
  version="1">
  <MenuItem
  name="hello-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="1, goodbye"
  />
  </MenuItem>
  <MenuItem
  name="busy-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="2, hello, goodbye"
  />
  </MenuItem>
 </XenCenterPlugin>
 {code}
 {code}
 private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets, out List<string> ExtraParams)
  {
  int numberOfExtraParams = 0;
  numberOfExtraParams = int.Parse(args[0]);
  ExtraParams = new List<string>();
  for (int i = 0; i < numberOfExtraParams; i++)
  {
  ExtraParams.Add(args[i + 1]);
  }
  ParamSets = new List<ParameterSet>();
  for (int i = numberOfExtraParams + 1; i < args.Length; i += 4)
  {
  ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
  }
  }
 {code}
 This is a good technique as it only requires 1 extra parameter to encode the information and allows flexibility. Another alternative would be to have a marker which signifies that the extra parameters have finished:
  This is a good technique as it only requires one extra parameter to encode the information and allows flexibility. Another alternative would be to have a marker which signifies that the extra parameters have finished:
 {code}
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
 <XenCenterPlugin
  xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
  version="1">
  <MenuItem
  name="hello-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="goodbye, END_EXTRA_PARAMS"
  />
  </MenuItem>
  <MenuItem
  name="busy-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  param="hello, goodbye, END_EXTRA_PARAMS"
  />
  </MenuItem>
 </XenCenterPlugin>
 {code}

Kensho

June 30, 2010 in citrix, virtualization, xen by admin

Page edited by Jeff Gee

Project Kensho v1.3 Technology Preview

Breaking News

Kensho OVF technology is now available from within XenServer 5.6. We still take feed back and provide limited support for the Project Kensho OVF Tool 1.3's Hyper-V functionality. Bring your issues and comments to the forum. We'd love to hear from you.

Introduction

Simplicity is Power. Simplicity is Project Kensho. Citrix Project Kensho provides users with powerfully simple tools that facilitate the export and import of virtual machines and virtual machine based workloads (virtual appliances) using the Open Virtual Machine Format (OVF) and Common Information Model (CIM) industry standards developed by the Distributed Management Task Force's (DMTF) Virtualization Management Initiative (VMAN).

The Project Kensho OVF Tool utilizes the OVF standard for the creation and consumption of virtual appliance packages. The Open Virtual Machine Format describes the metadata of virtual machine(s) and the behavior of the appliance when consumed by the hypervisor.

Citrix Project Kensho also provides a CIM interface to the XenServer™ API and introduces a WSMAN interface to XenServer™. 


      MyCitrix login required for download

  Resources

  Discuss in Forum

Featured Videos

Installing the Project Kensho OVF Tool

Installing XenServer CIM Interfaces

Using the Project Kensho OVF Tool

Project Kensho OVF Tool Advanced Features

Project Kensho and Hyper-V


Useful Reference

What is OVF?

Kensho OVF Technology


How It Works

Project Kensho consists of the following components:
An OVF Tool , which utilizes the OVF standard for the creation and consumption of virtual appliance packages. This utility removes much of the complexities found in conversion and packaging tools.

A CIM interface to the XenServer™ API, which also adds a WSMAN interface to XenServer™. The Xen-CIM component is required by the Project Kensho OVF Tool and installs directly on the XenServer™. It can also be used as an interface for management of XenServer™ and XenServer™ hosted virtual machines.

What's New?

Project Kensho 1.3 brings a wealth of powerfully simple features to both the Kensho OVF Tool and the CIM interface. These new features enable users to both manage a XenServer™ in new ways as well as reap the benefits of OVF in a XenServer™ and Hyper-V environment.

Kensho OVF Tool

  • Compliant with the DMTF OVF 1.0.0 specification
  • Compatibility with XenConvert 2.0 OVF content
  • Support for importing into and exporting from a user defined XenServer Storage Repository (SR)
  • OVF security features:
    • Encryption
    • Digital signing
  • OVF compression
  • Snapshot support
  • Direct import of VMware OVF content simplifying migration and consumption of VMware content

XenServer-CIM Interface

  • Support for XenServer™ 5.5
  • Storage profile support
  • Networking profile support
  • Snapshot classes

Project Kensho System Requirements

The minimum environment to use the tools consists of: Project Kensho OVF Tool Host, a supported virtual machine host, and a Windows SMB share. Project Kensho requires the following services and software to support the components of the Project Kensho OVF Tool.

Software Description
Project Kensho OVF Tool Host Project Kensho OVF Tool requires a personal computer running Windows XP, Vista or Windows Server 2003 or 2008. Windows 7 and Windows Server 2008 R2 support is experimental.
Citrix XenServer™ Citrix XenServer™ 5.0 or 5.5 is required for creating and consuming OVF based virtual appliances using XenServer™ and management of the XenServer™ environment via the Common Information Model (CIM).

The Project Kensho XenServer™ CIM installation utility provides support for management of the XenServer™ through the standards based CIM interface. It also contains a configuration script to create an ISO storage repository and creates a helper VM template for the Project Kensho OVF Tool.
Windows Server 2008 with Hyper-V The Project Kensho OVF Tool supports Windows Server 2008 with the Hyper-V Role for importing and exporting OVF based virtual appliances.

Communication between the Project Kensho OVF Tool and the Windows Server occurs through WinRM. Windows Server 2008 installs WinRM by default, no additional installation is required.
Windows Server SMB File Share The Project Kensho OVF Tool requires a Windows based UNC share to import and export OVF packages. This is called the Kensho (or OVF) Library.
The share must be accessible from the Project Kensho OVF Tool as well as any virtual machine hosts targeted for import or export.

Prerequisites

Complete the following pre-installation tasks before installing Project Kensho components:

  1. Read through this entire document
  2. Read through the Project Kensho OVF Tool Readme
  3. Setup a Windows file share:
    1. Create a file share from a Windows host
      1. Windows Server 2008 with the File Services Role provides the option of creating SMB or NFS based shares, be sure to select SMB.
      2. Windows Server 2003 and prior create SMB based shares by default.
    2. Obtain a user account and password that has change level access to this share.
  4. Project Kensho OVF Tool Host:
    1. Windows XP, Windows Server 2003, or Windows Vista.
    2. Install .NET Framework version 3.5
    3. Install WinRM
  5. XenServer™ Host:
    1. XenServer™ 5.0 or 5.5
  6. Windows Server 2008 with Hyper-V Host
    1. Add the Hyper-V role

 

Install

XenServer-CIM Interface Installation

To install the XenServer-CIM Interface on XenServer™, complete the following procedure:

Be Careful

The install script creates a hidden ISO Storage Repository and copies two ISOs into it (xenserver-linuxfixup-disk.iso and xenserver-iscsi-target.iso). It also creates a helper VM template called 'iSCSI target' from xenserver-iscsi-target.iso. These are utilized by the Project Kensho OVF Tool. Do not remove, alter or add content to this storage repository.

  1. Copy XenServerCIM-Install.tgz to the XenServer™ host to the path of: /tmp
  2. From the XenServer™ console, execute the following:
    1. cd /tmp
    2. tar - xvzf XenServer-CIM.tgz
    3. cd /XenServer-CIM
    4. Install the XenServer-CIM and WSMAN providers:
      1. bash ./install.sh
      2. Answer the prompt to set the security level of the interface.

Project Kensho OVF Tool Installation

  1. From the computer identified as the Project Kensho OVF Tool computer:
    1. Execute KenshoOVF_x86.msi or KenshoOVF_x64.msi
    2. Follow the prompts
Note

The Project Kensho OVF Tool installer must execute via "run as administrator" option on Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2.

Windows Server 2008 with Hyper-V Configuration

These steps enable WinRM, modify the Windows Firewall rules and set the appropriate authorization to access WinRM remotely with Kensho OVF Tool.

  1. At the Hyper-V host login as the administrator
  2. Open a command prompt and execute the following commands:
    1. winrm quickconfig
    2. winrm p winrm/config/service @{AllowUnencrypted="true"}
    3. winrm p winrm/config/service/auth @{Basic="true"}
    4. winrm p winrm/config/client @{AllowUnencrypted="true"}
    5. winrm p winrm/config/client/auth @{Basic="true"}

 

Uninstall

XenServer-CIM Interface Uninstall Process

  1. To uninstall the XenServer-CIM and WSMAN providers
    1. bash ./uninstall.sh
      1. If an ISO image is added to the ISO storage repository, answer the prompt to delete the 'XenServer Internal ISO library'
      2. If confirmed, the script deletes the hidden internal ISO storage repository created during install. All ISO images added into this storage repository will be deleted.

Project Kensho OVF Tool Uninstall Process

  1. To uninstall Project Kensho OVF Tool:
    1. Open Add / Remove Programs (or Programs)
    2. Select the Project Kensho OVF Tool
    3. Select Remove

 

Project Kensho Administration

This section covers general administration and use of the XenServer CIM interface for XenServer™ and the Project Kensho OVF Tool.

XenServer-CIM Interface

Once installed, the XenServer-CIM interface requires no administration. Documentation is provided within the distribution that further describes using the interface and its options.

Project Kensho OVF Tool

The Project Kensho OVF Tool is the primary utility to create and consume OVF virtual appliances. When starting the utility, an initialization process occurs. This process gathers all of the library and server information from the systems defined by the user. In some scenarios, initialization may take up to 60 seconds or more to collect all data.


Figure 1 - Initializing Indicator

After completing initialization, the main UI appears


Figure 2 - Project Kensho OVF Tool

Adding virtual machine Host(s) and OVF Library Resources:

To begin using the utility, it is necessary to add at least one virtual machine host and an OVF Library. To add a virtual machine host or Library share:

1.   From the menu bar, select File > Add Server. Alternatively, pressing the hotkey combination Alt +A or clicking the Add Server icon on the toolbar invokes the Add Server configuration window.

2.   Select the platform type from the drop down menu:

  • For a Library :
    1. Enter the server name (or IP address)
    2. Enter the share name (without slashes or subfolders)
    3. Enter the username and password
    4. Click Add .
Figure 3 - Adding a Library Server
  • For a virtual machine host:
    1. Enter the server name (or IP address)
    2. Select the Host server protocol: Unsecure or Secure (HTTP/HTTPS)
    3. Enter the username and password
    4. Click Add
Figure 4 - Adding a XenServer™ Host

3.  The window will stay open after clicking the Add button. Repeat this process for each hypervisor and or library the Project Kensho OVF Tool will manage. Click the Close button when finished adding all servers.

Note

When adding a Hyper V server the account used must be a member of the local Hyper-V host administrators group.

Creating a Virtual Appliance

After configuring a library and virtual machine host(s), the Project Kensho OVF Tool is ready to create a virtual appliance from one or more virtual machines. The virtual appliance will become an OVF package. The virtual appliance is exported from either a XenServer™ or Hyper-V host.

To export a virtual machine as an OVF virtual appliance, follow these easy steps:

1.   Select the Export Tab


Figure 5 - Export Tab

2.   Select the target library share from the Library tree view. This is where the OVF and associated VHD(s) will reside after export.

3.   From the tree view, expand the list of virtual machines under each virtual machine host.

4.   Select a virtual machine with a single click. This will place its qualified name into the Selected vMachine(s) list box. To remove the selection, double click the selection.

Be Aware

There is no limit to the number of virtual machines to select for export. The more virtual machines selected, the longer the export will take and require more storage on the Library server. The amount of time to export per virtual machine is dependent on the virtual disk size, type, and network bandwidth between the virtual machine host and the library server.

5.   Click the Export button to begin. The result will be the OVF virtual appliance package containing the virtual machine(s) selected. It is important to enusre that the OVF package is tested before assuming it is good. The next section describes the import process.

Consuming a Virtual Appliance

The Project Kensho OVF Tool can consume any DMTF compliant OVF file that contains virtual machine disk(s) in the VHD or VMDK format. The virtual appliance is imported into either a XenServer™ or Hyper-V host.

To import an OVF virtual appliance, follow these easy steps:

1.   Select the Import Tab.


*Figure 6 - Import Tab

2.   Select the target virtual machine host or hosts from the respective Host type tree view.

3.   From the Kensho Library tree view, select an OVF virtual appliance.

Note

OVA packages must be converted to OVF prior to Import. Please see: Converting an OVF package to an OVA for more information.

4.   If a virtual machine to host resource mapping is required - it is noted in the Mapping status field as Mapping: Required.

5.   Click the Mapping wizard button in the Tool bar to map virtual machine to host resources.

6.   Click the Import or Force button to begin the import.

Note

The button will display Force if mapping is either incomplete or non-existent.

During a forced import devices are attached in a first found fashion. I.E. if the OVF has a network device defined on the VM an attempt will be made to attach that network to the first virtual network switch listed on the target host.

Advanced Packaging Capabilities

New to the Project Kensho 1.3 OVF Tool is support for a wide range of OVF virtual appliance packaging options. When selecting one or more VMs to export as a virtual appliance, the utility presents the following options:


Figure 7 - Export Options

Each option is unique and may be applied to any virtual appliance export. Selecting a check box enables the feature. Some features, like security options, require user input.

  • Create OVA Package
    Selecting this option allows the user to create an OVA package. An OVA package is an archive containing OVF metadata, virtual disks, manifest and certificates in a single file. This feature is useful for scenarios where a single file containing all the necessary virtual machine components is desired. This option produces a file with an .ova extension. If a file inside of the OVF package is greater than 8 GB, the operation to create the OVA will fail.
  • Compress OVA Package
    Selecting this option allows the user to compress the entire OVA package. To enable this option, the user must select the Create OVA Package option. This option is useful when the user seeks to reduce the overall file size of the of the OVA package. This option produces a file with the .ova.gz extension.
  • Compress OVF Files Individually
    Selecting this option allows the user to compress the individual files within the OVA package. This differs from the option above in that each file within the OVA package is compressed. Selecting this option allows the user to achieve maximum compression of an OVA file. This option produces files within the OVA package with the .gz extension. The OVA package will have the .ova extension.
  • Add Manifest
    Selecting this option instructs the Project Kensho OVF Tool to create a manifest file referencing the OVF files and their checksum. This option is useful when a user seeks improved reliability of the content. This option produces a file with the .mf extension.
  • Encrypt Attached Files
    Selecting this option allows the user to encrypt the OVF related files. When selecting this option, the user must enter a passphrase. This option is useful when protecting appliance content is required.
  • Sign OVF Package
    Selecting this option allows the user to digitally sign the OVF file with a certificate. This option is useful in providing security against unauthorized changes to the OVF file content.
  • Include EULA(s)
    Selecting this option allows the user to create a virtual appliance with an End User License Agreement (EULA). This feature is useful when a virtual appliance requires end user agreement to a EULA before the virtual appliance installs on the target hypervisor. To add a EULA follow these directions:

1.   Click the Add EULA button

2.   Browse to the desired text file containing the EULA text.

Note

The EULA must be a plain text file and cannot contain any formatting (such as HTML tags) or special characters.

3.   Select the EULA text file.

4.   Click Open

  • Export Metadata Only
    Selecting this option allows the user to create an OVF without any virtual disk(s). This is useful when the user needs an OVF without virtual disk information.

Advanced Import Capabilities

New to the Project Kensho 1.3 OVF Tool is support for a range of OVF virtual appliance import options. When selecting one or more OVF virtual appliances to import, the utility presents the following options:


Figure 8 - Import Options

  • Verify Digital Signature
    Selecting this option forces the import process to verify the digital signature that was used to sign the OVF during export. If the verification fails, this typically indicates that the OVF has been tampered with.
  • Verify Manifest Content
    Selecting this option forces the import process to verify that the content of the manifest file matches what is in the OVF package. If this verification fails, it typically indicates that files are missing.
  • Validate OVF Package
    Selecting this option forces the import process to validate the selected OVF file against the DMTF OVF 1.0.0 schema. This is useful to determine the compatibility of an OVF file.
  • Import Metadata Only
    Selecting this option imports the metadata only. This is useful if configuration content is all that is needed. The virtual machine content will be created from a template or an existing virtual disk will be attached after import.
  • Run Operating System Fixups
    Selecting this option runs automated scripts against the imported VMware based virtual appliance. This is necessary to ensure the VM boots properly. Select this option for Windows or Linux virtual machines imported from VMware sources. Fixup of virtual machines with more than two virtual disks is unsupported.

VM to Host Resource Mapping Wizard

The Project Kensho OVF Tool allows users to map system, storage, and networking resources defined in the OVF virtual appliance to the resources on the virtual machine host(s). This ensures that prior to import, the proper resources are paired and the virtual machine can power on minimizing administrative tasks.

Mapping is performed by selecting items (one or more) in the left column of the Mapping dialog and then selecting a target device in the right

The padlock icon depicts that a mapping of a VM device to Host resource has been set. Individual mappings may be cleared by selecting and clearing the lock icon.

An existing OVF to Host resource mapping may be cleared by clicking the Clear button on the Import tab.

1.   Begin the resource mapping process by Clicking the Mapping button in the Tool bar

2.   The mapping wizard launches and presents the Systems tab (this is the target Host for a VM workload).


Figure 9 - Unmapped VM CPU and memory workload

3.  Select the desired host resource in the right pane

4.  Select a VM resource(s) in the left pane


8Figure 10 - VM CPU and memory workload mapped Host*

5.  Click the Next button to map the Network resources.


*Figure 11 - Mapped VM Network Device to Hypervisor Network Device

6.   Select the desired host resource in the right pane

7.   Select a VM resource(s) in the left pane

8.   Click the Next button to map the Storage resources


Figure 12 - Mapped VM Storage to Hypervisor Storage

9.    Select the desired host resource in the right pane

10.   Select a VM resource(s) in the left pane

11.   Click Done to complete the wizard, save the mapping, and return to the Import screen.

Converting an OVF package to an OVA and vice versa

The Project Kensho OVF Tool facilitates the conversion of any DMTF compliant OVF export to a single OVA file.

To convert an OVF with the Project Kensho OVF Tool:

1.   Select the Import Tab


Figure 13 - OVA Menu

2.   From the Kensho Library, select an OVF.

3.   Right click the OVF and Select 'Convert to OVA'

4.   The reverse process is used to convert an OVA into an OVF.

Note

The OVF icon depicts a folder that includes the OVF package configuration and associated file.
The OVA icon indicates an OVF package that has been compressed, using tar format, into a single file with the extension .OVA
The X icon indicates an OVF package that is not compliant with the DMTF Standards.

Environment Tab

The environment tab is a read-only view of the virtual machine host resources and environment.

Figure 14 - Environment Tab

VMware OVF Support

The Project Kensho OVF Tool facilitates importing VMware derived OVF content directly into a XenServer Storage Repository in the same manner as importing a XenConvert or Project Kensho produced OVF.

It is important to note that not all VMware OVF content is equal. VMware OVF content produced through the latest VMware utilities will result in a higher degree of import success. The following VMware OVF content has been successfully tested:

  • vSphere 4
  • Virtual Infrastructure 3
  • VMware OVF Tool 0.9
  • VMware OVF Tool 1.0
  • VMware Studio 1.0
  • VMware Workstation 6.5.3
  • VMware Converter 4.0.x
  • VMware Converter 3.0.3

Snapshot Support

The Project Kensho OVF Tool now supports creating virtual appliances from virtual machines with snapshots. Both XenServer 5.5 and Hyper-V support virtual machine snapshots.

When creating an OVF virtual appliance from a virtual machine with a snapshot, the current running state of the virtual machine is what the tool creates as a virtual appliance. This can also be described as the state that is experienced when the virtual machine is powered on.

If a virtual machine contains multiple snapshots, only the current running state of the virtual machine is exported. No snapshot history or detail is exported as part of the virtual appliance

Changes between revision 89 and revision 90:

 h1. Project Kensho v1.3 Technology Preview
  
 {anchor:OLE_LINK1} {anchor:OLE_LINK2}
 {section}
 {column:width=67%}
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  h3. {color:#00549f}Breaking News{color}
 {div}
 Kensho OVF technology is now available from within XenServer 5.6. We still take feed back and provide limited support for the Project Kensho OVF Tool 1.3's Hyper-V functionality. Bring your issues and comments to the forum. We'd love to hear from you.
  
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. {color:#00549f}Introduction{color}
 {div}
 Simplicity is Power. Simplicity is Project Kensho. Citrix Project Kensho provides users with powerfully simple tools that facilitate the export and import of virtual machines and virtual machine based workloads (virtual appliances) using the Open Virtual Machine Format (OVF) and Common Information Model (CIM) industry standards developed by the Distributed Management Task Force's (DMTF) Virtualization Management Initiative (VMAN).
  
 The Project Kensho OVF Tool utilizes the OVF standard for the creation and consumption of virtual appliance packages. The Open Virtual Machine Format describes the metadata of virtual machine(s) and the behavior of the appliance when consumed by the hypervisor.
  
 Citrix Project Kensho also provides a CIM interface to the XenServer™ API and introduces a WSMAN interface to XenServer™.&nbsp;
  
 {column}
 {column} [!button3.png!|http://download.citrix.com/English/ss/downloads/details.asp?downloadId=1682855&productId=683148]
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*MyCitrix login required for download*
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h4. *&nbsp; Resources*
  
 &nbsp; [!btn_search.png! *Discuss in Forum*|http://forums.citrix.com/forum.jspa?forumID=780]
  
 {div}
 {column}
 {section}
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}Featured Videos{color}
 {div}
 {section}
 {column}
 [!Kensho.png|align=centre,width=100,heigh=72!|http://www.citrix.com/tv/#video/956]
 {align:center}*Installing the Project Kensho OVF Tool*
 {align}
 {column}
 {column}
 [!cim.png|align=centre,width=100,heigh=72!|http://www.citrix.com/tv/#video/963]
 {align:center}*Installing XenServer CIM Interfaces*
 {align}
 {column}
 {column}
 [!cim.jpg|align=centre,width=100,heigh=72!|http://www.citrix.com/tv/#video/965]
 {align:center}*Using the Project Kensho OVF Tool*
 {align}
 {column}
 {column}
 [!image13.jpg|align=centre,width=100,heigh=60!|http://www.citrix.com/tv/#video/1006]
 {align:center}*Project Kensho OVF Tool Advanced Features*
 {align}
 {column}
 {column}
 [!image14.jpg|align=centre,width=100,heigh=60!|http://www.citrix.com/tv/#video/971]
 {align:center}*Project Kensho and Hyper-V*
 {align}
 {column}
 {section}
 \\
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}Useful Reference{color}
 {div}
  
 {section}
 {column}
 [!ProjectKensho.gif|align=centre,width=80,heigh=40!|http://community.citrix.com/download/attachments/45810048/WhatisOVF.pdf]
 {align:center}*What is OVF?*
 {align}
 {column}
 {column}
 [!ProjectKensho.gif|align=centre,width=80,heigh=40!|http://community.citrix.com/download/attachments/45810048/Kensho+OVF+Technology.pdf]
 {align:center}*Kensho OVF Technology*
 {align}
 {align}
 {column}
 {section}
 \\
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}How It Works{color}
 {div}
 Project Kensho consists of the following components:
 An *OVF Tool* , which utilizes the OVF standard for the creation and consumption of virtual appliance packages. This utility removes much of the complexities found in conversion and packaging tools.
  
 A *CIM interface* to the XenServer™ API, which also adds a WSMAN interface to XenServer™. *The Xen-CIM component is required by the Project Kensho OVF Tool* and installs directly on the XenServer™. It can also be used as an interface for management of XenServer™ and XenServer™ hosted virtual machines.
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}What's New?{color}
  
 {div}
 Project Kensho 1.3 brings a wealth of powerfully simple features to both the Kensho OVF Tool and the CIM interface. These new features enable users to both manage a XenServer™ in new ways as well as reap the benefits of OVF in a XenServer™ and Hyper-V environment.
  
 h4. Kensho OVF Tool
 * Compliant with the DMTF OVF 1.0.0 specification
 * Compatibility with XenConvert 2.0 OVF content
 * Support for importing into and exporting from a user defined XenServer Storage Repository (SR)
 * OVF security features:
  ** Encryption
  ** Digital signing
 * OVF compression
 * Snapshot support
 * Direct import of VMware OVF content simplifying migration and consumption of VMware content
  
 h4. XenServer-CIM Interface
 * Support for XenServer™ 5.5
 * Storage profile support
 * Networking profile support
 * Snapshot classes
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}Project Kensho System Requirements{color}
  
 {div}
  
 The minimum environment to use the tools consists of: Project Kensho OVF Tool Host, a supported virtual machine host, and a Windows SMB share. Project Kensho requires the following services and software to support the components of the Project Kensho OVF Tool.
 || *Software* || *Description* ||
 | Project Kensho OVF Tool Host | Project Kensho OVF Tool requires a personal computer running Windows XP, Vista or Windows Server 2003 or 2008. Windows 7 and Windows Server 2008 R2 support is experimental. |
 | Citrix XenServer™ | Citrix XenServer™ 5.0 or 5.5 is required for creating and consuming OVF based virtual appliances using XenServer™ and management of the XenServer™ environment via the Common Information Model (CIM). \\
 \\
 The Project Kensho XenServer™ CIM installation utility provides support for management of the XenServer™ through the standards based CIM interface. It also contains a configuration script to create an ISO storage repository and creates a helper VM template for the Project Kensho OVF Tool.|
 | Windows Server 2008 with Hyper-V | The Project Kensho OVF Tool supports Windows Server 2008 with the Hyper-V Role for importing and exporting OVF based virtual appliances. \\
 \\
 Communication between the Project Kensho OVF Tool and the Windows Server occurs through WinRM. Windows Server 2008 installs WinRM by default, no additional installation is required. \\
 | Windows Server SMB File Share | The Project Kensho OVF Tool requires a Windows based UNC share to import and export OVF packages. This is called the Kensho (or OVF) Library. \\
 The share must be accessible from the Project Kensho OVF Tool as well as any virtual machine hosts targeted for import or export. |
  
 h4. {color:#00549f}Prerequisites{color}
  
 Complete the following pre-installation tasks before installing Project Kensho components:
 # Read through this entire document
 # Read through the Project Kensho OVF Tool Readme
 # Setup a Windows file share:
 ## Create a file share from a Windows host
 ### Windows Server 2008 with the File Services Role provides the option of creating SMB or NFS based shares, be sure to select SMB.
 ### Windows Server 2003 and prior create SMB based shares by default.
 ## Obtain a user account and password that has change level access to this share.
 # Project Kensho OVF Tool Host:
 ## Windows XP, Windows Server 2003, or Windows Vista.
 ## Install .NET Framework version 3.5
 ## Install WinRM
 # XenServer™ Host:
 ## XenServer™ 5.0 or 5.5
 # Windows Server 2008 with Hyper-V Host
 ## Add the Hyper-V role
  
 h2. &nbsp;
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}Install{color}
  
 {div}
  
 h4. *XenServer-CIM Interface Installation*
  
 To install the XenServer-CIM Interface on XenServer™, complete the following procedure:
 {note:title=Be Careful}
 The install script creates a hidden ISO Storage Repository and copies two ISOs into it (xenserver-linuxfixup-disk.iso and xenserver-iscsi-target.iso). It also creates a helper VM template called 'iSCSI target' from xenserver-iscsi-target.iso. These are utilized by the Project Kensho OVF Tool. Do not remove, alter or add content to this storage repository.
 {note}
  
 # Copy XenServerCIM-Install.tgz to the XenServer™ host to the path of: /tmp
 # From the XenServer™ console, execute the following:
 ## *cd /tmp*
 ## *tar \- xvzf XenServer-CIM.tgz*
 ## *cd /XenServer-CIM*
 ## Install the XenServer-CIM and WSMAN providers:
 ### *bash ./install.sh*
 ### Answer the prompt to set the security level of the interface.
  
 h4. *Project Kensho OVF Tool Installation*
  
 # From the computer identified as the Project Kensho OVF Tool computer:
 ## Execute *KenshoOVF_x86.msi* or *KenshoOVF_x64.msi*
 ## Follow the prompts
  
 {info:title=Note}
 The Project Kensho OVF Tool installer must execute via "run as administrator" option on Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2.
 {info}
  
 h4. *Windows Server 2008 with* *Hyper-V Configuration*
 These steps enable WinRM, modify the Windows Firewall rules and set the appropriate authorization to access WinRM remotely with Kensho OVF Tool.
 # At the Hyper-V host login as the administrator
 # Open a command prompt and execute the following commands:
 ## *winrm quickconfig*
 ## *winrm p winrm/config/service @\{AllowUnencrypted="true"\}*
 ## *winrm p winrm/config/service/auth @\{Basic="true"\}*
 ## *winrm p winrm/config/client @\{AllowUnencrypted="true"\}*
 ## *winrm p winrm/config/client/auth @\{Basic="true"\}*
  
  
 h3. &nbsp;
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}Uninstall{color}
  
 {div}
  
 h4. *XenServer-CIM Interface Uninstall Process*
  
 # To uninstall the XenServer-CIM and WSMAN providers
 ## *bash ./uninstall.sh*
 ### If an ISO image is added to the ISO storage repository, answer the prompt to delete the 'XenServer Internal ISO library'
 ### If confirmed, the script deletes the hidden internal ISO storage repository created during install. All ISO images added into this storage repository will be deleted.
  
 h4. *Project Kensho OVF Tool Uninstall Process*
  
 # To uninstall Project Kensho OVF Tool:
 ## Open Add / Remove Programs (or Programs)
 ## Select the Project Kensho OVF Tool
 ## Select Remove
  
 h3. &nbsp;
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#00549f}Project Kensho Administration{color}
  
 {div}
 This section covers general administration and use of the XenServer CIM interface for XenServer™ and the Project Kensho OVF Tool.
  
 h4. *XenServer-CIM Interface*
  
 Once installed, the XenServer-CIM interface requires no administration. Documentation is provided within the distribution that further describes using the interface and its options.
  
 h4. *Project Kensho OVF Tool*
  
 The Project Kensho OVF Tool is the primary utility to create and consume OVF virtual appliances. When starting the utility, an initialization process occurs. This process gathers all of the library and server information from the systems defined by the user. In some scenarios, initialization may take up to 60 seconds or more to collect all data.
  
 !image1.jpg!
 {color:#4f81bd}*Figure 1 \- Initializing Indicator*{color}
  
 After completing initialization, the main UI appears
  
 !image2.jpg!
 {color:#4f81bd}*Figure 2 \- Project Kensho OVF Tool*{color}
  
 h4. *Adding virtual machine Host(s) and OVF Library Resources:*
 To begin using the utility, it is necessary to add at least one virtual machine host and an OVF Library. To add a virtual machine host or Library share:
  
 1.&nbsp;&nbsp; From the menu bar, select *File > Add Server*. Alternatively, pressing the hotkey combination *Alt \+A* or clicking the Add Server icon !addhost_16.jpg! on the toolbar invokes the Add Server configuration window.
  
 2.&nbsp;&nbsp; Select the platform type from the drop down menu:
  
 | !image3.jpg! | * *For a Library* :
 *# Enter the server name (or IP address)
 *# Enter the share name (without slashes or subfolders)
 *# Enter the username and password
 *# Click *Add* . |
 | {color:#4f81bd}*Figure 3 \- Adding a Library Server*{color} |
 | !image4.jpg! | * *For a virtual machine host:*
 *# Enter the server name (or IP address)
 *# Select the Host server protocol: Unsecure or Secure (HTTP/HTTPS)
 *# Enter the username and password
 *# Click *Add* |
 | {color:#4f81bd}*Figure 4 \- Adding a XenServer™ Host*{color} |
  
 3. &nbsp;The window will stay open after clicking the *Add* button. Repeat this process for each hypervisor and or library the Project Kensho OVF Tool will manage. Click the *Close* button when finished adding all servers.
 {info:title=Note}
 When adding a Hyper V server the account used must be a member of the local Hyper-V host administrators group.
 {info}
  
 h4. *Creating a Virtual Appliance*
 After configuring a library and virtual machine host(s), the Project Kensho OVF Tool is ready to create a virtual appliance from one or more virtual machines. The virtual appliance will become an OVF package. The virtual appliance is exported from either a XenServer™ or Hyper-V host.
  
 To export a virtual machine as an OVF virtual appliance, follow these easy steps:
  
 1.&nbsp;&nbsp; Select the Export Tab
  
 !image5.jpg!
 {color:#4f81bd}*Figure 5 \- Export Tab*{color}
  
 2.&nbsp;&nbsp; Select the target library share from the Library tree view. This is where the OVF and associated VHD(s) will reside after export.
  
 3.&nbsp;&nbsp; From the tree view, expand the list of virtual machines under each virtual machine host.
  
 4.&nbsp;&nbsp; Select a virtual machine with a single click. This will place its qualified name into the _Selected vMachine(s)_ list box. To remove the selection, double click the selection.
 {note:title=Be Aware}
 There is no limit to the number of virtual machines to select for export. The more virtual machines selected, the longer the export will take and require more storage on the Library server. The amount of time to export per virtual machine is dependent on the virtual disk size, type, and network bandwidth between the virtual machine host and the library server.
 {note}
 5.&nbsp;&nbsp; Click the Export button to begin. The result will be the OVF virtual appliance package containing the virtual machine(s) selected. It is important to enusre that the OVF package is tested before assuming it is good. The next section describes the import process.
  
  
 h4. *Consuming a Virtual Appliance*
 The Project Kensho OVF Tool can consume any DMTF compliant OVF file that contains virtual machine disk(s) in the VHD or VMDK format. The virtual appliance is imported into either a XenServer™ or Hyper-V host.
  
 To import an OVF virtual appliance, follow these easy steps:
  
 1.&nbsp;&nbsp; Select the Import Tab.
  
 !image6.jpg!
 {color:#4f81bd}*Figure 6 \- Import Tab{color}
  
 2.&nbsp;&nbsp; Select the target virtual machine host or hosts from the respective Host type tree view.
  
 3.&nbsp;&nbsp; From the Kensho Library tree view, select an OVF virtual appliance.
 {info:title=Note}
 OVA packages must be converted to OVF prior to Import. Please see: Converting an OVF package to an OVA for more information.
 {info}
  
 4.&nbsp;&nbsp; If a virtual machine to host resource mapping is required - it is noted in the Mapping status field as Mapping: Required.
  
 5.&nbsp;&nbsp; Click the Mapping wizard button !newvirtualnetwork_32.jpg! in the Tool bar to map virtual machine to host resources.
  
 6.&nbsp;&nbsp; Click the *Import* or *Force* button to begin the import.
 {info:title=Note}
 The button will display *Force* if mapping is either incomplete or non-existent.
 {info}
 During a forced import devices are attached in a first found fashion. I.E. if the OVF has a network device defined on the VM an attempt will be made to attach that network to the first virtual network switch listed on the target host.
  
  
 h4. *Advanced Packaging Capabilities*
 New to the Project Kensho 1.3 OVF Tool is support for a wide range of OVF virtual appliance packaging options. When selecting one or more VMs to export as a virtual appliance, the utility presents the following options:
  
 !image7.jpg!
 {color:#4f81bd}*Figure 7 \- Export Options*{color}
  
 Each option is unique and may be applied to any virtual appliance export. Selecting a check box enables the feature. Some features, like security options, require user input.
  
 * *Create OVA Package*
 Selecting this option allows the user to create an OVA package. An OVA package is an archive containing OVF metadata, virtual disks, manifest and certificates in a single file. This feature is useful for scenarios where a single file containing all the necessary virtual machine components is desired. This option produces a file with an .ova extension. If a file inside of the OVF package is greater than 8 GB, the operation to create the OVA will fail.
  
 * *Compress OVA Package*
 Selecting this option allows the user to compress the entire OVA package. To enable this option, the user must select the Create OVA Package option. This option is useful when the user seeks to reduce the overall file size of the of the OVA package. This option produces a file with the .ova.gz extension.
  
 * *Compress OVF Files Individually*
 Selecting this option allows the user to compress the individual files within the OVA package. This differs from the option above in that each file within the OVA package is compressed. Selecting this option allows the user to achieve maximum compression of an OVA file. This option produces files within the OVA package with the .gz extension. The OVA package will have the .ova extension.
  
 * *Add Manifest*
 Selecting this option instructs the Project Kensho OVF Tool to create a manifest file referencing the OVF files and their checksum. This option is useful when a user seeks improved reliability of the content. This option produces a file with the .mf extension.
  
 * *Encrypt Attached Files*
 Selecting this option allows the user to encrypt the OVF related files. When selecting this option, the user must enter a passphrase. This option is useful when protecting appliance content is required.
  
 * *Sign OVF Package*
 Selecting this option allows the user to digitally sign the OVF file with a certificate. This option is useful in providing security against unauthorized changes to the OVF file content.
  
 * *Include EULA(s)*
 Selecting this option allows the user to create a virtual appliance with an End User License Agreement (EULA). This feature is useful when a virtual appliance requires end user agreement to a EULA before the virtual appliance installs on the target hypervisor. To add a EULA follow these directions:
  
 1.&nbsp;&nbsp; Click the Add EULA button
  
 2.&nbsp;&nbsp; Browse to the desired text file containing the EULA text.
  
 {info:title=Note}
 The EULA must be a plain text file and cannot contain any formatting (such as HTML tags) or special characters.
 {info}
  
 3.&nbsp;&nbsp; Select the EULA text file.
  
 4.&nbsp;&nbsp; Click Open
  
 * *Export Metadata Only*
 Selecting this option allows the user to create an OVF without any virtual disk(s). This is useful when the user needs an OVF without virtual disk information.
  
  
 h4. *Advanced Import Capabilities*
 New to the Project Kensho 1.3 OVF Tool is support for a range of OVF virtual appliance import options. When selecting one or more OVF virtual appliances to import, the utility presents the following options:
  
 !image8.jpg!
 {color:#4f81bd}*Figure 8 \- Import Options*{color}
  
 * *Verify Digital Signature*
 Selecting this option forces the import process to verify the digital signature that was used to sign the OVF during export. If the verification fails, this typically indicates that the OVF has been tampered with.
  
 * *Verify Manifest Content*
 Selecting this option forces the import process to verify that the content of the manifest file matches what is in the OVF package. If this verification fails, it typically indicates that files are missing.
  
 * *Validate OVF Package*
 Selecting this option forces the import process to validate the selected OVF file against the DMTF OVF 1.0.0 schema. This is useful to determine the compatibility of an OVF file.
  
 * *Import Metadata Only*
 Selecting this option imports the metadata only. This is useful if configuration content is all that is needed. The virtual machine content will be created from a template or an existing virtual disk will be attached after import.
  
 * *Run Operating System Fixups*
 Selecting this option runs automated scripts against the imported VMware based virtual appliance. This is necessary to ensure the VM boots properly. Select this option for Windows or Linux virtual machines imported from VMware sources. Fixup of virtual machines with more than two virtual disks is unsupported.
  
  
 h4. *VM to Host Resource Mapping Wizard*
  
 The Project Kensho OVF Tool allows users to map system, storage, and networking resources defined in the OVF virtual appliance to the resources on the virtual machine host(s). This ensures that prior to import, the proper resources are paired and the virtual machine can power on minimizing administrative tasks.
  
 Mapping is performed by selecting items (one or more) in the left column of the Mapping dialog and then selecting a target device in the right
  
 The padlock icon !image007.jpg! depicts that a mapping of a VM device to Host resource has been set. Individual mappings may be cleared by selecting and clearing the lock icon.
  
 An existing OVF to Host resource mapping may be cleared by clicking the *Clear* button on the Import tab.
  
 1.&nbsp;&nbsp; Begin the resource mapping process by Clicking the Mapping button !newvirtualnetwork_32.jpg! in the Tool bar
  
 2.&nbsp;&nbsp; The mapping wizard launches and presents the Systems tab (this is the target Host for a VM workload).
  
 !image9.jpg!
 {color:#4f81bd}*Figure 9 \- Unmapped VM CPU and memory workload*{color}
  
 3.&nbsp;&nbsp;Select the desired host resource in the right pane
  
 4.&nbsp;&nbsp;Select a VM resource(s) in the left pane
  
 !image10.jpg!
 {color:#4f81bd}8Figure 10 \- VM CPU and memory workload mapped Host*{color}
  
 5.&nbsp;&nbsp;Click the *Next* button to map the Network resources.
  
 !image11.jpg!
 {color:#4f81bd}*Figure 11 \- Mapped VM Network Device to Hypervisor Network Device{color}
  
 6.&nbsp;&nbsp; Select the desired host resource in the right pane
  
 7.&nbsp;&nbsp; Select a VM resource(s) in the left pane
  
 8.&nbsp;&nbsp; Click the *Next* button to map the Storage resources
  
 !image12.jpg!
 {color:#4f81bd}*Figure 12 \- Mapped VM Storage to Hypervisor Storage*{color}
  
 9. &nbsp;&nbsp; Select the desired host resource in the right pane
  
 10.&nbsp;&nbsp; Select a VM resource(s) in the left pane
  
 11. &nbsp; Click *Done* to complete the wizard, save the mapping, and return to the Import screen.
  
 h4. *Converting an OVF package to an OVA and vice versa*
 The Project Kensho OVF Tool facilitates the conversion of any DMTF compliant OVF export to a single OVA file.
  
 To convert an OVF with the Project Kensho OVF Tool:
  
 1.&nbsp;&nbsp; Select the Import Tab
  
 !image13.jpg!
 {color:#4f81bd}*Figure 13 \- OVA Menu*{color}
  
 2.&nbsp;&nbsp; From the Kensho Library, select an OVF.
  
 3.&nbsp;&nbsp; Right click the OVF and Select 'Convert to OVA'
  
 4.&nbsp;&nbsp; The reverse process is used to convert an OVA into an OVF.
  
 {info:title=Note}
 The OVF icon !image013.jpg|width=26,height=26! depicts a folder that includes the OVF package configuration and associated file.
 The OVA icon !image014.jpg|width=26,height=26! indicates an OVF package that has been compressed, using tar format, into a single file with the extension .OVA
 The X icon !error_16.jpg|width=22,height=22! indicates an OVF package that is not compliant with the DMTF Standards.
 {info}
  
 h4. *Environment Tab*
 The environment tab is a read-only view of the virtual machine host resources and environment.
 !image14.jpg!
 {color:#4f81bd}*Figure 14 \- Environment Tab*{color}
  
 h3. {color:#00549f}VMware OVF Support{color}
  
 The Project Kensho OVF Tool facilitates importing VMware derived OVF content directly into a XenServer Storage Repository in the same manner as importing a XenConvert or Project Kensho produced OVF.
  
 It is important to note that not all VMware OVF content is equal. VMware OVF content produced through the latest VMware utilities will result in a higher degree of import success. The following VMware OVF content has been successfully tested:
  
 * vSphere 4
 * Virtual Infrastructure 3
 * VMware OVF Tool 0.9
 * VMware OVF Tool 1.0
 * VMware Studio 1.0
 * VMware Workstation 6.5.3
 * VMware Converter 4.0.x
 * VMware Converter 3.0.3
  
  
 h3.{color:#00549f}Snapshot Support{color}
  
 The Project Kensho OVF Tool now supports creating virtual appliances from virtual machines with snapshots. Both XenServer 5.5 and Hyper-V support virtual machine snapshots.
  
 When creating an OVF virtual appliance from a virtual machine with a snapshot, the current running state of the virtual machine is what the tool creates as a virtual appliance. This can also be described as the state that is experienced when the virtual machine is powered on.
  
 If a virtual machine contains multiple snapshots, only the current running state of the virtual machine is exported. No snapshot history or detail is exported as part of the virtual appliance
  
  

Configuring Debian (Lenny) 64-bit (v5.04) on XenServer 5.5

June 29, 2010 in citrix, virtualization, xen by admin

Page edited by Stephen Turner

This page provides details on how to install Debian Lenny 5.03 and 5.04 64-bit but should be repeatable for other Linux distributions and has been tested on XenServer 5.5 and XenServer 5.6 RC3.

Please note the following supportability disclaimer: Only OSs listed in the XenServer Virtual Machine Installation Guide is supported by Citrix Technical Support. The OS within this and related pages are not supported and are installed at the users own risk.

One prerequisite for this procedure is the VM be installed into an environment with working DHCP, DNS and internet access. This is due to DomU kernel updates will need to be downloaded from the internet.

Listed below is an outline of the overall process:
Installation Mode 2 (HVM mode, but can be switched into PV mode by installing/enabling PV kernel mode)

  • Create a VM is HMV mode by using the "Other install media" VM template
  • Performance a installation of the Linux guest OS,( in this case Lenny 5.04 64-bit)
  • Generate the Paravirtualised kernel and drivers
  • Use nano or vi text editor to amend "/etc/inittab"
  • Use nano or vi text editor to amend "/etc/fstab"
  • Use nano or vi text editor to amend "/boot/grub/menu.lst"
  • Shutdown VM
  • Identify <uuid> for newly created Linux guest VM
  • Execute "xe" commands to modify VM parameters for PV mode and boot.
  • Start-up VM in PV mode
  • Install XenTools

The ISO file for this distribution media can be obtained from http://cdimage.debian.org. The specific links for the 5.04 distribution is located at Debian Lenny amd64 5.04.

Procedure for Debian Lenny 5.04 64-bit

  1. Create a VM using the "Other install media" VM template.

  2. Give the new VM a name.

  3. Select the debain-504-amd64-DVD-1.iso or debain-503-amd64-DVD-1 media

  4. Select automatic placement of home server for VM is possible.

  5. Select required CPU and Memory settings for VM, (this example uses the default settings.

  6. Add virtual disk storage, ( this example uses the default 5GB settings)

  7. Select the required virtual network interface, ( this example uses the default single NIC settings)

  8. Finish VM creation and ensure VM is set to start automatically.

  9. Select "Install" from the Lenny amd64 installer boot menu.

  10. Select the required language.

  11. Select the required keyboard.

  12. Select the required country.

  13. Enter hostname.

  14. Accepted or enter DNS settings.

  15. Select the guided partition method that uses the entire disk.

  16. Select the disk partition displayed, this will reflect to disk size chosen back at step 6.

  17. Select the required disk partitioning scheme, (this example used "All files in one partition").

  18. Select "Finish partitioning and write changes to disk".

  19. Select yes to write the changes to disk.

  20. Enter a root password and confirm.

  21. Enter a new user name.

  22. Enter a password for the new user and confirm.

  23. Select "No" to scanning for another CD or DVD.

  24. Select "No" to use a network mirror (although if the VM has a working internet connection at this point, "Yes" can also be selected).

  25. Select "No" to participate in package usage survey.

  26. Use the spacebar to select or de-select the required software to install, (this example selected a standard system).

  27. Select "yes" to install the grub boot loader to master boot record, (MBR).

  28. Select "Continue" to complete Lenny Guest installation that will reboot the VM.

  29. Once the VM has booted the newly install Lenny amd64 guest operating system, login as root.

  30. Execute the command
    aptitude install linux-image-xen-amd64

    or when using Lenny 5.04

    aptitude install linux-image-2.6.26-2-xen-amd64

    should work but if in doubt execute

    aptitude search xen

    and select the latest DomU amd64 kernel image starting with linux-image.



  31. Press "y" to download the required kernel update from the internet.

  32. When the kernel has been installed and packaged be sure not to reboot the VM until three files have been edited. Use nano to edit /etc/inittab.

  33. Add the following new line at line 53
    co:2345:respawn:/sbin/getty 38400 hvc0


  34. Use nano to edit /etc/fstab switch from /dev/hd* to /dev/xvd*.

  35. Use nano to edit /boot/grub/menu.lst and change the line
    #kopt=root=/dev/hda1 ro

    to

    #kopt=root=/dev/xvda1 ro console=hvc0


  36. Also change the first two Debian GNU/Linux, kernel 2.6.26-2-xen-amd64 kernel boot lines to
    /boot/vmlinuz-2.6.26-2-xen-amd64 /root=/dev/xvda1 ro console=hvc0$

  37. Once all three files have been edited execute
    shutdown -h now

    to shutdown the VM then within XenCenter switch to the console tab of the XenServer host. At the host console, execute

    xe vm-list

    to obtain the uuid of the newly created VM.



  38. Identify the uuid for the newly created Linux guest VM then use your mouse to highlight it and right-click and select paste and copy to a text file.

  39. Execute
    xe vm-param-clear uuid=<uuid> param-name=HVM-boot-policy

    using the uuid pasted from step 38.


  40. Execute
    xe vm-param-set uuid=<uuid> PV-bootloader=pygrub

    using the uuid pasted from step 38.


  41. Execute
    xe vm-disk-list uuid=<uuid>

    using the uuid pasted from step 38.



  42. Identify the uuid for Disk 0 of the newly created Linux guest VM then use your mouse to highlight it and right-click and select paste and copy to a text file.

  43. Execute
    xe vbd-param-set uuid=<uuid> bootable=true

    using the disk uuid pasted from step 42.



  44. Start the Linux guest VM and login as root. (Please ensure that there is no CD/DVD connected or the VM may not start. Also note that if you experience any issue with the keyboard, exit and restart XenCenter).

  45. In XenCenter under the Storage tab for the VM, change the DVD drive to xs-tools.iso which is the XenTools media.

  46. Execute
    mount/dev/xvdd /mnt

    and then

    /mnt/Linux/install.sh

    When prompted to continue press "y".



  47. When the XenTools installation scripted has successfully completed you will the following message, "You should now reboot this Virtual Machine."

  48. When the VM has rebooted check the Virtualisation state in the general tab of the VM in XenCenter and if the state is "Optimised (version 5.5 installed)" then the procedure is completed.

Changes between revision 6 and revision 7:

 This page provides details on how to install Debian Lenny 5.03 and 5.04 64-bit but should be repeatable for other Linux distributions and has been tested on XenServer 5.5 and XenServer 5.6 RC3.
  
 {info}
 Please note the following supportability disclaimer: Only OSs listed in the XenServer Virtual Machine Installation Guide is supported by Citrix Technical Support. The OS within this and related pages are not supported and are installed at the users own risk.
 {info}
  
 One prerequisite for this procedure is the VM be installed into an environment with working DHCP, DNS and internet access. This is due to DomU kernel updates will need to be downloaded from the internet.
  
 Listed below is an outline of the overall process:
 Installation Mode 2 (HVM mode, but can be switched into PV mode by installing/enabling PV kernel mode)
 - Create a VM is HMV mode by using the "Other install media" VM template
 - Performance a installation of the Linux guest OS,( in this case Lenny 5.04 64-bit)
 - Generate the Paravirtualised kernel and drivers
 - Use nano or vi text editor to amend "/etc/inittab"
 - Use nano or vi text editor to amend "/etc/fstab"
 - Use nano or vi text editor to amend "/boot/grub/menu.lst"
 - Shutdown VM
 - Identify <uuid> for newly created Linux guest VM
 - Execute "xe" commands to modify VM parameters for PV mode and boot.
 - Start-up VM in PV mode
 - Install XenTools
  
 The ISO file for this distribution media can be obtained from [http://cdimage.debian.org|http://cdimage.debian.org]. The specific links for the 5.04 distribution is located at [Debian Lenny amd64 5.04|http://cdimage.debian.org/debian-cd/5.0.4/amd64/iso-dvd/].
  
 h2. Procedure for Debian Lenny 5.04 64-bit
  
 # Create a VM using the "Other install media" VM template.
 \\ !1.jpg|align=centre!\\
 # Give the new VM a name.
 \\ !2.jpg|align=centre!\\
 # Select the debain-504-amd64-DVD-1.iso or debain-503-amd64-DVD-1 media
 \\ !3.jpg|align=centre!\\
 # Select automatic placement of home server for VM is possible.
 \\ !4.jpg|align=centre!\\
 # Select required CPU and Memory settings for VM, (this example uses the default settings.
 \\ !5.jpg|align=centre!\\
 # Add virtual disk storage, ( this example uses the default 5GB settings)
 \\ !6.jpg|align=centre!\\
 # Select the required virtual network interface, ( this example uses the default single NIC settings)
 \\ !7.jpg|align=centre!\\
 # Finish VM creation and ensure VM is set to start automatically.
 \\ !8.jpg|align=centre!\\
 # Select "Install" from the Lenny amd64 installer boot menu.
 \\ !9.jpg|align=centre!\\
 # Select the required language.
 \\ !10.jpg|align=centre!\\
 # Select the required keyboard.
 \\ !11.jpg|align=centre!\\
 # Select the required country.
 \\ !12.jpg|align=centre!\\
 # Enter hostname.
 \\ !13.jpg|align=centre!\\
 # Accepted or enter DNS settings.
 \\ !14.jpg|align=centre!\\
 # Select the guided partition method that uses the entire disk.
 \\ !15.jpg|align=centre!\\
 # Select the disk partition displayed, this will reflect to disk size chosen back at step 6. !16.jpg|align=centre!\\
 # Select the required disk partitioning scheme, (this example used "All files in one partition"). !17.jpg|align=centre!\\
 # Select "Finish partitioning and write changes to disk". !18.jpg|align=centre!\\
 # Select yes to write the changes to disk. !19.jpg|align=centre!\\
 # Enter a root password and confirm. !20.jpg|align=centre!\\
 # Enter a new user name. !21.jpg|align=centre!\\
 # Enter a password for the new user and confirm. !22.jpg|align=centre!\\
 # Select "No" to scanning for another CD or DVD. !23.jpg|align=centre!\\
 # Select "No" to use a network mirror (although if the VM has a working internet connection at this point, "Yes" can also be selected). !24.jpg|align=centre!\\
 # Select "No" to participate in package usage survey. !25.jpg|align=centre!\\
 # Use the spacebar to select or de-select the required software to install, (this example selected a standard system). !26.jpg|align=centre!\\
 # Select "yes" to install the grub boot loader to master boot record, (MBR). !27.jpg|align=centre!\\
 # Select "Continue" to complete Lenny Guest installation that will reboot the VM. !28.jpg|align=centre!\\
 # Once the VM has booted the newly install Lenny amd64 guest operating system, login as root. !29.jpg|align=centre!\\
 # Execute the command
 {code}
 aptitude install linux-image-xen-amd64
 {code}
 or when using Lenny 5.04
 {code}
 aptitude install linux-image-2.6.26-2-xen-amd64
 {code}
 should work but if in doubt execute
 {code}
 aptitude search xen
 {code}
 and select the latest DomU amd64 kernel image starting with _linux-image_. !30.jpg|align=centre!\\
 \\
 # Press "y" to download the required kernel update from the internet. !31.jpg|align=centre!\\
 # When the kernel has been installed and packaged be sure not to reboot the VM until three files have been edited. Use nano to edit _/etc/inittab_. !32.jpg|align=centre!\\
 # Add the following new line at line 53
 {code}
 co:2345:respawn:/sbin/getty 38400 hvc0
 {code}
 !32b.jpg|align=centre!\\
 # Use nano to edit _/etc/fstab_ switch from _/dev/hd\*_ to _/dev/xvd\*_. !33.jpg|align=centre!\\
 # Use nano to edit _/boot/grub/menu.lst_ and change the line
 {code}
 #kopt=root=/dev/hda1 ro
 {code}
 to
 {code}
 #kopt=root=/dev/xvda1 ro console=hvc0
 {code} !34.jpg|align=centre!\\
 \\
 # Also change the first two _Debian GNU/Linux, kernel 2.6.26-2-xen-amd64_ kernel boot lines to
 {code}
  /boot/vmliuz-2.6.26-2-xen-amd64 /root=/dev/xvda1 ro console=hvc0$
  /boot/vmlinuz-2.6.26-2-xen-amd64 /root=/dev/xvda1 ro console=hvc0$
 {code} !35.jpg|align=centre!\\
 # Once all three files have been edited execute
 {code}
 shutdown -h now
 {code}
 to shutdown the VM then within XenCenter switch to the console tab of the XenServer host. At the host console, execute
 {code}
 xe vm-list
 {code}
 to obtain the uuid of the newly created VM. !36.jpg|align=centre!\\
 \\
 # Identify the uuid for the newly created Linux guest VM then use your mouse to highlight it and right-click and select paste and copy to a text file.
 !37.jpg|align=centre!\\
 # Execute
 {code}
 xe vm-param-clear uuid=<uuid> param-name=HVM-boot-policy
 {code}
 using the uuid pasted from step 38. !38.jpg|align=centre!\\
 # Execute
 {code}
 xe vm-param-set uuid=<uuid> PV-bootloader=pygrub
 {code}
 using the uuid pasted from step 38. !39.jpg|align=centre!\\
 # Execute
 {code}
 xe vm-disk-list uuid=<uuid>
 {code}
 using the uuid pasted from step 38. !40.jpg|align=centre!\\
 \\
 # Identify the uuid for Disk 0 of the newly created Linux guest VM then use your mouse to highlight it and right-click and select paste and copy to a text file. !41.jpg|align=centre!\\
 # Execute
 {code}
 xe vbd-param-set uuid=<uuid> bootable=true
 {code}
 using the disk uuid pasted from step 42. !42.jpg|align=centre!\\
 \\
 # Start the Linux guest VM and login as root. (Please ensure that there is no CD/DVD connected or the VM may not start. Also note that if you experience any issue with the keyboard, exit and restart XenCenter). !44.jpg|align=centre!\\
 # In XenCenter under the Storage tab for the VM, change the DVD drive to xs-tools.iso which is the XenTools media. !43.jpg|align=centre!\\
 # Execute
 {code}
 mount/dev/xvdd /mnt
 {code}
 and then
 {code}
 /mnt/Linux/install.sh
 {code}
 When prompted to continue press "y". !45.jpg|align=centre!\\
 \\
 # When the XenTools installation scripted has successfully completed you will the following message, "You should now reboot this Virtual Machine." !46.jpg|align=centre!\\
 # When the VM has rebooted check the Virtualisation state in the general tab of the VM in XenCenter and if the state is "Optimised (version 5.5 installed)" then the procedure is completed. !47.jpg|align=centre!\\

HelloWorld Example – C Sharp

June 28, 2010 in citrix, virtualization, xen by admin

Page edited by Stephen Turner

Introduction

In this example we will run through how to create a C# version of the HelloWorld powershell example.

It is assumed that you have read through that example for an understanding of the plugin objectives and how to package/resource your plugin.

This example will concentrate on writing a C# console app which provides the same behaviour as the PowerShell example. It also covers how to deal with the parameters which are passed into executables rather than a PowerShell script.

Requirements

The first step is to install the following requirements:

Requirement
Download Location
Microsoft Visual Studio 2008 express http://www.microsoft.com/express/downloads/
Citrix XenCenter v5.6
http://www.citrix.com/xenserver/download
XenServer C# Bindings v5.6
http://community.citrix.com/display/xs/Download+SDKs

You will also need the pre-requisites of the HelloWorld powershell example if you wish to package up the plugin as described in that example. Please refer to the other example for an explaination of how to do this.

XCPlugin file

The plugin configuration file we will be using here is similar to that in the HelloWorld powershell example, except we will be using a Shell command rather than a PowerShell command. The Shell command can target any type of executable file and passes information as parameters rather than by defining variables as the PowerShell command does.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
<XenCenterPlugin
	xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
	version="1">
	<MenuItem
		name="hello-menu-item"
		menu="view"
		serialized="none">
		<Shell
			filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
			window="true"
		/>
	</MenuItem>
</XenCenterPlugin>

Notice that we are using the window parameter set to true in this example, as we will be showing the plugin output on the console window.

C# Code

We are going to write this example in C# and compile it into an executable to target from our plugin MenuItem. Create a C# Console Application project in Visual Studio and reference in the XenServer library from the v5.6 SDK.

We can now begin editing the Program.cs file in your project. The way we handle parameters when using a Shell command is slightly different to the PowerShell Commands. Recall that each parameter set from XenCenter consists of four parameters and describes a selection in the XenCenter resource list. The first thing we do is to read off these parameters from the executable arguaments in groups of four to get each parameter set:

static void Main(string[] args)
{
   List<ParameterSet> ParamSets;
   SeparateParams(args, out ParamSets);
}

private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets)
{
   ParamSets = new List<ParameterSet>();
   for (int i = 0; i < args.Length; i += 4)
   {
      ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
   }
}

public class ParameterSet
{
   public string ServerURL = "";
   public string SessionRef = "";
   public string SelectedObjectClass = "";
   public string SelectedObjectUuid = "";

   public ParameterSet(string ServerURL, string SessionRef, string SelectedObjectClass, string SelectedObjectUuid)
   {
      this.ServerURL = ServerURL;
      this.SessionRef = SessionRef;
      this.SelectedObjectClass = SelectedObjectClass;
      this.SelectedObjectUuid = SelectedObjectUuid;
   }
}

We can now use some of same logic that we did in the PowerShell example, going through each parameter set at a time and taking a list of selected object names - also noting if the XenCenter node is selected.

bool XenCenterNodeSelected = false;
List<string> names = new List<string>();
foreach (ParameterSet pset in ParamSets)
{
	if (pset.SelectedObjectClass == "blank")
	{
		// Selecting the XenCenter node adds a parameter set per connected server, with the obj params set to "blank"
		if (XenCenterNodeSelected)
			continue;

		names.Add("XenCenter");
		XenCenterNodeSelected = true;
	}
	else if (pset.SessionRef == "null")
	{
		// Disconnected servers have no session information, and everything apart from the objects class is marked as "null"
		names.Add("a disconnected server");
	}
	else
	{
		// Use the session ref passedin by XenCenter. This means we don't have to log in or out.
		Session session = new Session(pset.ServerURL, pset.SessionRef);
		string name = "";
		// Note: Alternatively you could use reflection here to construct and execute the correct methods
		switch (pset.SelectedObjectClass.ToLowerInvariant())
		{
			case "pool":
				name = Pool.get_record(session, Pool.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
				break;
			case "vm":
				name = VM.get_record(session, VM.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
				break;
			case "host":
				name = Host.get_record(session, Host.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
				break;
			case "sr":
				name = SR.get_record(session, SR.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
				break;
			case "network":
				name = Network.get_record(session, Network.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
				break;
			case "vdi":
				name = VDI.get_record(session, VDI.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
				break;
			default:
				name = "an unknown object";
				break;
		}
		names.Add(name);
	}
}

You can see here that we switch on the class of the parameter set, collect the reference to the server object using get_by_uuid and then using that reference to get the object itself. You could remove the need to do an exhaustive switch such as this by using reflection if you desired.

Finally we output our greeting using this list of names to the console, using a sentence construct similar to the PowerShell version:

string outputString = string.Format("Hello from {0}", names[0]);
	if (names.Count > 1)
	{
		outputString += PrettySentence(names.GetRange(1, names.Count - 1));
	}
	System.Console.WriteLine(outputString);
}

private static string PrettySentence(List<string> items)
{
	string output = "";
	//we are aiming for "string_1, string_1, string_1...string_n-1 and string_n"
	for (int i = 0; i < items.Count - 1; i++)
	{
		output += string.Format(", {0}", items[i]);
	}
	output += string.Format(" and {0}", items[items.Count - 1]);
	return output;
}

If you try and execute this code you will be blocked by security failures. As part of using the SDK it is required that you define a policy for handling certificate validation.

System.Net.ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;

For the purposes of this simple example you could use the following method, but you should strongly consider implementing some validation before releasing a plugin.

// Ignore all cert validation (not recommended)
internal static bool ValidateServerCertificate(
	object sender,
	X509Certificate certificate,
	X509Chain chain,
	SslPolicyErrors sslPolicyErrors)
{
	return true;
}

The complete code, including some error handling can be found here.

Deployment

See the HelloWorld powershell example for details of how to produce your resources dll and package your files up into an installer.

Summary

This example covered the C# code you would need to write to communicate with XenServer and produce similar results to the PowerShell HelloWorld example.

  • Compile a console application using Program.cs and referencing XenServer.dll from the XenServer C# Bindings to get your executable
  • Use the HelloWorld.xcplugin.xml as your plugin configuration file
  • HelloWorld.png is an image file you can us for your icon

Put the compiled executable, the configuration file, the icon image file, and XenServer.dll and CookComputing.XmlRpcV2.dll from the XenServer C# Bindings in <XenCenterInstallDirectory>\Plugins\Citrix\HelloWorld\ and start XenCenter to see the new menu item.

Screenshots

Changes between revision 7 and revision 8:

 h2. Introduction
  
 In this example we will run through how to create a C# version of the HelloWorld [powershell example|xs:HelloWorld Example - PowerShell].
  
 It is assumed that you have read through that example for an understanding of the plugin objectives and how to package/resource your plugin.
  
 This example will concentrate on writing a C# console app which provides the same behaviour as the PowerShell example. It also covers how to deal with the parameters which are passed into executables rather than a PowerShell script.
  
 h2. Requirements
  
 The first step is to install the following requirements:
 || Requirement \\ || Download Location \\ ||
 | Microsoft Visual Studio 2008 express | [http://www.microsoft.com/express/downloads/] |
 | Citrix {nl:XenCenter} v5.6 \\ | [http://www.citrix.com/xenserver/download] |
 | XenServer C# Bindings v5.6 \\ | [http://community.citrix.com/display/xs/Download+SDKs] |
 You will also need the pre-requisites of the HelloWorld [powershell example|xs:HelloWorld Example - PowerShell] if you wish to package up the plugin as described in that example. Please refer to the other example for an explaination of how to do this.
  
 h2. XCPlugin file
  
 The plugin configuration file we will be using here is similar to that in the HelloWorld [powershell example|xs:HelloWorld Example - PowerShell], except we will be using a Shell command rather than a PowerShell command. The Shell command can target any type of executable file and passes information as parameters rather than by defining variables as the PowerShell command does.
 {code}
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE XenCenterPlugin PUBLIC "-//XENCENTERPLUGIN//DTD XENCENTERPLUGIN1//EN" "xencenter-1.dtd">
 <XenCenterPlugin
  xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
  version="1">
  <MenuItem
  name="hello-menu-item"
  menu="view"
  serialized="none">
  <Shell
  filename="Plugins\Citrix\HelloWorld\HelloWorld.exe"
  window="true"
  />
  </MenuItem>
 </XenCenterPlugin>
 {code}
 Notice that we are using the window parameter set to true in this example, as we will be showing the plugin output on the console window.
  
 h2. C# Code
  
 We are going to write this example in C# and compile it into an executable to target from our plugin MenuItem. Create a C# Console Application project in Visual Studio and reference in the XenServer library from the v5.6 SDK.
  
 We can now begin editing the Program.cs file in your project. The way we handle parameters when using a Shell command is slightly different to the PowerShell Commands. Recall that each parameter set from XenCenter consists of four parameters and describes a selection in the XenCenter resource list. The first thing we do is to read off these parameters from the executable arguaments in groups of four to get each parameter set:
 {code}
 static void Main(string[] args)
 {
  List<ParameterSet> ParamSets;
  SeparateParams(args, out ParamSets);
 }
  
 private static void SeparateParams(string[] args, out List<ParameterSet> ParamSets)
 {
  ParamSets = new List<ParameterSet>();
  for (int i = 0; i < args.Length; i += 4)
  {
  ParamSets.Add(new ParameterSet(args[i], args[i + 1], args[i + 2], args[i + 3]));
  }
 }
  
 public class ParameterSet
 {
  public string ServerURL = "";
  public string SessionRef = "";
  public string SelectedObjectClass = "";
  public string SelectedObjectUuid = "";
  
  public ParameterSet(string ServerURL, string SessionRef, string SelectedObjectClass, string SelectedObjectUuid)
  {
  this.ServerURL = ServerURL;
  this.SessionRef = SessionRef;
  this.SelectedObjectClass = SelectedObjectClass;
  this.SelectedObjectUuid = SelectedObjectUuid;
  }
 }
 {code}
 We can now use some of same logic that we did in the PowerShell example, going through each parameter set at a time and taking a list of selected object names - also noting if the XenCenter node is selected.
 {code}
 bool XenCenterNodeSelected = false;
 List<string> names = new List<string>();
 foreach (ParameterSet pset in ParamSets)
 {
  if (pset.SelectedObjectClass == "blank")
  {
  // Selecting the XenCenter node adds a parameter set per connected server, with the obj params set to "blank"
  if (XenCenterNodeSelected)
  continue;
  
  names.Add("XenCenter");
  XenCenterNodeSelected = true;
  }
  else if (pset.SessionRef == "null")
  {
  // Disconnected servers have no session information, and everything apart from the objects class is marked as "null"
  names.Add("a disconnected server");
  }
  else
  {
  // Use the session ref passedin by XenCenter. This means we don't have to log in or out.
  Session session = new Session(pset.ServerURL, pset.SessionRef);
  string name = "";
  // Note: Alternatively you could use reflection here to construct and execute the correct methods
  switch (pset.SelectedObjectClass.ToLowerInvariant())
  {
  case "pool":
  name = Pool.get_record(session, Pool.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
  break;
  case "vm":
  name = VM.get_record(session, VM.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
  break;
  case "host":
  name = Host.get_record(session, Host.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
  break;
  case "sr":
  name = SR.get_record(session, SR.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
  break;
  case "network":
  name = Network.get_record(session, Network.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
  break;
  case "vdi":
  name = VDI.get_record(session, VDI.get_by_uuid(session, pset.SelectedObjectUuid)).name_label;
  break;
  default:
  name = "an unknown object";
  break;
  }
  names.Add(name);
  }
 }
 {code}
 You can see here that we switch on the class of the parameter set, collect the reference to the server object using _get_by_uuid_ and then using that reference to get the object itself. You could remove the need to do an exhaustive switch such as this by using reflection if you desired.
  
 Finally we output our greeting using this list of names to the console, using a sentence construct similar to the PowerShell version:
 {code}
 string outputString = string.Format("Hello from {0}", names[0]);
  if (names.Count > 1)
  {
  outputString += PrettySentence(names.GetRange(1, names.Count - 1));
  }
  System.Console.WriteLine(outputString);
 }
  
 private static string PrettySentence(List<string> items)
 {
  string output = "";
  //we are aiming for "string_1, string_1, string_1...string_n-1 and string_n"
  for (int i = 0; i < items.Count - 1; i++)
  {
  output += string.Format(", {0}", items[i]);
  }
  output += string.Format(" and {0}", items[items.Count - 1]);
  return output;
 }
 {code}
 If you try and execute this code you will be blocked by security failures. As part of using the SDK it is required that you define a policy for handling certificate validation.
 {code}
 System.Net.ServicePointManager.ServerCertificateValidationCallback = ValidateServerCertificate;
 {code}
 For the purposes of this simple example you could use the following method, but you should strongly consider implementing some validation before releasing a plugin.
 {code}
 // Ignore all cert validation (not recommended)
 internal static bool ValidateServerCertificate(
  object sender,
  X509Certificate certificate,
  X509Chain chain,
  SslPolicyErrors sslPolicyErrors)
 {
  return true;
 }
 {code}\\
 The complete code, including some error handling can be found [here|^Program.cs].
 \\
 h2. Deployment
  
 See the HelloWorld [powershell example|xs:HelloWorld Example - PowerShell] for details of how to produce your resources dll and package your files up into an installer.
  
 h2. Summary
  
 This example covered the C# code you would need to write to communicate with XenServer and produce similar results to the PowerShell HelloWorld example.
  
 - Compile a project using [Program.cs|^Program.cs] to get your executable
  - Compile a console application using [Program.cs|^Program.cs] and referencing XenServer.dll from the XenServer C# Bindings to get your executable
 - Use the [HelloWorld.xcplugin.xml|^HelloWorld.xcplugin.xml] as your plugin configuration file
 - [^HelloWorld.png] is an image file you can us for your icon
  
 Put the compiled executable, the configuration file and the icon image file in <XenCenterInstallDirectory>\Plugins\Citrix\HelloWorld\ and start XenCenter to see the new menu item.
  Put the compiled executable, the configuration file, the icon image file, and XenServer.dll and CookComputing.XmlRpcV2.dll from the XenServer C# Bindings in <XenCenterInstallDirectory>\Plugins\Citrix\HelloWorld\ and start XenCenter to see the new menu item.
  
  
 h2. Screenshots
 !HelloWorldCSharpPrompt.png|align=centre!

Debian Lenny

in citrix, virtualization, xen by admin

Page edited by ian campbell - "Update for 5.0.5 point release."

Introduction

From version 5.5 onwards XenServer supports Debian GNU/Linux 5 AKA "Lenny" as a guest Virtual Machine. This includes installation of Lenny from a standard Debian network mirror as well as installation from CD/DVD image.

Note that XenServer 5.5 only supports 32 bit installations of Lenny.

Installation From DVD/CD

Unfortunately at the time of release the Official Debian installation CD and DVD ISO images did not contain a XenServer-compatible kernel and therefore cannot be used with XenServer. To remedy this Citrix has made available a custom built Unofficial DVD image containing a XenServer-compatible kernel.

Downloading A XenServer-compatible installation ISO

Citrix has made the DVD image available using the Jigdo(Jigsaw Download) utility. Jigdo allows ISO images to be downloaded quickly and efficiently by retrieving the majority of the data from a nearby mirror only obtaining a minimal template from the centralised download site.

If you have an existing Debian installation the obtaining jigdo is as simple as running

# aptitude install jigdo-file

If you do not have an existing Debian installation then jigdo can be download from its website. Jigdo is available for both Linux and Windows machines.

Once you have installed jigdo you should select a mirror from the Debian Mirror List. Choose a mirror which is geographically near to your location and which includes the i386 architecture. e.g ftp://ftp.XX.debian.org/debian/

After you have installed jigdo and selected a mirror you are ready to begin downloading the ISO from Citrix. Drop to a shell prompt or command line console. On Windows you will need to change to the directory where you unpacked jigdo.

Note: You must download the image from the URL given. The images available on Debian mirrors are not compatible with XenServer.

# jigdo-lite http://ca.downloads.xensource.com/debian/lenny/debian-505-i386-source-xen-DVD-1.jigdo

Jigdo will automatically download the template file (around 40M in size) and then will prompt you for a location to scan for existing packages. This can be useful if you have already downloaded Official Lenny images since you can reuse many of the packages on Official CDs. To do this simply mount or insert the Official CD/DVD and enter the path to it.
Next jigdo will prompt for a mirror to use, enter the mirror you selected above.

Jigdo will then begin downloading packages. If it complains about missing packages you should select another mirror and try again, this will not redownload any packages which were successfully retrieved.

When jigdo has completed it will leave debian-50-i386-source-xen-DVD-1.iso in the current directory.

Adding Additional CD/DVD Images

The custom XenServer-compatible DVD image contains a subset of the Debian software repository.

In order to access the remainder after installation you can either make use of a Debian network mirror in the normal way or you can add additional CD/DVD images using the Official images. To do this simply insert a CD/DVD into the virtual machine's CD drive and on the guest console run

# apt-cdrom add

Repeat this for as many CD/DVD images as you are interested in.

Support

If you have an issue specifically relating to the download of the custom ISO image then please comment below.

If you have any other issue relating to Debian Lenny please use the regular forums and other support channels which exist for this purpose.

Changes between revision 12 and revision 13:

 h1. Introduction
  
 From version 5.5 onwards XenServer supports [Debian GNU/Linux 5|http://www.debian.org/releases/lenny/] AKA "Lenny" as a guest Virtual Machine. This includes installation of Lenny from a standard Debian network mirror as well as installation from CD/DVD image.
  
 Note that XenServer 5.5 only supports 32 bit installations of Lenny.
  
 h1. Installation From DVD/CD
  
 Unfortunately at the time of release the Official Debian installation CD and DVD ISO images did not contain a XenServer-compatible kernel and therefore cannot be used with XenServer. To remedy this Citrix has made available a custom built Unofficial DVD image containing a XenServer-compatible kernel.
  
 h2. Downloading A XenServer-compatible installation ISO
  
 Citrix has made the DVD image available using the [Jigdo|http://atterer.net/jigdo/](Jigsaw Download) utility. Jigdo allows ISO images to be downloaded quickly and efficiently by retrieving the majority of the data from a nearby mirror only obtaining a minimal template from the centralised download site.
  
 If you have an existing Debian installation the obtaining jigdo is as simple as running
 {noformat}
 # aptitude install jigdo-file
 {noformat}
 If you do not have an existing Debian installation then jigdo can be download from its&nbsp;[website|http://atterer.net/jigdo/]. Jigdo is available for both Linux and Windows machines.
  
 Once you have installed jigdo you should select a mirror from the [Debian Mirror List|http://www.debian.org/mirror/list]. Choose a mirror which is geographically near to your location and which includes the i386 architecture. e.g {{[ftp://ftp.XX.debian.org/debian/]}}
  
 After you have installed jigdo and selected a mirror you are ready to begin downloading the ISO from Citrix. Drop to a shell prompt or command line console. On Windows you will need to change to the directory where you unpacked jigdo.
  
 (!) *Note*: You must download the image from the URL given. The images available on Debian mirrors are not compatible with XenServer. (!)
 {noformat}
  # jigdo-lite http://ca.downloads.xensource.com/debian/lenny/debian-504-i386-source-xen-DVD-1.jigdo
  # jigdo-lite http://ca.downloads.xensource.com/debian/lenny/debian-505-i386-source-xen-DVD-1.jigdo
 {noformat}
 Jigdo will automatically download the template file (around 40M in size) and then will prompt you for a location to scan for existing packages. This can be useful if you have already downloaded Official Lenny images since you can reuse many of the packages on Official CDs. To do this simply mount or insert the Official CD/DVD and enter the path to it.
 Next jigdo will prompt for a mirror to use, enter the mirror you selected above.
  
 Jigdo will then begin downloading packages. If it complains about missing packages you should select another mirror and try again, this will not redownload any packages which were successfully retrieved.
  
 When jigdo has completed it will leave debian-50-i386-source-xen-DVD-1.iso in the current directory.
  
 h2. Adding Additional CD/DVD Images
  
 The custom XenServer-compatible DVD image contains a subset of the Debian software repository.
  
 In order to access the remainder after installation you can either make use of a Debian network mirror in the normal way or you can add additional CD/DVD images using the Official images. To do this simply insert a CD/DVD into the virtual machine's CD drive and on the guest console run
 {code}
 # apt-cdrom add
 {code}
 Repeat this for as many CD/DVD images as you are interested in.
 \\
 \\
  
 h1. Support
  
 If you have an issue specifically relating to the download of the custom ISO image then please comment below.
  
 If you have any other issue relating to Debian Lenny please use the regular forums and other support channels which exist for this purpose.

HelloWorld Example – PowerShell

in citrix, virtualization, xen by admin

Page edited by Stephen Turner

Introduction

Here is a short example which will guide you through the creation of a XenCenter plugin.

Objective: We would like a new menu item in XenCenter which says "hello from ..." followed by the names of whichever objects are selected in the XenCenter resource list (treeview).

In this example we shall be using the XenServerPSSnapIn PowerShell bindings to communicate with the servers listed in XenCenter.

Requirements

The first step is to install the following requirements:

Requirement
Download Location
.Net Framework v2.0
http://msdn.microsoft.com/en-us/netframework/aa731542.aspx
.Net Framework v2.0 SDK
http://msdn.microsoft.com/en-us/netframework/aa731542.aspx
Microsoft PowerShell v1.0 http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx
Citrix XenCenter v5.6
http://www.citrix.com/xenserver/download
Citrix XenServerPSSnapIn v5.6
http://community.citrix.com/cdn/xs/sdks
Create-PluginInstaller.ps1
Create-PluginInstaller.ps1

Also create the XenServerPSSnapIn directory as described on the XenCenter Plugins page.

XCPlugin file

To add a menu item into XenCenter and call our PowerShell script we need to create a plugin configuration file.

We start with the XenCenterPlugin node with the following attributes:

  • xmlns - Specifies the schema of the XML file.
  • version - The XenCenter Plugins version, we are using version 1.
<XenCenterPlugin xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
 version="1">

To create a menu item we add a MenuItem node under the XenCenterPlugin node. We give this three attributes:

  • name - For identfying the menu item.
  • menu - The name of the menu under which the menu item should appear. Let's use the 'View' menu.
  • serialized - Decides if copies of the plugin running simutaneously are allowed for the same object. Here we do not limit this so we set to "none".
<MenuItem name="hello-menu-item" menu="view" serialized="none">

Next we add the XenServerPowerShell tag which points to a PowerShell script to run:

  • filename - The filepath of our target PowerShell script, relative to the install directory of the XenCenter executable.
  • window - Whether to show the console window which runs the script. We don't want this, lets turn it off.
<XenServerPowerShell filename="Plugins\Citrix\HelloWorld\HelloWorld.ps1" window="false" />

Close off all the tags and save as HelloWorld.xcplugin.xml. The name of this file must be the same name as the name of the plugin directory in which it resides.

Resources

The next step is to add some resources which provide strings and image paths for the plugin. These are stored in DLLs so that the correct language (if other cultures are provided) can be loaded at run-time.

First we need to create the resx file. This can be done using Visual Studio. Add strings for the menu-item labels, copyright statements, filepaths to icons etc. The names of the resources strings should be <name>.<property>, where <name> is the name given to the tag and <property> is one of the properties found in the specification. Here is the resources table for this plugin.

Name
Value
HelloWorld.description XenServer PowerShell plugin example.
HelloWorld.copyright © Citrix Systems Inc. 2009
HelloWorld.link http://community.citrix.com/xencenter
hello-menu-item.label Hello World!
hello-menu-item.description Displays 'Hello World' from the selected object.
hello-menu-item.icon Plugins\Citrix\HelloWorld\HelloWorld.png

 The final step is to convert this .resx into a DLL. We do this with two tools:

  1. ResGen.exe - Creates a .resources file from the resx. This can be found in the .NET framework SDK.
  2. Al.exe - Embeds the .resources file into a DLL. We specify we want to create a library, the file we wish to embed, that we need the invariant culture and the name of the DLL file. Al.exe is in the .NET framework directory.
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ResGen.exe HelloWorld.resx
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\al.exe /t:lib /embed:HelloWorld.resources
 /culture:0x007F /out:HelloWorld.resources.dll

Attachments: HelloWorld.resx, HelloWorld.resources.dll, HelloWorld.png

The PowerShell script

We now need to write the script, which will compile a list of names from the selected objects in the resource list and show a message box with our "Hello from ..." in it.

XenCenter will pass in parameter sets to your plugin to let you know what is selected in the resource list, and to enable you to communicate with your connected servers. PowerShell plugins can access these parameter sets from the $ObjInfoArray variable which XenCenter populates before running your script.

$ObjInfoArray

This handy variable is an array of hashmaps. Each map represents a parameter set with the following keys - for each $map in $ObjInfoArray:

  • $map["url"] - The URL of the server which owns the object selected in the tree view
  • $map["sessionRef"] - An authenticated session reference for the server (allows the script to log into the server)
  • $map["class"] - The type of the object selected: Server, VM etc
  • $map["objUuid"] - The UUID for the selected object.

You will get:

  • One parameter set per object selected in the resource list.
  • One parameter set per object in a folder if a folder is selected.
  • One parameter set per connected server if the user has the XenCenter node selected. These are provided to allow you to communicate with any server if launched from the XenCenter node, however the "class" and "objUuid" keys will be marked as blank.

Here is an example of how to use this array:

$SelectedObjectNames=@();
$XenCenterNodeSelected = 0;
#the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list
foreach($parameterSet in $ObjInfoArray)
{
	if ($parameterSet["class"] -eq "blank")
	{
		#When the XenCenter node is selected a parameter set is created for each of your connected servers with the class and objUuid keys marked as blank
		if ($XenCenterNodeSelected)
		{
			continue
		}
		$XenCenterNodeSelected = 1;
		$SelectedObjectNames += "XenCenter"
	}
	elseif ($parameterSet["sessionRef"] -eq "null")
	{
		#When a disconnected server is selected there is no session information, we get null for everything except class
		$SelectedObjectNames += "a disconnected server"
	}
	else
	{
		Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"]
		#Use $class to determine which server objects to get
		#-properties allows us to filter the results to just include the selected object
		$exp = "Get-XenServer:{0} -properties @{{uuid='{1}'}}" -f $parameterSet["class"], $parameterSet["objUuid"]
		$obj = Invoke-Expression $exp
		$SelectedObjectNames += $obj.name_label;
	}
}

Looking at that final else block you can see that before any server commands can be used we need to connect to the server. We use the sessionRef from the existing connection in XenCenter which means we don't need to provide any new credentials.

Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"]

Then when we use XenServer commands they automatically use the session from the last Connect-XenServer call. We construct an expression using the class and uuid information we were given which will retrieve the object selected in the resource list.

$exp = "Get-XenServer:{0} -properties @{{uuid='{1}'}}" -f $parameterSet["class"], $parameterSet["objUuid"]
$obj = Invoke-Expression $exp

Because being pretty is important the following bit of code constructs a nice sentence out of our list of names, but equally you could just string join your name array at this point.

$NameString = "Hello from {0}" -f $SelectedObjectNames[0];
if ($SelectedObjectNames.length -gt 1)
{
	#we are aiming for "name_1, name_2, name_3...name_n-1 and name_n"
	for ($i=1; $i -lt $SelectedObjectNames.length - 1; $i++)
	{
		$NameString += ", {0}" -f $SelectedObjectNames[$i]
	}
	$NameString += " and {0}" -f $SelectedObjectNames[$SelectedObjectNames.length - 1]
}

Finally we use .NET Windows Forms to create an alert box by loading the correct DLL.

[Reflection.Assembly]::loadwithpartialname('system.windows.forms')
[system.Windows.Forms.MessageBox]::show($NameString, "Hello World")

The full PowerShell script is HelloWorld.ps1

Deployment

The best way to distribute your XenCenter plugin is to package your plugin into a single MSI (Windows Installer) file.

Using a Windows Installer allows you to make sure the plugin is being installed into the correct place (by checking the XenCenter InstallDir registry key) and it gives versioning. A newer version will automatically uninstall the old version and then install the new one.

You can use the Create-PluginInstaller.ps1 PowerShell script to do this. The script requires WiX 2.0 and should be executed from your XenCenter install directory. The following command was used to makean msi for this plugin:

 .\Create-PluginInstaller.ps1 -out HelloWorld.msi -title "XenCenter Hello World Plugin"
 -description "Sample plugin for XenCenter" -manufacturer Citrix -upgrade_code $([System.Guid]::NewGuid().ToString())

Summary

This exampled covered all the basics of producing a MenuItem plugin for XenCenter using PowerShell. It also introduced how to resource and deploy your plugin.

Here are all the files you need to run the plugin again:

Extract them to <XenCenterInstallDirectory>\Plugins\Citrix\HelloWorld\ and launch XenCenter to see the new menu item.

Screenshots








Changes between revision 10 and revision 11:

 h2. Introduction
  
 Here is a short example which will guide you through the creation of a {nl:XenCenter} plugin.
  
 *Objective:* We would like a new menu item in {nl:XenCenter} which says "hello from ..." followed by the names of whichever objects are selected in the {nl:XenCenter} resource list (treeview).
  
 In this example we shall be using the {nl:XenServerPSSnapIn} {nl:PowerShell} bindings to communicate with the servers listed in {nl:XenCenter}.
  
 h2. *Requirements*
  
 The first step is to install the following requirements:
 || Requirement \\ || Download Location \\ ||
 | .Net Framework v2.0 \\ | [http://msdn.microsoft.com/en-us/netframework/aa731542.aspx] |
 | .Net Framework v2.0 SDK \\ | [http://msdn.microsoft.com/en-us/netframework/aa731542.aspx] |
 | Microsoft {nl:PowerShell} v1.0 | [http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx] |
 | Citrix {nl:XenCenter} v5.6 \\ | [http://www.citrix.com/xenserver/download] |
 | Citrix {nl:XenServerPSSnapIn} v5.6 \\ | [http://community.citrix.com/cdn/xs/sdks] |
 | Create\-{nl:PluginInstaller}.ps1 \\ | [HelloWorld Example - PowerShell^Create-PluginInstaller.ps1] |
  
  Also create the XenServerPSSnapIn directory as described on the [XenCenter Plugins] page.
  
 h2. XCPlugin file
  
 To add a menu item into {nl:XenCenter} and call our PowerShell script we need to create a plugin configuration file.
  
 We start with the {nl:XenCenterPlugin} node with the following attributes:
 * xmlns - Specifies the schema of the XML file.
 * version - The {nl:XenCenter} Plugins version, we are using version 1.
  
 {code:xml}
 <XenCenterPlugin xmlns="http://www.citrix.com/XenCenter/Plugins/schema"
  version="1">
 {code}
 To create a menu item we add a {nl:MenuItem} node under the {nl:XenCenterPlugin} node. We give this three attributes:
 * name - For identfying the menu item.
 * menu - The name of the menu under which the menu item should appear. Let's use the 'View' menu.
 * serialized - Decides if copies of the plugin running simutaneously are allowed for the same object. Here we do not limit this so we set to "none".
  
 {code:xml}
 <MenuItem name="hello-menu-item" menu="view" serialized="none">
 {code}
 Next we add the {nl:XenServerPowerShell} tag which points to a {nl:PowerShell} script to run:
 * filename - The filepath of our target {nl:PowerShell} script, relative to the install directory of the {nl:XenCenter} executable.
 * window - Whether to show the console window which runs the script. We don't want this, lets turn it off.
  
 {code:xml}
 <XenServerPowerShell filename="Plugins\Citrix\HelloWorld\HelloWorld.ps1" window="false" />
 {code}
 Close off all the tags and save as [HelloWorld Example - PowerShell^HelloWorld.xcplugin.xml]. The name of this file must be the same name as the name of the plugin directory in which it resides.
  
 h2. Resources
  
 The next step is to add some resources which provide strings and image paths for the plugin. These are stored in DLLs so that the correct language (if other cultures are provided) can be loaded at run-time.
  
 First we need to create the resx file. This can be done using Visual Studio. Add strings for the menu-item labels, copyright statements, filepaths to icons etc. The names of the resources strings should be _<name>.<property>_, where _<name>_ is the name given to the tag and _<property>_ is one of the properties found in the [specification|XenCenter Plugins^xc_plugins.pdf]. Here is the resources table for this plugin.
 || Name \\ || Value \\ ||
 | {nl:HelloWorld}.description | {nl:XenServer} {nl:PowerShell} plugin example. \\ |
 | {nl:HelloWorld}.copyright | © Citrix Systems Inc. 2009 |
 | {nl:HelloWorld}.link | [http://community.citrix.com/xencenter] |
 | hello-menu-item.label | Hello World\! |
 | hello-menu-item.description | Displays 'Hello World' from the selected object. |
 | hello-menu-item.icon | Plugins\Citrix\HelloWorld\HelloWorld.png |
 &nbsp;The final step is to convert this .resx into a DLL. We do this with two tools:
 # {nl:ResGen}.exe - Creates a .resources file from the resx. This can be found in the .NET framework SDK.
 # Al.exe - Embeds the .resources file into a DLL. We specify we want to create a _library_, the file we wish to _embed_, that we need the _invariant culture_ and the name of the DLL file. Al.exe is in the .NET framework directory.
  
 {noformat}
 C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\ResGen.exe HelloWorld.resx
 C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\al.exe /t:lib /embed:HelloWorld.resources
  /culture:0x007F /out:HelloWorld.resources.dll
 {noformat}
 Attachments: [HelloWorld Example - PowerShell^HelloWorld.resx], [HelloWorld Example - PowerShell^HelloWorld.resources.dll], [^HelloWorld.png]
  
 h2. The {nl:PowerShell} script
  
 We now need to write the script, which will compile a list of names from the selected objects in the resource list and show a message box with our "Hello from ..." in it.
  
 {nl:XenCenter} will pass in parameter sets to your plugin to let you know what is selected in the resource list, and to enable you to communicate with your connected servers. {nl:PowerShell} plugins can access these parameter sets from the $ObjInfoArray variable which {nl:XenCenter} populates before running your script.
  
 h3. $ObjInfoArray
  
 This handy variable is an array of hashmaps. Each map represents a parameter set with the following keys - for each $map in $ObjInfoArray:
 * *$map{*}{nl:["url"]} \- The URL of the server which owns the object selected in the tree view
 * *$map{*}{nl:["sessionRef"]} \- An authenticated session reference for the server (allows the script to log into the server)
 * *$map{*}{nl:["class"]} \- The type of the object selected: Server, VM etc
 * *$map{*}{nl:["objUuid"]} \- The UUID for the selected object.
  
 You will get:
 * One parameter set per object selected in the resource list.
 * One parameter set per object in a folder if a folder is selected.
 * One parameter set per connected server if the user has the {nl:XenCenter} node selected. These are provided to allow you to communicate with any server if launched from the {nl:XenCenter} node, however the "class" and "objUuid" keys will be marked as blank.
  
 Here is an example of how to use this array:
 {code}
 $SelectedObjectNames=@();
 $XenCenterNodeSelected = 0;
 #the object info array contains hashmaps, each of which represent a parameter set and describe a target in the XenCenter resource list
 foreach($parameterSet in $ObjInfoArray)
 {
  if ($parameterSet["class"] -eq "blank")
  {
  #When the XenCenter node is selected a parameter set is created for each of your connected servers with the class and objUuid keys marked as blank
  if ($XenCenterNodeSelected)
  {
  continue
  }
  $XenCenterNodeSelected = 1;
  $SelectedObjectNames += "XenCenter"
  }
  elseif ($parameterSet["sessionRef"] -eq "null")
  {
  #When a disconnected server is selected there is no session information, we get null for everything except class
  $SelectedObjectNames += "a disconnected server"
  }
  else
  {
  Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"]
  #Use $class to determine which server objects to get
  #-properties allows us to filter the results to just include the selected object
  $exp = "Get-XenServer:{0} -properties @{{uuid='{1}'}}" -f $parameterSet["class"], $parameterSet["objUuid"]
  $obj = Invoke-Expression $exp
  $SelectedObjectNames += $obj.name_label;
  }
 }
 {code}
 Looking at that final else block you can see that before any server commands can be used we need to connect to the server. We use the sessionRef from the existing connection in {nl:XenCenter} which means we don't need to provide any new credentials.
 {code}
 Connect-XenServer -url $parameterSet["url"] -opaqueref $parameterSet["sessionRef"]
 {code}
 Then when we use {nl:XenServer} commands they automatically use the session from the last Connect-XenServer call. We construct an expression using the class and uuid information we were given which will retrieve the object selected in the resource list.
 {code}
 $exp = "Get-XenServer:{0} -properties @{{uuid='{1}'}}" -f $parameterSet["class"], $parameterSet["objUuid"]
 $obj = Invoke-Expression $exp
 {code}
 Because being pretty is important the following bit of code constructs a nice sentence out of our list of names, but equally you could just string join your name array at this point.
 {code}
 $NameString = "Hello from {0}" -f $SelectedObjectNames[0];
 if ($SelectedObjectNames.length -gt 1)
 {
  #we are aiming for "name_1, name_2, name_3...name_n-1 and name_n"
  for ($i=1; $i -lt $SelectedObjectNames.length - 1; $i++)
  {
  $NameString += ", {0}" -f $SelectedObjectNames[$i]
  }
  $NameString += " and {0}" -f $SelectedObjectNames[$SelectedObjectNames.length - 1]
 }
 {code}
 Finally we use .NET Windows Forms to create an alert box by loading the correct DLL.
 {code}
 [Reflection.Assembly]::loadwithpartialname('system.windows.forms')
 [system.Windows.Forms.MessageBox]::show($NameString, "Hello World")
 {code}
 The full {nl:PowerShell} script is [HelloWorld Example - PowerShell^HelloWorld.ps1]
  
 h2. Deployment
  
 The best way to distribute your {nl:XenCenter} plugin is to package your plugin into a single MSI (Windows Installer) file.
  
 Using a Windows Installer allows you to make sure the plugin is being installed into the correct place (by checking the {nl:XenCenter} {nl:InstallDir} registry key) and it gives versioning. A newer version will automatically uninstall the old version and then install the new one.
  
 You can use the [HelloWorld Example - PowerShell^Create-PluginInstaller.ps1] {nl:PowerShell} script to do this. The script requires WiX 2.0 and should be executed from your XenCenter install directory. The following command was used to makean msi for this plugin:
 \\
 {noformat}
  .\Create-PluginInstaller.ps1 -out HelloWorld.msi -title "XenCenter Hello World Plugin"
  -description "Sample plugin for XenCenter" -manufacturer Citrix -upgrade_code $([System.Guid]::NewGuid().ToString())
 {noformat}
  
 h2. Summary
  
 This exampled covered all the basics of producing a MenuItem plugin for XenCenter using PowerShell. It also introduced how to resource and deploy your plugin.
  
 Here are all the files you need to run the plugin again:
 - [HelloWorld Example - PowerShell^HelloWorld.xcplugin.xml]
 - [HelloWorld Example - PowerShell^HelloWorld.resources.dll],
 - [^HelloWorld.png]
 - [HelloWorld Example - PowerShell^HelloWorld.ps1]
  
 Extract them to <XenCenterInstallDirectory>\Plugins\Citrix\HelloWorld\ and launch XenCenter to see the new menu item.
  
 h2. Screenshots
  
 \\ !PluginDialog.png|align=center!\\ !MenuItemScreen.png|align=center!\\ !HelloPromptScreen.png|align=center!\\
 \\
 \\
 \\

XenCenter

in citrix, virtualization, xen by admin

Page edited by Stephen Turner


   Permanent URL
http://community.citrix.com/xencenter     


The XenCenter team is hiring! Visit the XenCenter Jobs page for details.


   XenCenter Features

Citrix XenCenter is the Windows-native graphical user interface for managing Citrix XenServer.

Features include:

  • Full virtual machine installation, configuration and lifecycle management.
  • Access to VM consoles: VNC for installation-time, Xvnc for graphical displays on Linux, and Remote Desktop for Windows.



  • Remote storage configuration, including NetApp and DellEqualLogic StorageLink, and HBA (Fibre Channel and hardware iSCSI) support.
  • Host networking management, including VLANs and internal networks, bonded and dedicated NICs.



  • XenSearch: searching, sorting, filtering, and grouping, using tags, folders and custom fields.



  • New in XenCenter 5.6: Dynamic memory management.



  • Complete resource pool management.
  • High availability configuration.
  • Active Directory integration, for user authentication and revocation.
  • New in XenCenter 5.6: Role-based access control



  • VM snapshot management.
  • New in XenCenter 5.6: Full memory snapshots and VM rollback.



  • Workload Balancing, for pool-wide load balancing recommendations.
  • Workload Reports, giving performance views over time and across the datacenter.
  • New in XenCenter 5.6: Automated power management, to turn off idle servers.



  • Performance metrics display.
  • Long term metrics gathering and analysis.




   XenCenter Versions

The current version is XenCenter 5.6. It is capable of managing all versions between XenServer 5.0 and 5.6.


   Getting XenCenter

XenCenter is available as a Windows Installer package (.msi) from either of these places:

  the XenServer product CDs, in the client_install directory;
  from http://www.citrix.com/xenserver/download.


   XenCenter Plugins Technology Preview

In XenCenter 5.6 it is possible to add custom menu items or even whole tabs to the main window. You might do this as an ISV to integrate your own product with XenCenter, or as an end-user to integrate with your company's existing inventory management, for example.

A menu item can run a Microsoft PowerShell script or even an arbitrary executable on the client machine. Tabs are populated with a web page, and can call out to other services on your network or to your VMs.

The plugin specification and some tutorials can be found on the XenCenter Plugins page. Please leave your comments there too.

   More Information

XenServer Support Forums
XenServer 5.6 Knowledge Center


   Web Interface

Looking for a web-based alternative to XenCenter? Take a look at xvp, an open-source web interface for XenServer, developed at Durham University in the UK.

   VM Backup

Looking for a VM backup solution? Take a look at our white paper CTX122191: XenServer - Virtual Machine Backup, which describes a number of VM backup approaches, including how to use the XenServer snapshot feature in combination with your existing backup solution.


Changes between revision 36 and revision 37:

 {section}
 {column:width=75%}
 \\
 {column}
 {column}
 {tip:title=   Permanent URL}
 {pre}[http://community.citrix.com/xencenter] &nbsp;&nbsp;&nbsp;&nbsp;
 {pre}
 {tip}
 {column}
 {column:width=5%}
 \\
 {column}
 {section}
  
 {panel}
 The XenCenter team is hiring! Visit the [XenCenter Jobs] page for details.
 {panel}
  
 \\
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. {color:#003366}&nbsp;&nbsp;&nbsp;XenCenter Features{color}
 {div}
 Citrix XenCenter is the Windows-native graphical user interface for managing Citrix XenServer.
  
 Features include:
  
 !main-console.png|align=right,thumbnail=true,hspace=60!
 * Full virtual machine installation, configuration and lifecycle management.
 * Access to VM consoles: VNC for installation-time, Xvnc for graphical displays on Linux, and Remote Desktop for Windows.
  
 \\
 \\
  
 !new-sr-wizard-1.png|align=right,thumbnail=true,hspace=60!
 * Remote storage configuration, including NetApp and DellEqualLogic StorageLink, and HBA (Fibre Channel and hardware iSCSI) support.
 * Host networking management, including VLANs and internal networks, bonded and dedicated NICs.
  
 \\
 \\
  
 !main-search-menu.png|align=right,thumbnail=true,hspace=60!
 * XenSearch: searching, sorting, filtering, and grouping, using tags, folders and custom fields.
  
 \\
 \\
  
 !main-dmc.png|align=right,thumbnail=true,hspace=60!
 * *New in XenCenter 5.6*: Dynamic memory management.
  
 \\
 \\
  
 !logged-in-users.png|align=right,thumbnail=true,hspace=60!
 * Complete resource pool management.
 * High availability configuration.
 * Active Directory integration, for user authentication and revocation.
 * *New in XenCenter 5.6*: Role-based access control
  
 \\
 \\
  
 !main-snapshot.png|align=right,thumbnail=true,hspace=60!
 * VM snapshot management.
 * *New in XenCenter 5.6*: Full memory snapshots and VM rollback.
  
 \\
 \\
  
 !main-wlb.png|align=right,thumbnail=true,hspace=60!
 * Workload Balancing, for pool-wide load balancing recommendations.
 * Workload Reports, giving performance views over time and across the datacenter.
 * *New in XenCenter 5.6*: Automated power management, to turn off idle servers.
  
 \\
 \\
  
 !main-graphs.png|align=right,thumbnail=true,hspace=60!
 * Performance metrics display.
 * Long term metrics gathering and analysis.
  
 \\
 \\
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#003366}&nbsp;&nbsp;&nbsp;XenCenter Versions{color}
  
 {div}
 The current version is XenCenter 5.6. It is capable of managing all versions between XenServer 5.0 and 5.6.
  
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#003366}&nbsp;&nbsp;&nbsp;Getting XenCenter{color}
 {div}
  
 XenCenter is available as a Windows Installer package (.msi) from three places:
  XenCenter is available as a Windows Installer package (.msi) from either of these places:
  
 !Download SDKs^btn_search.png!&nbsp; the XenServer product CDs, in the {{client_install}} directory;
 !Download SDKs^btn_search.png!&nbsp; on HP and Dell embedded editions of XenServer, from XenServer itself, at {{http://<server>/XenCenter.msi}};
 !Download SDKs^btn_search.png!&nbsp; from [http://www.citrix.com/xenserver/download].
  
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#003366}&nbsp;&nbsp;&nbsp;XenCenter Plugins Technology Preview{color}
 {div}
 In XenCenter 5.6 it is possible to add custom menu items or even whole tabs to the main window. You might do this as an ISV to integrate your own product with XenCenter, or as an end-user to integrate with your company's existing inventory management, for example.
  
 A menu item can run a Microsoft PowerShell script or even an arbitrary executable on the client machine. Tabs are populated with a web page, and can call out to other services on your network or to your VMs.
  
 The plugin specification and some tutorials can be found on the [XenCenter Plugins] page. Please leave your comments there too.
 \\
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
  
 h3. {color:#003366}&nbsp;&nbsp;&nbsp;More Information{color}
 {div}
 [*XenServer Support Forums*|http://forums.citrix.com/category.jspa?categoryID=101]
 [*XenServer 5.6 Knowledge Center*|http://support.citrix.com/product/xens/v5.6/]
  
 \\
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. {color:#003366}&nbsp;&nbsp;&nbsp;Web Interface{color}
 {div}
  
 Looking for a web-based alternative to XenCenter? Take a look at [xvp], an open-source web interface for XenServer, developed at Durham University in the UK.
  
  
 {div:style=padding:3px;background-color:#EEEEEE; layer-background-color:#EEEEEE}
 h3. {color:#003366}&nbsp;&nbsp;&nbsp;VM Backup{color}
 {div}
  
 Looking for a VM backup solution? Take a look at our white paper [CTX122191: XenServer - Virtual Machine Backup|https://support.citrix.com/article/CTX122191], which describes a number of VM backup approaches, including how to use the XenServer snapshot feature in combination with your existing backup solution.
  
 \\