[Ovirt-devel] [PATCH node] Only set parameters in defaults/ovirt for params that have been explicitly set on kernel commandline

Perry Myers pmyers at redhat.com
Sun Jan 25 22:37:07 UTC 2009


Signed-off-by: Perry Myers <pmyers at redhat.com>
---
 scripts/ovirt-config-storage |    6 +++++-
 scripts/ovirt-early          |   37 ++++++++++++++-----------------------
 2 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/scripts/ovirt-config-storage b/scripts/ovirt-config-storage
index 9912118..45355fd 100755
--- a/scripts/ovirt-config-storage
+++ b/scripts/ovirt-config-storage
@@ -15,6 +15,8 @@ die() { warn "$*"; exit 1; }
 trap '__st=$?; stop_log; exit $__st' 0
 trap 'exit $?' 1 2 13 15
 
+default_overcommit=0.5
+
 default_boot_size=50
 default_root_size=256
 default_config_size=5
@@ -427,9 +429,11 @@ case $MEM_SIZE_MB in
     ''|*[^0-9]*) die failed to get system memory size;;
 esac
 MEM_SIZE_MB=$(echo "scale=0; $MEM_SIZE_MB / 1024;" | bc -l)
+
+overcommit=${OVIRT_OVERCOMMIT:-$default_overcommit}
 # we multiply the overcommit coefficient by 10 then divide the
 # product by 10 to avoid decimals in the result
-OVERCOMMIT_SWAP_SIZE=$(echo "scale=0; (${MEM_SIZE_MB} * (${OVIRT_OVERCOMMIT} * 10))/10;" | bc -l)
+OVERCOMMIT_SWAP_SIZE=$(echo "scale=0; (${MEM_SIZE_MB} * (${overcommit} * 10))/10;" | bc -l)
 
 # add to the swap the amounts from http://kbase.redhat.com/faq/docs/DOC-15252
 MEM_SIZE_GB=$(echo "scale=0; $MEM_SIZE_MB/1024;" | bc -l)
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index c61fe3b..0f5bb27 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -162,15 +162,15 @@ start() {
 
     #   ovirt_local_boot
     # install/update oVirt Node image on the local installation target disk
-    local_boot=0
+    local_boot=
 
     #   ovirt_overcommit=<overcommit_ratio>
     # set the swap size coefficient
-    overcommit=0.5
+    overcommit=
 
     #   ovirt_standalone
     # force oVirt Node standalone mode
-    standalone=0
+    standalone=
 
     #   ovirt_firstboot
     # force firstboot configuration even if it has already been run
@@ -319,34 +319,25 @@ start() {
     # 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 syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot"
     mount_config
-    if [ -e $OVIRT_DEFAULTS ]; then
-        log "update ovirt defaults"
-        tmpaug=$(mktemp)
-        for p in $params; do
-            PARAM=$(uc $p)
-            value=$(ptr $p)
+    log "Updating $OVIRT_DEFAULTS"
+    tmpaug=$(mktemp)
+    for p in $params; do
+        PARAM=$(uc $p)
+        value=$(ptr $p)
+        if [ -n "$value" ]; then
+            log "Updating OVIRT_$PARAM to '$value'"
             echo "set /files$OVIRT_DEFAULTS/OVIRT_$PARAM '\"$value\"'" \
                 >> $tmpaug
-        done
-        augtool $tmpaug
-    else
-        log "initial startup"
-        # dump all ovirt bootparams
-        mkdir -p $(dirname $OVIRT_DEFAULTS)
-        echo > $OVIRT_DEFAULTS
-        for p in $params; do
-            PARAM=$(uc $p)
-            echo "OVIRT_$PARAM='$(ptr $p)'" >> $OVIRT_DEFAULTS
-        done
-        ovirt_store_config $OVIRT_DEFAULTS
-    fi
+        fi
+    done
+    augtool $tmpaug
 
     if [ -f /etc/sysconfig/network ]; then
         . /etc/sysconfig/network
         hostname $HOSTNAME
     fi
 
-    if [ $standalone = 0 ]; then
+    if [ ! $standalone = 1 ]; then
         configure_from_network $bootif
         if [ -n "$init" ]; then
             ovirt-config-storage AUTO
-- 
1.6.0.6




More information about the ovirt-devel mailing list