Citrix Xenserver is a beautiful open source (from 6.2 edition and later) hypervisor that tries to grab as much as possible market share on virtualization/cloud world. It carries many years of development efforts by Citrix, many well established implementations and a broad support community.
XenMotion, High Availability and all the great features of Xenserver are available on the licensed and unlicensed versions of the hypervisor. The licensed version includes automated patches and updates through XenCenter console and 24×7 Citrix Technical Support. On the unlicensed version, the administrator should apply the xenserver patches by himself through an ssh console. XenCenter still notifies the availability of new patches.
So, on XenCenter when you goto Tools – Install Updates, you get grayed out options like this
So, first of all we should download the new patches from Citrix webserver, XenCenter will help you to do so. Then unzip the contents of the downloaded files and secure ftp them on XenServer.
I use filezilla to sftp the updates to XenServer in binary transfer mode and upload them to /var/tmp directory. Then ssh to XenServer (I use putty utility to do so but you can use anything you are comfortable with). Login as root and run the following command
xe patch-upload file-name=/var/tmp/<update file>
this command produces a uuid alphanumeric string. Copy it to the clipboard and on XenCenter notice the yellow down icons that appear, indicating that a hotfix or update exists but has not been applied.
Run
xe patch-pool-apply uuid=<uuid>
pasting the uuid string. You may verify the applied patches by running
xe patch-list
If the update has been successful, the hosts field should contain the uuids of all the hosts in the pool. Finally, run
xe-toolstack-restart
to reload the toolstack on all hosts, you may loose the connection if you run it on Pool Master.
Now, your XenServer is patched!
A script to automatically download the patch files and apply them would be cool. Does patch-pool-apply have to read the files from a directory on a xenserver (i.e., /var/tmp), or could I have the files on my storage box? I guess I’d have to mount the share, right?
Also, could I run the command from my XenCenter machine, providing the host-uuid param for the pool master?
OT, I’m going to attempt an 5.6SP2 –> 6.2 RPU this weekend.. Caveats? Wish me luck!
Pete, you can easily create a script to either ftp the updates or mount a USB storage (by ssh) and ssh the update commands. Putty has a scripting utility.
Good luck with your project!
There is one now 🙂 -https://github.com/dalgibbard/citrix_xenserver_patcher
Pulls the updates directly from Citrix’s site, and auto-obtains a list of required updates from Citrix’s XML API.
Frilliant! I’ll let you know my results. 🙂
This is amazing script, works perfect for xen server 6.2
I haven’t tried the script yet, but the rolling pool upgrade worked nicely, after which I manually patched. Now I see there’s another patch available – perhaps I’ll try the script this time.
Thank you for this article as it was super simple to follow! I’m a bit of scripting nerd 🙂 so here’s a slightly easier command than having to mess around with GUID’s:
xe patch-pool-apply uuid=`xe patch-upload file-name=/var/tmp/XS62E005.xsupdate`
Those are tick signs (where tilde key is, next to 1 on top of the keyboard) which mean EXECUTE this command inside of the ticks and feed the output to initial command. This way you never even see the GUID as it’s done under the hood.
All the best!
Pingback: First time (and second time…) Citrix XenServer install | Andrew's Blog
i got this with two updates The uuid you supplied was invalid.
type: pool_patch
uuid: any reason why should i just ignore them
Used script, worked perfect , did patch 3 xernserver hosts.
Thanks
Pingback: How to Upgrade XenServer: The Complete Guide | Mike Graham - Tips and Tricks for the world of IT
Thanks,very helpful,nice job
I meet a error when run that script “Getting host list using: /opt/xensource/bin/xe host-list name-label=`grep “^HOSTNAME=” /etc/sysconfig/network | awk -F= ‘{print$2}’` params=uuid –minimal
Detected HOST UUID:
Error: Failed to obtain HOSTUUID from XE CLI”
Help me
Nice article. I have a xenpool that has two hosts are running. xenserver 6.2. Without patching and reboot all hosts at once, is it possible to patch one server, reboot, then migrate the VMs into the patched host, then patch the 2nd host? If this is possible, do I need to patch xenpool master first, or can I do the 2nd host first, then pool master last?
What is proper way to do this without bring down the VMs and patch the hosts?
thanks