Archive/Using XenCenter to manage XCP

From Xen
Revision as of 22:22, 5 December 2011 by Brooks (talk | contribs)

Citrix XenCenter can be used to manage your XCP hosts, just as if it was a Citrix XenServer host.

Many users will note (and be confused by) the fact that XenCenter reports the XCP client's license is invalid or expiring.
In short, don't worry about it, XCP is free and doesn't have a license. It's just a compatibility issue.
You may further note that some features in XenCenter seem to be disabled (like snapshots).

There are some simple fixes described below to resolve these issues.

XCP 1.1 is intended to include built-in fixes for the below compatibility issues.

Fix #1 to fix API version and enable snapshots in XenCenter

From XCP 1.0 RC3 (build number > 40948) you can trick XenCenter by modifying the config file /etc/xensource/xapi_version_override which contains a single line containing the required version number.
The version number to set it to for XenCenter compatibility is 5.6.100. This is the version string of XenServer 5.6 FP1 and SP2, and will work for XCP 1.0 and 1.1.

echo "5.6.100" > /etc/xensource/xapi_version_override
/etc/init.d/xapi restart

Unfortunately after applying the above fix XenCenter reports that XenTools is outdated and some operations will fail (vm-migration)
so we apply a similar fix to make xe-guest-utilities report a XenServer compatible version. Courtesy of [http://lists.xensource.com/archives/html/xen-api/2011-10/msg00037.html]

On each Linux guest with xe-guest-utilities (Xen Tools) installed:

sed -i /usr/sbin/xe-update-guest-attrs -e 's/MajorVersion" "1"/MajorVersion" "5"/'
sed -i /usr/sbin/xe-update-guest-attrs -e 's/MinorVersion" "1"/MinorVersion" "6"/'
sed -i /usr/sbin/xe-update-guest-attrs -e 's/MicroVersion" "0"/MicroVersion" "100"/'
# wait 2 minutes and check XenCenter again


On each Windows guest with Xen Tools installed, modify the following registry values in Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\XenTools
and reboot the guest or restart the 'Citrix Tools for Virtual Machine Service' service

Name Data (hex)
MajorVersion 5
MicroVersion 6
MinorVersion 100


Fix #2 license expiry warning in XenCenter

Even with the above compatibility fix XenCenter will complain about license expiration. Since license expiration isn't an issue in XCP 1.1 we need to trick XenCenter (version 6) into thinking the compute node is still compliant by bumping the license date forward a month at a time. The expire date is stored in /var/xapi/state.db which is duplicated and stored on each compute node in the pool. Since you have no idea what, if any of the compute nodes will be live when the cron job needs to run we install the expiry fix script on all compute nodes in the pool.

vi /etc/expiry.sh
###
#!/bin/bash
#Script to fix XCP 30 License expire issue
#Script increases the month value by 1
#By: Ronny L. Bull & Alex Stuart
#Version: 1.0
#Date: 8-9-2011
 
FUTURE=`date --date="next Month" '+%Y%m%d'`
 
#stop xapi service
/etc/init.d/xapi stop
 
#Replace the expiry entry
sed -i "s/\(expiry.\{3\}\)[0-9]\{8\}/\1$FUTURE/g" /var/xapi/state.db
 
#start xapi service
/etc/init.d/xapi start

###
bash /etc/expiry.sh

This could be setup as an automated task if desired.

vi /etc/cron.monthly/license-fix  
#!/bin/sh

/etc/expiry.sh 

exit 0

Fix #3 to enable the Import feature of XenCenter

Insert the Citrix XenServer disc or mount the ISO on the XCP server

mount /dev/cdrom /mnt
cd /mnt/packages.transfer-vm/
rpm -ivh xenserver-transfer-vm-6.0.0-50762p.noarch.rpm (this RPM may rename with different releases)

You can now use File -> Import from within XenCenter to migrate virtual machines from other technologies such as VMware or Xen Desktop