[kernel-xen] kernel-xen-3.9.7-1 packages available - TESTERS REQUIRED!

Steven Haigh netwiz at crc.id.au
Sat Jun 22 08:05:06 EST 2013


On 22/06/2013 3:44 AM, Joe Fialkowski wrote:
> Great work Steve! Thank you! This was always a PITA when it came to
> upgrading. Will try and give it a test soon.

I agree. It always bugged me too - but I wanted to think long and hard 
about how/what to do - as the last thing I want is to screw up a systems 
grub.conf and leave the possibility that the system won't recover. 
That's a worst case. So in the past, I always left the human to make 
that decision.

The script that does the changes is:
         GRUB_CONF="/etc/grub.conf"
         HYPERVISOR=`grep -m1 xen.gz $GRUB_CONF`
         if [[ -z $HYPERVISOR ]]; then
                 ## We haven't found an existing hypervisor. Find where 
xen.gz is and add the defaults.
                 echo "No existing Xen install found. Using defaults."

                 ## Look for /boot partition, otherwise assume relative to /
                 if `grep -q "/boot" /proc/mounts`; then
                         XEN_GZ="/xen.gz"
                 else
                         XEN_GZ="/boot/xen.gz"
                 fi
                 HYPERVISOR=`echo -e "\tkernel $XEN_GZ dom0_mem=1024M 
cpufreq=xen dom0_max_vcpus=1 dom0_vcpus_pin"`
         fi
         KERNEL=`grep -m1 vmlinuz-3.9.7-1.el6xen.x86_64 $GRUB_CONF`
         INITRAMFS=`grep -m1 initramfs-3.9.7-1.el6xen.x86_64 $GRUB_CONF`
         if [[ -z "$KERNEL" || -z "$INITRAMFS" ]]; then
                 echo "ERROR: Something unexpected was found in 
/etc/grub.conf. Please edit manually."
         else
                 KERNEL_NEW=$( echo "$KERNEL" | sed 's|kernel|module|' )
                 INITRAMFS_NEW=$( echo "$INITRAMFS" | sed 
's|initrd|module|' )
                 sed -i "s|$KERNEL|$HYPERVISOR\n$KERNEL_NEW|" $GRUB_CONF
                 sed -i "s|$INITRAMFS|$INITRAMFS_NEW|" $GRUB_CONF
         fi

I know this could be a done in a few less lines of code, however the 
theory I've gone with is that I want to be EXACT with things I want to 
change. As such, I only change COMPLETE lines that I am almost certain 
will be correct - not matching parts of a line.

There are a couple of failures that I can think of:
1) If you set up grub.conf manually for the kernel you are about to 
install, then install the kernel package, it may do some unpredictable 
things. I feel this situation would be VERY unlikely though.

2) The script also checks if there is a /boot partition mounted. If 
there is, we assume that xen.gz etc are relative to / (being the boot 
partition). If /boot is *NOT* mounted when the kernel-xen package is 
installed, it will believe that files are in the root partition instead 
of a boot partition. I feel this is unlikely however.

-- 
Steven Haigh

Email: netwiz at crc.id.au
Web: https://www.crc.id.au
Phone: (03) 9001 6090 - 0412 935 897
Fax: (03) 8338 0299


More information about the kernel-xen mailing list