Thursday, September 24, 2009

Enabling Citrix Merchandising Server paravirtualized vm to run on Hyper-V

Be warned, Citrix Support will not support your Merchandising Server if you follow these steps.

And - this is really antique and no longer works with Hyper-V 2012.

Here is my scenario:

I have a fully paravirtualized Linux virtual machine (Merchandising Server) that is made to run on a xen hypervisor (the family of hypervisors that enable Linux VMs to boot kernel-xen and run in a truly paravirtualized and highly efficient way).
I want to move that vm over to another hypervisor (non-xen) for a client demonstration.
Warning:  This might seem a bit convoluted, but it really isn’t difficult.  However there are a few tools involved.  The steps that apply to your situation all depends on how easy it is to get your virtual disk into a format that you can mount and edit the boot volume.  Follow these instructions at your own risk, a positive outcome is not guaranteed.  The resulting VM will most likely not be supported if it has problems.
Collecting the elements:
I am going to use a few things that I need to obtain (download) and tools that need to be installed.

Why so many tools?

The Merchandising Server is the appliance that I am using for the example.  XenConvert is to convert the XVA (XenServer export format) into an OVF based appliance.  The Kensho OVF Tool is to import the OVF into Hyper-V.  The Linux distribution “Live CD” is to mount the virtual disk of the example appliance so we can modify the Grub boot loader and drop a file.  And the v1 Linux Integration Components have the magic PV kernel shim that we need.

Details, details, missing details.  What gives?

I am going to state right now that; I am not going to go into deep and gory details describing each and every click that is required with each tool.  If you read my blog, I assume a couple things: that you have a clue, or you want one.  And that you are not afraid of figuring things out, or trying and failing (I am also implying that you know how to make back-ups of things before you go mucking them up).

The business at hand:

  1. Expand the Merchandizing bz2 zip archive. (WinRAR can do this, and others as well)
  2. Use Citrix XenConvert 2.x to convert from “Xen Virtual Appliance” to “Open Virtualization Format (OVF) Package
    • Do not create an OVA, just an OVF.
  3. Use Citrix Kensho OVF Tool to Import the OVF Package from step 2 to a Hyper-V host.
    • Or you could just copy the VHD from step 2 to your Hyper-V host and create a new VM.
    • Do not boot the VM at this time.
  4. Attach the Live CD ISO to the VM
  5. Set the boot order to boot from DVD first
  6. Remove the default Network Adapter and add a Legacy Network Adapter
  7. Add a second DVD drive
  8. Attach the Hyper-V (v1) Linux IC ISO to the second DVD drive of the VM
  9. Boot the VM into the Live CD and log in to its console
    • Debian will auto logon as ‘user’.
  10. switch to root:  sudo –i
    • This is specific to Debian Live
  11. Discover the IDE disks:
    • cd /dev
    • ls hd*
  12. Mount the virtual disk (the vhd)
    • make a mount point folder:  mkdir /mnt/mine
    • mount the disk to the folder:  mount /dev/hda1 /mnt/mine
  13. explore the volume
    • cd /mnt/mine
    • ls
    • Mine looks like a /boot volume:
    • clip_image001
  14. Mount the Linux IC DVD drive (mine is the second dvd on controller 2):
    • mkdir /mnt/cdrom
    • mount /dev/hdd /mnt/cdrom
  15. Copy the kernel shims from the ISO to the virtual disk
    • cd /mnt/cdrom/shim
    • cp *.* /mnt/mine
  16. Edit the device.map
    • cd /mnt/mine/grub
    • nano device.map
    • Before: clip_image002
    • After: clip_image003
  17. Edit the GRUB bootloader to load the shim and the kernel.
    1. nano menu.lst
    2. comment the ‘hiddenmenu’ option and increase the timeout so I can test.
      • clip_image004
    3. Create a new entry specific to the shim and the distribution kernel-xen
      • Notice that the kernel is the shim copied from the previous step and the existing kernel and initrd load as modules of the shim.
      • clip_image005
    4. Modify the default selection to point to my new entry.
      • The default entry begins counting at “0”
      • clip_image006
  18. Unmount the virtual disk and the cdrom
    • cd /
    • umount /dev/hda1
    • umount /dev/hdd
  19. Shutdown the virtual machine and remove the ISOs from the DVD drive (also remove the second virtual dvd drive).
  20. Boot the virtual machine, note the new menu selection that was created – this is the kernel that should boot.
    • clip_image007
Note: If you run VMware – This will not run on VMware, the shim is specific to Hyper-V.

5 comments:

FrankG said...

Hello,
I've been trying to use your recipe to convert a ctx license server appliance to hyper-v (W2K8 R2 SP1).
Doesn't work unfortunately, when booting the modified vm it stops (hangs) after:
Checking 'hlt' instructions... ok
SMT alternatives: switching to up code
freeing smp alternatives: 13k freed
ACPI: Core revision 20060707.

After that, nothing happens at all. Any ideas on how to solve this please ?

BrianEh said...

I recently tried this with one of the latest Licensing Server appliances and it does not work properly.
It is built a bit differently and is very tightly bound to the XenServer kernel.
Besides, you can install the license service in a Windows VM, so why go through all the pain?

FrankG said...

Oh, I got a wonderful updated recipe on the Citrix forums from Kirk Kosinski, and it works perfectly !
Find it at http://forums.citrix.com/thread.jspa?threadID=286630&stqc=true

Anonymous said...

FrankG, I have exactly the same problem as you

hung at ACPI: Core revision 20060707

I am trying to migrate a CentOS 6.5 VM from XenServer to Hyper-V

This guide did not work unfortunately

Anonymous said...

Thanks BrianEh, at least I learned a lot other things!