[Ovirt-devel] [PATCH node] add "Local install and reboot" option

Alan Pevec apevec at redhat.com
Wed Dec 24 22:59:59 UTC 2008


ovirt-config-boot can be called without parameters, as an option
in ovirt-config-setup menu, defaults are taken from /etc/default/ovirt
---
 ovirt-node.spec.in           |    1 +
 scripts/ovirt-config-boot    |   35 +++++++++++++++++++++++++++--------
 scripts/ovirt-config-storage |    1 +
 scripts/ovirt-early          |    4 +---
 scripts/ovirt-firstboot      |   17 ++---------------
 scripts/ovirt-functions      |   11 +++++++++++
 6 files changed, 43 insertions(+), 26 deletions(-)

diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index f529f60..e5031ad 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -189,6 +189,7 @@ install -p -m 644 images/syslinux-vesa-splash.jpg %{buildroot}/usr/lib/anaconda-
 %{__ln_s} ../..%{_sbindir}/ovirt-config-storage %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Disk Partitioning"
 %{__ln_s} ../..%{_sbindir}/ovirt-config-logging %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Logging Setup"
 %{__ln_s} ../..%{_sbindir}/ovirt-config-password %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Administrator Password"
+%{__ln_s} ../..%{_sbindir}/ovirt-config-boot %{buildroot}%{_sysconfdir}/ovirt-config-setup.d/"Local install and reboot"
 
 
 %clean
diff --git a/scripts/ovirt-config-boot b/scripts/ovirt-config-boot
index d7bd48a..8ddd46a 100755
--- a/scripts/ovirt-config-boot
+++ b/scripts/ovirt-config-boot
@@ -1,28 +1,28 @@
 #!/bin/bash
 #
-# ovirt-config-boot - configure local boot disk partition
+# ovirt-config-boot - configure local boot/root disk partitions
 
 # SYNOPSIS
-# ovirt-config-boot livecd_path bootparams
+# ovirt-config-boot boot_disk livecd_path bootparams reboot
 #
 #       boot_disk   - boot disk device e.g. /dev/sda
+#                     default is $OVIRT_INIT
 #
 #       livecd_path - where livecd media is mounted,
 #                     parent of LiveOS and isolinux folders
+#                     default is /live
 #
 #       bootparams  - extra boot parameters like console=...
+#                     default is $OVIRT_BOOTPARAMS
 #
+#       reboot      - reboot after install
+#                     default is yes
 
 # 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
@@ -127,5 +127,24 @@ EOF
 }
 
 
-ovirt_boot_setup "$1" "$2" "$3"
+disk=$1
+live=$2
+bootparams=$3
+doreboot=$4
+if [ -z "$disk" ]; then
+    disk=$OVIRT_INIT
+fi
+if [ -z "$live" ]; then
+    mount_live
+    live=/live
+fi
+if [ -z "$bootparams" ]; then
+    bootparams="$OVIRT_BOOTPARAMS"
+fi
+
+ovirt_boot_setup "$disk" "$live" "$bootparams"
 
+if [ -z "$doreboot" -o "$doreboot" = "yes" ]; then
+    disable_firstbot
+    reboot
+fi
diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index ff2a3b2..1c31a58 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -114,6 +114,7 @@ do_configure()
     done
     # save input variables
     augtool <<EOF > /dev/null
+set /files$OVIRT_DEFAULTS/OVIRT_INIT $DRIVE
 set /files$OVIRT_DEFAULTS/OVIRT_VOL_BOOT_SIZE $BOOT_SIZE
 set /files$OVIRT_DEFAULTS/OVIRT_VOL_SWAP_SIZE $SWAP_SIZE
 set /files$OVIRT_DEFAULTS/OVIRT_VOL_ROOT_SIZE $ROOT_SIZE
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index ecdf52e..7ee2357 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -319,9 +319,7 @@ start() {
                 $BONDING_MODCONF_FILE
             if [ $local_boot = 1 ]; then
                 # local disk installation for managed mode
-                mount_live
-                ovirt-config-boot $init /live "$bootparams"
-                reboot
+                ovirt-config-boot $init "" "$bootparams"
             fi
         fi
     fi
diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot
index da03b98..fe7723f 100755
--- a/scripts/ovirt-firstboot
+++ b/scripts/ovirt-firstboot
@@ -27,18 +27,6 @@
 . /etc/init.d/functions
 . /etc/init.d/ovirt-functions
 
-disable_firstboot ()
-{
-    if mount_config; then
-        umount_config $OVIRT_DEFAULTS
-        augtool > /dev/null <<EOF
-set /files$OVIRT_DEFAULTS/OVIRT_FIRSTBOOT no
-save
-EOF
-        ovirt_store_config $OVIRT_DEFAULTS
-    fi
-}
-
 start ()
 {
     if is_auto_install; then
@@ -46,9 +34,8 @@ start ()
         ovirt-config-storage AUTO
         ovirt-config-logging AUTO
         if [ "$OVIRT_LOCAL_BOOT" = 1 ]; then
-            mount_live
-            ovirt-config-boot $OVIRT_INIT /live "$OVIRT_BOOTPARAMS"
-            disable_firstboot
+            ovirt-config-boot $OVIRT_INIT "" "$OVIRT_BOOTPARAMS" no
+            disable_firstbot
             reboot
         fi
     elif is_firstboot; then
diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index e20bab9..9301678 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -49,6 +49,17 @@ is_firstboot() {
     fi
 }
 
+disable_firstboot() {
+    if mount_config; then
+        umount_config $OVIRT_DEFAULTS
+        augtool > /dev/null <<EOF
+set /files$OVIRT_DEFAULTS/OVIRT_FIRSTBOOT no
+save
+EOF
+        ovirt_store_config $OVIRT_DEFAULTS
+    fi
+}
+
 # find_srv SERVICE PROTO
 #
 # reads DNS SRV record
-- 
1.6.0.6




More information about the ovirt-devel mailing list