[Ovirt-devel] [PATCH node] separate ovirt-config-boot for in-place image upgrades

Alan Pevec apevec at redhat.com
Thu Dec 11 10:37:19 UTC 2008


XXX outstandig issue is /dev/vda support by grub,
so if testing with 'fake' Node VMs, please switch to IDE, in domain XML:
  <target dev='hda' bus='ide'/>
instead of
  <target dev='vda' bus='virtio'/>
---
 Makefile.am               |    1 +
 ovirt-node.spec.in        |    6 +++
 scripts/ovirt-config-boot |   85 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 92 insertions(+), 0 deletions(-)
 create mode 100755 scripts/ovirt-config-boot

diff --git a/Makefile.am b/Makefile.am
index 9b54ae6..c5829f3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,7 @@ EXTRA_DIST =			\
   scripts/collectd.conf.in	\
   scripts/ovirt			\
   scripts/ovirt-awake		\
+  scripts/ovirt-config-boot  \
   scripts/ovirt-config-logging  \
   scripts/ovirt-config-networking \
   scripts/ovirt-config-password \
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index ef65bf0..0973af9 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -35,6 +35,7 @@ Requires:       bind-utils
 # qemu-img RPM.
 Requires:       qemu-img
 Requires:       nc
+Requires:       grub
 Requires:       /usr/sbin/crond
 ExclusiveArch:  %{ix86} x86_64
 
@@ -87,6 +88,7 @@ cd -
 %{__install} -d -m0755 %{buildroot}%{_sysconfdir}/logrotate.d
 
 %{__install} -p -m0755 scripts/ovirt-awake %{buildroot}%{_sbindir}
+%{__install} -p -m0755 scripts/ovirt-config-boot %{buildroot}%{_sbindir}
 %{__install} -p -m0755 scripts/ovirt-config-logging %{buildroot}%{_sbindir}
 %{__install} -p -m0755 scripts/ovirt-config-networking %{buildroot}%{_sbindir}
 %{__install} -p -m0755 scripts/ovirt-config-password %{buildroot}%{_sbindir}
@@ -171,6 +173,7 @@ fi
 %files
 %defattr(-,root,root,0755)
 %{_sbindir}/ovirt-awake
+%{_sbindir}/ovirt-config-boot
 %{_sbindir}/ovirt-config-logging
 %{_sbindir}/ovirt-config-networking
 %{_sbindir}/ovirt-config-password
@@ -200,6 +203,9 @@ fi
 %doc ovirt-identify-node/COPYING
 
 %changelog
+* Wed Dec 10 2008 Alan Pevec <apevec at redhat.com> 0.96-0.1
+- ovirt-config-* setup scripts for standalone mode
+
 * Thu Sep 11 2008 Chris Lalancette <clalance at redhat.com> - 0.92 0.7
 - Add the ovirt-install- and ovirt-uninstall-node scripts, and refactor
   post to accomodate
diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
new file mode 100755
index 0000000..2052dfa
--- /dev/null
+++ b/scripts/ovirt-config-boot
@@ -0,0 +1,85 @@
+#!/bin/bash
+#
+# ovirt-config-boot - configure local boot disk partition
+
+# SYNOPSIS
+# ovirt-config-boot livecd_path bootparams
+#
+#       boot_disk   - boot disk device e.g. /dev/sda
+#
+#       livecd_path - where livecd media is mounted,
+#                     parent of LiveOS and isolinux folders
+#
+#       bootparams  - extra boot parameters like console=...
+#
+
+# Source functions library
+. /etc/init.d/functions
+. /etc/init.d/ovirt-functions
+
+
+# local_boot_install livecd_path bootparams
+#  livecd_path -livecd media
+#  bootparams - extra boot parameters like console=...
+#
+#  copy oVirt Node image to the local LVM /dev/HostVG
+ovirt_boot_setup() {
+    local disk=$1
+    local live=$2
+    local bootparams=$3
+    printf "installing oVirt Node image ..."
+    mount_boot
+    mount_liveos
+    # install oVirt Node image for local boot
+    if [ -e "$live/syslinux" ]; then
+      syslinux=syslinux
+    elif [ -e "$live/isolinux" ]; then
+      syslinux=isolinux
+    else
+      syslinux=
+    fi
+    rm -rf /boot/grub
+    rm -rf /liveos/LiveOS
+    mkdir -p /boot/grub
+    mkdir -p /liveos/LiveOS
+    cp -p $live/LiveOS/squashfs.img /liveos/LiveOS \
+    && cp -p $live/$syslinux/initrd0.img /boot \
+    && cp -p $live/$syslinux/vmlinuz0 /boot
+    rc=$?
+    if [ $rc -ne 0 ]; then
+      printf "image copy failed\n"
+      return $rc
+    fi
+    cat > /boot/grub/grub.conf << EOF
+default=0
+timeout=2
+hiddenmenu
+title oVirt Node
+    root (hd0,0)
+    kernel /vmlinuz0 ro root=/dev/HostVG/Root roottypefs=ext3 liveimg $bootparams
+    initrd /initrd0.img
+EOF
+    # XXX vda - virtio block:
+    # doesn't show up in device.map
+    # grub-install has regexp [sh]d
+    # TODO check if/how cciss work
+    grub-install --root-directory=/boot $disk >&2
+    rc=$?
+    if [ $rc -ne 0 ]; then
+        printf "boot loader install failed\n"
+        return $rc
+    fi
+    # remove unused 1.5 stages
+    find /boot/grub -name '*_stage1_5' ! -name e2fs_stage1_5 \
+        -exec rm {} \;
+    # avoid reboot loops using Cobbler PXE only once
+    # Cobbler XMLRPC post-install trigger (XXX is there cobbler SRV record?):
+    # wget "http://192.168.50.2/cblr/svc/op/trig/mode/post/system/$(hostname)"
+    #   -O /dev/null
+    sync; sync; sync
+    # caller decides when to reboot
+}
+
+
+ovirt_boot_setup $1 $2 $3
+
-- 
1.6.0.4




More information about the ovirt-devel mailing list