[Ovirt-devel] [PATCH] Provides an explicit upgrade path for an installed node.

Darryl L. Pierce dpierce at redhat.com
Fri Nov 13 16:39:15 UTC 2009


This patch allows the node to be upgraded without destroying any
configuration. The new kernel argument, ovirt_upgrade, will boot cause
the node to install the upgraded image, then reboot.

Resolves: rhbz#527217

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-early     |   14 +++++++-------
 scripts/ovirt-firstboot |   22 +++++++++++++---------
 scripts/ovirt-functions |   12 +++++++++++-
 3 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index cdd4afd..cda1b3f 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -135,7 +135,7 @@ start() {
     #   ovirt_init=[usb|scsi[:serial#]|/dev/...]
     #   ovirt_vol=BOOT_MB:SWAP_MB:ROOT_MB:CONFIG_MB:LOGGING_MB:DATA_MB
     #   ovirt_overcommit=<overcommit_ratio>
-    #   ovirt_local_boot
+    #   ovirt_upgrade
     #   ovirt_standalone
     #   ovirt_firstboot
     #   rescue
@@ -182,9 +182,9 @@ start() {
     # or a specific positive number in MB
     vol_data_size=
 
-    #   ovirt_local_boot
+    #   ovirt_upgrade
     # install/update oVirt Node image on the local installation target disk
-    local_boot=
+    upgrade=
 
     #   ovirt_overcommit=<overcommit_ratio>
     # set the swap size coefficient
@@ -305,8 +305,8 @@ start() {
             i=${i#ovirt_vol=}
             eval $(printf $i|awk -F: '{print "vol_boot_size="$1; print "vol_swap_size="$2; print "vol_root_size="$3; print "vol_config_size="$4; print "vol_logging_size="$5; print "vol_data_size="$6;}')
             ;;
-            ovirt_local_boot*)
-            local_boot=1
+            ovirt_upgrade*)
+            upgrade=1
             ;;
             ovirt_standalone*)
             standalone=1
@@ -379,7 +379,7 @@ start() {
         ip_gateway=$gateway
     fi
     # save boot parameters as defaults for ovirt-config-*
-    params="bootif init vol_boot_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size local_boot standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot"
+    params="bootif init vol_boot_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot"
     # mount /config unless firstboot is forced
     if [ "$firstboot" != "1" ]; then
         mount_config
@@ -426,7 +426,7 @@ start() {
             ovirt_store_config \
                 /etc/sysconfig/network-scripts/ifcfg-* \
                 $BONDING_MODCONF_FILE
-            if [ $local_boot = 1 ]; then
+            if [ $upgrade = 1 ]; then
                 # local disk installation for managed mode
                 mount_live
                 ovirt-config-boot /live "$bootparams"
diff --git a/scripts/ovirt-firstboot b/scripts/ovirt-firstboot
index bdafb33..650dcf7 100755
--- a/scripts/ovirt-firstboot
+++ b/scripts/ovirt-firstboot
@@ -32,7 +32,7 @@ trap 'exit $?' 1 2 13 15
 
 start ()
 {
-    if ! is_firstboot && ! is_auto_install; then
+    if ! is_firstboot && ! is_auto_install && ! is_upgrade; then
         return
     fi
 
@@ -46,14 +46,18 @@ start ()
         ovirt-config-networking AUTO
         ovirt-config-logging AUTO
         ovirt-config-collectd AUTO
-	ovirt-config-password AUTO
-        if [ "$OVIRT_LOCAL_BOOT" = 1 ]; then
-            mount_live
-            ovirt-config-boot /live "$OVIRT_BOOTPARAMS" no
-            disable_firstboot
-            reboot
-        fi
-    elif is_firstboot; then
+        ovirt-config-password AUTO
+    fi
+
+    if is_upgrade; then
+        mount_live
+        ovirt-config-boot /live "$OVIRT_BOOTPARAMS" no
+        disable_firstboot
+        reboot
+        return
+    fi
+
+    if is_firstboot; then
         plymouth --hide-splash
 
         ovirt-config-setup -x < /dev/console
diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index b61e317..69e2a58 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -102,6 +102,16 @@ is_auto_install() {
     fi
 }
 
+# return 0 if this is an upgrade
+# return 1 otherwise
+is_upgrade() {
+    if [ "$OVIRT_UPGRADE" = "1" ]; then
+        return 0
+    else
+        return 1
+    fi
+}
+
 # return 0 if booted from local disk
 # return 1 if booted from other media
 is_booted_from_local_disk() {
@@ -123,7 +133,7 @@ disable_firstboot() {
         augtool <<EOF
 set /files$OVIRT_DEFAULTS/OVIRT_FIRSTBOOT 0
 set /files$OVIRT_DEFAULTS/OVIRT_INIT '""'
-set /files$OVIRT_DEFAULTS/OVIRT_LOCAL_BOOT 0
+set /files$OVIRT_DEFAULTS/OVIRT_UPGRADE 0
 EOF
     fi
 }
-- 
1.6.2.5




More information about the ovirt-devel mailing list