[Ovirt-devel] [PATCH node] select boot partition for grub

Alan Pevec apevec at redhat.com
Tue Dec 16 23:02:43 UTC 2008


---
 scripts/ovirt-config-boot |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
index ad0aeb1..9fa0144 100755
--- a/scripts/ovirt-config-boot
+++ b/scripts/ovirt-config-boot
@@ -29,6 +29,14 @@ ovirt_boot_setup() {
     local bootparams=$3
     printf "installing oVirt Node image ... "
     mount_boot
+    # check that /boot mounted ok and find partition number for GRUB
+    BOOT=$(mount|awk '$3 == "/boot" {print $1}')
+    BOOT=$(( ${BOOT#$disk} - 1 ))
+    rc=$?
+    if [ $rc -ne 0 -o $BOOT -lt 0 ]; then
+      printf "boot partition not available\n"
+      return $rc
+    fi
     mount_liveos
     # install oVirt Node image for local boot
     if [ -e "$live/syslinux" ]; then
@@ -91,14 +99,14 @@ default=0
 timeout=5
 hiddenmenu
 title oVirt Node
-    root (hd0,0)
+    root (hd0,$BOOT)
     kernel /vmlinuz0 ro root=/dev/HostVG/Root roottypefs=ext3 liveimg $bootparams
     initrd /initrd0.img
 EOF
     echo "(hd0) $disk" > /boot/grub/device.map
     ( cd /usr/share/grub/*; cp -p stage? e2fs_stage1_5 /boot/grub )
     grub --device-map=/boot/grub/device.map > /dev/null <<EOF
-root (hd0,0)
+root (hd0,$BOOT)
 setup --prefix=/grub (hd0)
 EOF
     rc=$?
-- 
1.6.0.4




More information about the ovirt-devel mailing list