When you create a custom script, run it from the command line each time you want to control power remotely on XenServer. Alternatively, you can specify it in XenCenter and use the XenCenter UI features to interact with it.
The XenServer API is documented in the document, the [Citrix XenServer Management API], which is available from the Citrix Web site.
Note:
Do not modify the scripts provided by default in the /etc/xapi.d/plugins/ directory. You can include new scripts in this directory, but you should never modify the scripts contained in that directory after installation.
Key/Value Pairs
To use Host Power On, you must configure the host.power_on_mode and host.power_on_config keys. Their values are provided below.
There is also an API call that lets you set these fields all at once:
void host.set_host_power_on_mode(string mode, Dictionary<string,string> config)
host.power_on_mode
•Definition: This contains key/value pairs to specify the type of
•Possible values:
•An empty string, representing
•"iLO". Lets you specify HP iLO.
•"DRAC". Lets you specify Dell DRAC. To use DRAC, you must have already installed the Dell supplemental pack.
•
•Any other name (used to specify a custom
•Type: string
host.power_on_config
•Definition: This contains key/value pairs for mode configuration. Provides additional information for iLO and DRAC.
•Possible values:
•If you configured iLO or DRAC as the type of
•"power_on_ip". This is the IP address you specified configured to communicate with the
•"power_on_user". This is the iLO or DRAC user name that is associated with the management processor, which you may or may not have changed from its factory default settings.
•"power_on_password_secret". Specifies using the secrets feature to secure your password.
•To use the secrets feature to store your password, specify the key "power_on_password_secret".
•Type: Map (string,string)
Sample Script
This sample script imports the XenServer API, defines itself as a custom script, and then passes parameters specific to the host you want to control remotely. You must define the parameters session, remote_host, and power_on_config in all custom scripts.
32