Friday, July 24, 2009

Converting a Xen Paravirt VM to Fullvirt

We had a VM that would occasionally try to load the wrong kernel at boot time. The machine has to load the para-virt ELxen kernel to successfully start, but it might try to load a PAE instead. As a result the VM would fail to boot.

It might seem that the solution would be to fix why it was loading the wrong kernel, but, for reasons we will not discuss at the moment, we needed to accept that it would load the wrong kernel occasionally. So, our mission became to move the VM from para-virt to full-virt. As it turns out, it was just a case of modifying the VM config file.

Comparing the two configs, we see some differences:
diff vm-para vm-full
< bootloader='/usr/bin/pygrub'
< vfb=['type=vnc,vncunused=1,keymap=en-us']
---
> builder = "hvm"
> kernel = "/usr/lib/xen/boot/hvmloader"
> boot = "c"
> pae = 1
> acpi = 1
> apic = 1
> localtime = 0
> device_model = "/usr/lib64/xen/bin/qemu-dm"
> sdl = 0
> vnc = 1
> vncunused = 1
> keymap = "en-us"
This tells us that the para-virt VM uses a different Grub and that it needs a set of variables to describe its connections to the outside world. The full-virt VM, has a much wider set of variables, and uses a different boot mechanism.

So, how do we convert?
1. With VM running, install a standard kernel, using rpm -ivh
    or yum install kernel.
2. Power off VM.
3. Edit config file, removing the two line specified by "<" above.
4. Add the lines specified by ">" above. Make sure to remove the leading greater-than (>) symbols!
5. Start VM.

No comments:

Post a Comment