Fixing update-grub to work with paravirt ops (2.6.22+) Xen kernels

Ian Campbell ijc at hellion.org.uk
Sat Apr 26 17:55:02 UTC 2008


Hi,

The current (grub1) update-grub has some special case code to handle the
old Xen kernels which could be run only on top of the hypervisor.
Unfortunately this code does not behave correctly in the presence of
paravirt_ops kernels which are bootable both natively and in a Xen guest
domain (and ultimately as a Xen domain 0 kernel but that support isn't
available yet).

I only talk about the grub1 version of update-grub since Xen's PV
bootloader (pygrub) currently only understands the menu.lst format.

I think the updated algorithm for determining which kernels to include
in the menu on native, dom0 and domU is:
	if CONFIG_PARAVIRT then
		if IN_DOMU && ! CONFIG_XEN then
			continue (don't want non-Xen kernel in domU)
		endif
	else
		if ! IN_DOMU && CONFIG_XEN_PRIVILEGED_GUEST then
			continue
        	elif IN_DOMU && ! CONFIG_XEN then
			continue
        	endif
	endif

The ! CONFIG_PARAVIRT case is the same as currently to support older
kernels.

I've attached a patch which implements this scheme against grub SVN. 

If a hypervisor is detected then the existing code will also add a
hypervisor entry for any kernel with CONFIG_XEN_PRIVILEGED_GUEST set.
It looks like the experimental tree
(http://git.et.redhat.com/?p=linux-2.6-dom0-pvops.git;a=summary) doesn't
make dom0 support optional so probably CONFIG_XEN is the correct trigger
this behaviour now but until the support really exists I've left this
bit alone.

However: I'd like to propose simplifying things. I don't believe that
keying off being in a domU or not is useful anymore now that
CONFIG_PARAVIRT exists. It interferes with constructing a guest inside a
chroot and it is not unreasonable to assume that if the admin installs a
kernel they intend to use it -- for example by reconfiguring the guest
to be fully virtualised (HVM). Therefore I would suggest removing all of
this code and simply including every kernel in menu.lst. If a hypervisor
is found add a hypervisor entry for all CONFIG_XEN=y kernels too.

I can easily knock up this patch if it is the preferred option.

Ian.
-- 
Ian Campbell

Albrecht's Law:
	Social innovations tend to the level of minimum tolerable well-being.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: update-grub.patch
Type: text/x-patch
Size: 3543 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20080426/211281b5/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-grub-devel/attachments/20080426/211281b5/attachment.pgp 


More information about the Pkg-grub-devel mailing list