Virtualization - addCitrixXenServerHost
Virtualization - addCitrixXenServerHost
Description :
This command creates a Citrix XenServer Host and enrolls it in the system. The XenServer Host is the entity manager on which you can create Citrix virtual guests. For information on creating Citrix virtual guests, see the introductory chapter, Virtualization concepts.
You can specify the following properties in the property list:
- CUSTOMER: Optional customer name.
- AGENTLESS_MANAGED_OBJECT_ICON_FILE*: Optional. This icon file appears in the extended properties panel in the BMC Server Automation GUI, and is normally consumed by other application code (for example, CSM). If you do not set this property, it is automatically set to XenServer.gif.
- AGENTLESS_MANAGED_OBJECT_PROXY_HOST* : Mandatory. Fully qualified host name of the AMO proxy.
- CUSTOM_OBJECTS_ENVIRONMENT*: You use a custom object to manage the XenServer host in the BMC Server Automation system. You need to set the CUSTOM_OBJECTS_ENVIRONMENT property to a property set instance that specifies various values used by the custom object. The most common settings are JPA_JAVA_HOME (to set Java Home), JPA_JVM_ARGUMENTS (arguments to debug, etc.), and JPA_JVM_LIB (location of lib file). See the example for information on how to create and populate the property set instance.
- VIRTUALIZATION* : Optional. Sets the virtual entity type for the Citrix XenServer you are creating. If you do not set this, it is automatically set to Citrix XenServer Host.
Return type : String
Command Input :
Variable Name | Variable Type | Description |
---|---|---|
amoName | String | Host name of the AMO (in this case the Citrix XenServer). |
propertyList | String | Comma-separated property list. |
Example
The following example creates a Citrix XenServer Host and enrolls it in the system.
Script
CUSTOM_OBJECT_ENV_PSI=test_co_psi
# AMO_PROXY_HOST represents the proxy server on which you have installed an RSCD agent.
AMO_PROXY_HOST=test_server
# CITRIX_SERVER_NAME represents the Citrix XenServer host. This is an agentless managed object (AMO) that does NOT have an RSCD agent installed on it.
CITRIX_SERVER_NAME=test_amo_citrix
CITRIX_URL=test_url
CITRIX_USER=test_user
CITRIX_PASSWORD=test_password
CITRIX_ENCODED_PASSWORD=`blenc $CITRIX_PASSWORD | grep ^BLencrypt: | cut -f2 -d: | tr -d '[:cntrl:]' `
# Add a new property set instance for the Custom Objects Environment. Note that this new instance contains the Java locations.
blcli PropertyInstance createInstance "Class://SystemObject/Custom Objects Environment" $CUSTOM_OBJECT_ENV_PSI "my description" "JPA_JAVA_HOME*=/opt/bmc/BladeLogic/8.1/NSH/daal/Implementation/BMC_Citrix_Root_rhas4_x86_64/rhas4_x86_64/jre1.6.0_20,JPA_JVM_LIB*=/opt/bmc/BladeLogic/8.1/NSH/daal/Implementation/BMC_Citrix_Root_rhas4_x86_64/rhas4_x86_64/jre1.6.0_20/lib/amd64/server/libjvm.so"
# Add a new Citrix XenServer Host. Note that the CUSTOM_OBJECTS_ENVIRONMENT* property points to the new property set instance you just created, $CUSTOM_OBJECT_ENV_PSI
blcli Virtualization addCitrixXenServerHost $CITRIX_SERVER_NAME "AGENTLESS_MANAGED_OBJECT_PROXY_HOST*=Class://SystemObject/Server/$AMO_PROXY_HOST,CUSTOM_OBJECTS_ENVIRONMENT*=Class://SystemObject/Custom Objects Environment/$CUSTOM_OBJECT_ENV_PSI"
# As part of the creation process, the addCitrixXenServerHost command creates a new Connection property set instance (in this example, the new instance is called Connection_$CITRIX_SERVER_NAME). This new instance contains the CONNECTION_URL, CONNECTION_USER, and CONNECTION_PASSWORD properties.
# Update this newly created Connection property set instance
blcli PropertyInstance setOverriddenValue Class://SystemObject/Connection/Connection_$CITRIX_SERVER_NAME CONNECTION_URL $CITRIX_URL
blcli PropertyInstance setOverriddenValue Class://SystemObject/Connection/Connection_$CITRIX_SERVER_NAME CONNECTION_USER $CITRIX_USER
blcli PropertyInstance setOverriddenValue Class://SystemObject/Connection/Connection_$CITRIX_SERVER_NAME CONNECTION_PASSWORD $CITRIX_ENCODED_PASSWORD
# The steps below show an example of how to distribute a Citrix XenServer custom object (CO) to the newly added Citrix XenServer Host.
JOB_GROUP_ID=`blcli JobGroup groupNameToId /Distribute`
# Create a new Distribute CO Job in the given Job Group
JOB_KEY=`blcli DistributeConfigurationObjectsJob createDistributeConfigurationObjectsJob "Distribute Citrix CO" $JOB_GROUP_ID true`
# Add the Citrix CO to the Distribute CO Job. Note that the Citrix CO is represented by the constant BMC_Citrix_Root. This constant always gets the most recent version of the Citrix CO.
JOB_KEY=`blcli DistributeConfigurationObjectsJob addLatestGlobalConfigObjectVersionToJob $JOB_KEY BMC_Citrix_Root`
# Add the Citrix Server to the Distribute CO Job.
JOB_KEY=`blcli Job addTargetServer $JOB_KEY $CITRIX_SERVER_NAME`
blcli Job execute $JOB_KEY
#To obtain the results of the Job Run, you can run the commands below after the job run is complete
JOB_RUN_ID=`blcli JobRun findLastRunKeyByJobKey $JOB_KEY`
JOB_RUN_RESULT=`blcli JobRun getJobRunHadErrorsById $JOB_RUN_ID`
# AMO_PROXY_HOST represents the proxy server on which you have installed an RSCD agent.
AMO_PROXY_HOST=test_server
# CITRIX_SERVER_NAME represents the Citrix XenServer host. This is an agentless managed object (AMO) that does NOT have an RSCD agent installed on it.
CITRIX_SERVER_NAME=test_amo_citrix
CITRIX_URL=test_url
CITRIX_USER=test_user
CITRIX_PASSWORD=test_password
CITRIX_ENCODED_PASSWORD=`blenc $CITRIX_PASSWORD | grep ^BLencrypt: | cut -f2 -d: | tr -d '[:cntrl:]' `
# Add a new property set instance for the Custom Objects Environment. Note that this new instance contains the Java locations.
blcli PropertyInstance createInstance "Class://SystemObject/Custom Objects Environment" $CUSTOM_OBJECT_ENV_PSI "my description" "JPA_JAVA_HOME*=/opt/bmc/BladeLogic/8.1/NSH/daal/Implementation/BMC_Citrix_Root_rhas4_x86_64/rhas4_x86_64/jre1.6.0_20,JPA_JVM_LIB*=/opt/bmc/BladeLogic/8.1/NSH/daal/Implementation/BMC_Citrix_Root_rhas4_x86_64/rhas4_x86_64/jre1.6.0_20/lib/amd64/server/libjvm.so"
# Add a new Citrix XenServer Host. Note that the CUSTOM_OBJECTS_ENVIRONMENT* property points to the new property set instance you just created, $CUSTOM_OBJECT_ENV_PSI
blcli Virtualization addCitrixXenServerHost $CITRIX_SERVER_NAME "AGENTLESS_MANAGED_OBJECT_PROXY_HOST*=Class://SystemObject/Server/$AMO_PROXY_HOST,CUSTOM_OBJECTS_ENVIRONMENT*=Class://SystemObject/Custom Objects Environment/$CUSTOM_OBJECT_ENV_PSI"
# As part of the creation process, the addCitrixXenServerHost command creates a new Connection property set instance (in this example, the new instance is called Connection_$CITRIX_SERVER_NAME). This new instance contains the CONNECTION_URL, CONNECTION_USER, and CONNECTION_PASSWORD properties.
# Update this newly created Connection property set instance
blcli PropertyInstance setOverriddenValue Class://SystemObject/Connection/Connection_$CITRIX_SERVER_NAME CONNECTION_URL $CITRIX_URL
blcli PropertyInstance setOverriddenValue Class://SystemObject/Connection/Connection_$CITRIX_SERVER_NAME CONNECTION_USER $CITRIX_USER
blcli PropertyInstance setOverriddenValue Class://SystemObject/Connection/Connection_$CITRIX_SERVER_NAME CONNECTION_PASSWORD $CITRIX_ENCODED_PASSWORD
# The steps below show an example of how to distribute a Citrix XenServer custom object (CO) to the newly added Citrix XenServer Host.
JOB_GROUP_ID=`blcli JobGroup groupNameToId /Distribute`
# Create a new Distribute CO Job in the given Job Group
JOB_KEY=`blcli DistributeConfigurationObjectsJob createDistributeConfigurationObjectsJob "Distribute Citrix CO" $JOB_GROUP_ID true`
# Add the Citrix CO to the Distribute CO Job. Note that the Citrix CO is represented by the constant BMC_Citrix_Root. This constant always gets the most recent version of the Citrix CO.
JOB_KEY=`blcli DistributeConfigurationObjectsJob addLatestGlobalConfigObjectVersionToJob $JOB_KEY BMC_Citrix_Root`
# Add the Citrix Server to the Distribute CO Job.
JOB_KEY=`blcli Job addTargetServer $JOB_KEY $CITRIX_SERVER_NAME`
blcli Job execute $JOB_KEY
#To obtain the results of the Job Run, you can run the commands below after the job run is complete
JOB_RUN_ID=`blcli JobRun findLastRunKeyByJobKey $JOB_KEY`
JOB_RUN_RESULT=`blcli JobRun getJobRunHadErrorsById $JOB_RUN_ID`
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*