XenServer 5.0 SDKs Released to Web
Incase you haven’t heard, the XenServer 5.0 SDKs have been released. Here’s a short summary of them:
- New XenServerPSSnapIn: This is the PowerShell snap-in for XenServer, which is a one-to-one mapping of the existing XenServer API. It should be noted that the functionality in XenServerSnapshotPSSnapIn can be duplicated with this, however it will take many lines of scripting. You can use both snap-ins together if you’d like to manage your XenServers and take snapshots via PowerShell.
- Updated XenServer.NET: The XenServer SDK for .NET
- Updated XenServerJava: The XenServer SDK for Java
- Updated libxenserver: The XenServer SDK for C
- Updated XenAPI.py: The XenServer Python module
The SDKs can be downloaded from Citrix Community. Enjoy!
Citrix Summit 2008 Pics
A couple of weeks ago I was at Citrix Summit 2008, which is a trade show that partners can attend to learn about our latest technologies. This year it was in Orlando, FL at the Walt Disney World Dolphin and Swan Resort.
One of the most popular events at Summit (and Synergy) is Tech Lab. This is where you can walkaround and see demos of the latest stuff from Citrix (such as Project Apollo) and third-party vendors. Here is the Citrix Tech Lab team:
More pictures of Summit can be found here.
Cloning a XenApp server with EdgeSight
I’ve received some feedback on using XenAppPrep with EdgeSight and I thought it would be beneficial to share some information on this topic.
The current version of XenAppPrep was designed to address the cloning process for XenApp core. This does not include any of the XenApp Platinum components, however we are planning to enhance the tool to cover all of them. In the meantime, you can use the following steps to clone a XenApp server with EdgeSight:
- Install XenApp.
- Install EdgeSight by running msiexec /i EdgeSightEPAgent.msi SERVICE_START_MANUAL=”1″. This will install the EdgeSight service in Manual start-up mode. Do not start this service before an image is taken.
- Install and run XenAppPrep.
- Set the Citrix System Monitoring Agent (RSCorSvc) service to Automatic start-up.
- Take an image of the server or if you’re using Provisioning Server switch the workload to standard image mode.
It’s important to ensure the Citrix System Monitoring Agent (RSCorSvc) service has never been started before an image is taken. If it has, the following steps must be taken before imaging the server:
- Stop the Citrix System Monitoring Agent (RSCorSvc) service.
- Uninstall the EdgeSight Agent.
- Ensure HKLM\SOFTWARE\Citrix\System Monitoring key has been removed.
- Verify the EdgeSight Agent database has been removed. It’s default location is C:\Documents and Settings\All User\Application Data\Citrix\System Monitoring\Data\rsdatr.fdb.
- Reinstall the EdgeSight Agent with the instructions above.
Joining the XenApp MX team
Since March 2006 I’ve been working on the XenApp Automation team, leading and technically contributing to many automated test suites. Prior to this I worked at a defense contractor for a few years in both IT and software engineering capacities. The Automation team has been focused on enabling Citrix to release new high quality versions of XenApp more often by automating tests. During this time, I learned a lot about XenApp and the software release processes at Citrix. I’ve also learned that I’d like to have a more direct impact on customers and get more involved technically.
So a little over a month ago I joined the XenApp Management Experience (MX) team. We develop the infrastructure and tools, such as the Access Management Console (AMC), that allow IT departments to easily manage their farms. The team has a lot of experience, technical involvement, and interesting challenges to solve. Initially I will be ramping the team up with their automation processes, infrastructure, and tests. But after this I’m expected to develop some the new management features that will be in the next version of XenApp.
There’s a long road ahead of us. We have a lot of work to get done for XenApp vNext and there’s a lot of room for innovation and new ideas. Best of all, there’s a lot of energy on the team to only do the best. With that said, I’m excited about the projects I’ll be working on and customers we’ll be helping! If you have any ideas that would improve the XenApp management experience, I’d love to hear about them.
Hot Off the Compiler: PowerShell SnapIn for XenServer Snapshots
As a follow-up to my Snapshotting with the XenServer 5.0 SDK post, I’ve written a PowerShell snapin that will allow you to take and revert snapshots with XenServer. You can download the source code and binaries here. You must have the .NET Framework 3.5 installed before you can use it. To install the snapin you will need to run the following command after you’ve downloaded and extracted the ZIP file:
C:\Windows\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe /i XenServerSnapshotPSSnapIn.dll
Then you can open up your PowerShell console and enter the following to take a snapshot of your virtual machine named Bluemoon, which by the way is my favorite beer!
Add-PSSnapin XenServerSnapshot*
Checkpoint-VM -Hostname 192.168.0.2 -Username root -Password qwerty -VM Bluemoon -Snapshot BluemoonBackup
If you decide you’d like to revert to this snapshot you can do this:
Restore-VM -Hostname 192.168.0.2 -Username root -Password qwerty -VM Bluemoon -Snapshot BluemoonBackup
And before I leave the office for the night, here are a few things to note:
- The cmdlets return true if they were able to execute successfully, otherwise they return false.
- Virtual machine names are case-sensitive.
- PowerShell must be installed to compile the source. XenAPI.net is included with the download.
- I’ve made a few tweaks to this code from the original version.
Added 09-March-2009: The snapshot feature in XenServer requires a VHD-on-EXT3 storage repository. To change the default repository to EXT3, please see http://support.citrix.com/article/ctx116324. Alternatively, the following script can be used:
dev=`cat /etc/xensource-inventory | grep DEFAULT_SR_PHYSDEVS | cut -d ‘=’ -f2 | grep -o -E “[^'].*[^']“`
sr_uuid=`xe sr-list type=lvm | grep uuid | cut -d ‘:’ -f2 | cut -c 2-`
pbd_uuid=`xe pbd-list sr-uuid=$sr_uuid | grep -E ‘^uuid.*’ | cut -d ‘:’ -f2 | cut -c 2-`
inst_uuid=`cat /etc/xensource-inventory | grep INSTALLATION_UUID | cut -d ‘=’ -f2 | grep -o -E “[^'].*[^']“`
xe pbd-unplug uuid=$pbd_uuid
xe sr-destroy uuid=$sr_uuid
new_sr_uuid=`xe sr-create content-type=”local SR” host-uuid=$inst_uuid type=ext device-config-device=$dev shared=false name-label=”Local File SR”`
pool_id=`xe pool-list | grep uuid | cut -d ‘:’ -f2 | cut -c 2-`
xe pool-param-set default-SR=$new_sr_uuid uuid=$pool_id
xe pool-param-set suspend-image-SR=$new_sr_uuid uuid=$pool_id
#echo $dev
#echo $sr_uuid
#echo $pbd_uuid
#echo $inst_uuid
#echo $new_sr_uuid
#echo $pool_id
Feel free to post a comment here if you have any feedback. Enjoy!
XenAppPrep is here!
I’m at Summit this week working in Tech Lab. This is the second Summit I’ve been to in the past two and a half years and as always its been a fun experience. This year its in Orlando, FL at the Dolphin Resort in Disney. If you’re here, I’d highly recommend stopping by our booth to check out our latest and greatest technologies and chat with some of the engineers that brought them to life.
I’m also proud to announce the release of XenAppPrep at http://support.citrix.com/article/CTX116063. I’d love to hear any and all feedback, so feel free to post your comments here.
Snapshotting with the XenServer 5.0 SDK
Throughout the past couple of months at Citrix, I’ve been working on our next-generation automation framework: CADI (Citrix Automation Development Infrastructure). This framework empowers our developers to easily create and run automated system tests, which will ultimately result in higher quality products. Just about all of the framework’s functionality is exposed via PowerShell, so for instance we can setup a XenServer virtual machine with the latest XenApp build and launch an ICA session from a remote client to the XenApp server right from the PowerShell CLI.
During this project, I was responsible for driving the design and development of the test environment setup feature. Its main role is to give users the ability to provision machines, install software, and configure them. The automated tests would then take over, try to find bugs in our software, and report their results.
Coming into the project, we knew we wanted to use our lab hardware in the most efficient way and have the ability to take a snapshot of a machine in case we needed to see why a test failed. To achieve this we leveraged XenServer 5.0 whose SDK supports taking and reverting snapshots. This snapshot functionality is not currently available via XenCenter, however for those of your interested I’ve posted the C# take and revert snapshot code here. Please note XenAPI.net, which is released as part of the XenServer 5.0 SDK, is required to compile this.
The TakeSnapshot method is pretty straight forward. It will connect up to the XenServer host, retrieve the specified virtual machine, and call the VM.snapshot method on it. Once this has executed, you will see the snapshot appear as a template on your XenServer.
The RevertSnapshot code on the other hand isn’t very straight forward; however no worries here as I’ll walk through it. The code starts off by connecting to the XenServer host and retrieving the specified virtual machine. Then it does the following:
- Retrieve the snapshot we’re interested in. Remember, the snapshots are templates stored on the XenServer and they are linked to their virtual machines. The VM.get_snapshots method allows us to retrieve a virtual machine’s snapshots.
- Shutdown the virtual machine we are reverting. This is required as we will be modifying the virtual machine.
- Delete all VDIs (virtual disk images), except CDs since they can’t be deleted, and VBDs (virtual block drives) associated with the virtual machine. A VDI is synonymous with a hard drive while a VBD is the component that connects the VDI to the virtual machine.
- Clone the VDIs from the snapshot and connect them to the virtual machine.
- Power on the virtual machine.
I’ve been thinking about writing a couple PowerShell cmdlets for taking and reverting snapshots. If I receive enough interest, I’ll probably write them up and post them here. So if you find this post valuable feel free to leave a message. Till next time!
XenAppPrep Soon To Be Released
I’ve been getting a lot of e-mails about the release of XenAppPrep and have decided to write a blog post to let everyone know what’s going on. Although I have received a lot of great feedback on the internal beta, I feel it’s important to have a team that’s dedicated to helping our customers with the tool.
Pete Downing, Product Manager of Provisioning Server, and I have been working together to setup a support channel for XenAppPrep before it’s released to the web (RTW). Thanks to the Provisioning Server Support Team, we were able to achieve this today. Once the tool has been released, you will be able to dial into the Citrix technical support hotline and talk to a Citrite if you run into a problem or have any questions about XenAppPrep.
We are now in the midst of the RTW process, which includes having the tool reviewed by our security experts, and are expecting it be available on citrix.com in a week or so. I’d like to thank everyone who has expressed interest in XenAppPrep, it will be worth the wait! As always, I’d love to hear all feedback so feel free to drop me a message if you have any questions or comments.
Choosing an Automated Deployment Strategy for XenApp (Part 4/4)
In the last part of Choosing an Automated Deployment Strategy for XenApp I will discuss installing XenApp via images.
Image-based Deployments
I haven’t really been a follower of image-based deployments in the past. It’s just too cumbersome to maintain separate images for all of the different types of hardware most companies have.
My view on this all changed once virtual machines started to crop up in the data center and this is the topic I’ll be covering here. Virtual machines abstract the physical hardware away from the OS, so if all of your servers are virtualized then they’re all running the same hardware. In this case, you just need one master image.
Image-based deployments with virtual machines require a few tools:
- Virtual machine software (XenServer, Hyper-V, …)
- A way to generalize XenApp on the master image (XenAppPrep)
- A tool that can deploy the virtual machine images (Provisioning Server, Altiris, …)
In one of my previous posts, I talked about a tool (XenAppPrep) I developed that automatically prepares a XenApp installation to be cloned, so I won’t cover that here. However, it should be noted that this process is important for all image-based deployment technologies, whether they’re for physical or virtual machines.
In order to have a complete automated strategy, we still need a tool that will allow us to deploy our virtual machine images. You can use conventional imaging tools like Altiris or have the ability to stream your images on-demand with Provisioning Server (PVS). I personally think Provisioning Server is probably one of the few technologies that will change the way data centers are run, but that’s another post all together.
Machines using the current version of PVS (4.5) do not save their state in standard image mode. For example, let’s say you’re streaming one master image (or workload as PVS refers to it) to a handful of your machines and save a text file to your C: drive. The next time you reboot this machine, the file will no longer be there. Depending on your XenApp implementation, this could be advantageous or not. Most XenApp settings are stored in the central IMA database and any user-specific changes can be captured by roaming profiles, so in many cases this may not be an issue.
Well, that wraps up my overview of the various ways you can deploy XenApp automatically. I hope this was helpful and if you have any questions or feedback don’t hesitate to drop me a comment.
Choosing an Automated Deployment Strategy for XenApp (Part 3/4)
Part 3 of Choosing an Automated Deployment Strategy for XenApp gives an overview of deploying XenApp via Active Directory.
Deploying MSIs via Active Directory with Group Policy
I’m a big fan of deploying MSIs via Active Directory. This probably remains one of the most affordable ways to automatically deploy software today… not to mention it’s pretty cool to see it work. One of the significant feats I had at a past job back in 2003 was using this method in conjunction with the Remote Installation Service (RIS) to automatically deploy operating systems and 100+ apps to the entire company. I still have some of the painful memories from repackaging the apps that weren’t MSI based (90% of them) and getting them to play nice (aka not blowing up) in a LUA environment. Streaming Server (now part of XenApp), Softricity, and all of those other application virtualization tools are truly a blessing. With that said, I’d hope most application developers know better than to write user data to HKLM and Program Files!
I wasn’t able to find a section in the Admin Guide that covers installing XenApp via Active Directory, so I’ll give an overview of it. To deploy XenApp via Active Directory, the first thing you need to do is create an administrative install. This will basically copy all of the files to a network location, so all of your servers can reach it. You can find the details about this on pg. 370 of the Admin Guide.
Next you’ll need to create a transform (MST file). The transform will capture all of the install options, similar to an answer file except it’s based on Microsoft’s own proprietary format. Back in the day I used InstallShield’s AdminStudio to do this… you just point AdminStudio to the MSI, it will let you walk through the GUI portion of the install and choose your options, then when you click Finish it captures all of your settings into a .MST file. Now days, I wouldn’t be surprised if there are some free tools that allow you to do this. If you know of any, I’d be interested in checking them out so feel free to post them as a comment.
The last step is to create a Group Policy object (GPO). In this GPO, you will need to create a new Software Installation object and reference the network location of mps.msi and your transform. When you apply this GPO to an OU, by default it will install XenApp on all computers under the OU. The easiest way to restrict this is by applying a filter to the GPO that specifies a group with all of your XenApp servers.
Now the cool perk about deploying apps via Active Directory is that you just need to add the desired computer to the group and reboot it. Well… you may need to run gpupdate too, but I think you get the point.
For an install as complex and large as XenApp, this approach does have some downfalls:
- Compared to a script-based approach, it’s harder to detect and troubleshoot problems that occur at install time. For example, a machine may fail to install, but there’s no good indication of how or why there was a problem.
- Controlling and staging XenApp roll-outs can be difficult due to all of the new IMA and file sharing traffic occurring at the same time.
