Archive/Using XenCenter to manage XCP

From Xen
Jump to navigationJump to search

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.

Note: As of 2012/12 using XenCenter version 6.1 and XCP version 1.6.10 fixes one and two were not required. XenCenter now correctly recognises the XCP server including build and version numbers, and allows management of all XCP features without limiting it to XenServer free edition features.

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:
Server 2003/XP - Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\XenTools
Server 2008 64-bit - Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\XenTools

Name Data (hex)
MajorVersion 5
MinorVersion 6
MicroVersion 100


Then reboot the guest or restart the 'Citrix Tools for Virtual Machine Service' service

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

chmod 0755 /etc/cron.monthly/license-fix

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




For those experimenting with XCP 1.5beta (1.4.90)

As some of you may have noticed, there is a beta version of XCP 1.5 (currently numbered 1.4.90) available from the download server since Feb 07th 2012. (See: [1] for released version)

There are some differences regarding neccessary compatibility fixes if you want XenCenter to work nicely with XCP 1.4.90, and I'll post here what I've personally found out so far - for those eager to try themselves:

Regarding Fix #1 (xapi_version_override):

This doesn't seem to work with XCP 1.4.90 (but may work with later releases). For now, you need to do a binary patch of /opt/xensource/bin/xapi. Otherwise XenCenter will always recognize XCP as a very old XenServer release and this causes trouble in many situations. To do the binary patch, do the following on every XCP 1.4.90 host:

cd /opt/xensource/bin
/etc/init.d/xapi stop
cp -vp xapi xapi.original
sed -i 's/1\.4\.90/6.0.99/g' xapi
/etc/init.d/xapi start

After re-connecting XenCenter to the XCP host, it will be identified as a XenServer 6.0 host, enabling all the wonderful modern features and fixing some strange behavior you may have encountered before patching.

Btw., of course there is no 6.0.99 version of XenServer, but it should be the highest value the version identification of XenServer 6.0 should ever reach (unless there's a new service/feature pack or completely new version released), so it should be the best setting to get all features in XenCenter 6.0 for any 6.0-compatible XCP release.

As mentioned above in the Fix #1 section, XenCenter will complain about the official XCP Xen Tools being outdated, since they also report 1.4.90 as version identification.

Taking the fixes for XenTools as described above and modifying them for XCP 1.4.90, they now look like this:

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

sed -i /usr/sbin/xe-update-guest-attrs -e 's/MajorVersion" "1"/MajorVersion" "6"/'
sed -i /usr/sbin/xe-update-guest-attrs -e 's/MinorVersion" "4"/MinorVersion" "0"/'
sed -i /usr/sbin/xe-update-guest-attrs -e 's/MicroVersion" "90"/MicroVersion" "99"/'
# wait 2 minutes and check XenCenter again (or just execute /usr/sbin/xe-update-guest-attrs )

On each Windows guest with Xen Tools installed, modify the following registry values:

Server 2003/XP

  • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\XenTools

Server 2008 64-bit

  • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\XenTools

Server 2008 R2

  • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\XenTools
  • Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\XenTools


Name Data (hex)
MajorVersion 6
MinorVersion 0
MicroVersion 99

(Only decimal values shown here, Windows Registry will show both decimal and hex.)

.reg file for Server 2008 R2

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Citrix\XenTools]
"MajorVersion"=dword:6
"MinorVersion"=dword:0
"MicroVersion"=dword:63

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Citrix\XenTools]
"MajorVersion"=dword:6
"MinorVersion"=dword:0
"MicroVersion"=dword:63

Then reboot the Windows guest or restart the 'Citrix Tools for Virtual Machine Service' service. Restarting XenTools on Windows command line (cmd) works like this:

net stop xensvc
net start xensvc


Regarding Fix #2 (license expiry):

It seems that XCP 1.4.90 comes with something like a local license server (at 127.0.0.1) preinstalled and preconfigured. So far, I didn't get any expirating warning in XenCenter at all. XenCenter 6.0 License Manager recognizes the host like this:

XenServer Version: 6.0.99

XenServer Edition: Citrix XenServer

Expires: Never

Noticing this, I felt an extreme urge to try out Citrix Web Self Service (WSS) Virtual Appliance (you must be logged in with your Citrix.com account to see all downloads, then click "Show Download" for the Enterprise Edition) on my XCP 1.4.90 host.

This appliance usually requires the paid XenServer 6.0 Enterprise Edition to work, but what a surprise, it works just fine on free XCP 1.4.90! It seems unable to check the XCP license at all (at least on a single host, I didn't try a multi-machine XCP pool yet) and continues nevertheless.

This way, you can host virtual machines not only for yourself, but for others as well, and offer those others a way to control their own VMs on your host in a safe way without a chance to modify anything else where their tiny little fingers don't belong. ;-)


Regarding Fix #3 (enable the Import feature of XenCenter):

You can definitely ignore this section if you're using XCP 1.4.90+, it has it's own version of the said RPM file already installed, so you can import VMs right out-of-the-box with XenCenter.


Also XCP 1.4.90 doesn't need a Linux Extra Disc at installation point, the base package supports all the usual Linux distributions out-of-the-box as well. First thing I tried was a network install of CentOS 6 x64 (template "CentOS 6.0 (64-bit) (experimental)"). It works fine so far and of course its fully Xen-aware, using Xen Virtual Disks, Xen Network Interface and Xen Tools (XCP-provided, not taken from XenServer) for resource reporting and VM-migrate feature.

As far as I've found out yet, XCP 1.4.90 (with 6.0.99 version patch) w/ XenCenter 6.0 supports the following exciting features for free:

Dynamic Memory Assignment (RAM): fixed RAM or min/max RAM per VM

Live Snapshots of a VM's virtual disk, optionally including machine state (RAM), machine state requires at least Enterprise Edition in commercial XenServer!

able to take scheduled snapshots automatically, you can define how often to take a snapshot and how many snapshots to keepper VM (oldest gets deleted first when limit is reached)


I hope you'll find my additional content in this article useful.

--Mas1701 03:53, 13 February 2012 (UTC) Updated --Mas1701 20:29, 16 February 2012 (UTC)