[Ovirt-devel] [PATCH] Supports setting the OVIRT_RUNTIME_MODE value from the kernel cmdline.

Arthur CLEMENT aclement at linagora.com
Tue Mar 23 13:41:54 UTC 2010


Signed-off-by: Arthur CLEMENT <aclement at linagora.com>
---
 scripts/ovirt           |    3 ---
 scripts/ovirt-awake     |    4 +---
 scripts/ovirt-early     |   17 +++++++++++------
 scripts/ovirt-functions |   12 ++++++++----
 scripts/ovirt-post      |    3 ---
 5 files changed, 20 insertions(+), 19 deletions(-)

diff --git a/scripts/ovirt b/scripts/ovirt
index 9f7156a..868d396 100755
--- a/scripts/ovirt
+++ b/scripts/ovirt
@@ -16,9 +16,6 @@
 prog=ovirt
 VAR_SUBSYS_OVIRT=/var/lock/subsys/$prog
 
-# load the configuration file
-[ -f "$NODE_CONFIG" ] && . "$NODE_CONFIG"
-
 ovirt_start() {
     if is_standalone; then
         return 0
diff --git a/scripts/ovirt-awake b/scripts/ovirt-awake
index 5126a54..ed4cb6f 100755
--- a/scripts/ovirt-awake
+++ b/scripts/ovirt-awake
@@ -31,15 +31,13 @@
 # config: /etc/sysconfig/node-config
 
 . /etc/init.d/functions
+. /usr/libexec/ovirt-functions
 
 prog=ovirt-awake
 NODE_CONFIG=/etc/sysconfig/node-config
 VAR_SUBSYS_NODECONFIG=/var/lock/subsys/node-config
 
-# load the configuration file
-[ -f "$NODE_CONFIG" ] && . "$NODE_CONFIG"
 
-. /usr/libexec/ovirt-functions
 
 send_text () {
     local text=${1}
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index 24c1816..7f7c99c 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -15,9 +15,6 @@
 prog=ovirt-early
 VAR_SUBSYS_OVIRT_EARLY=/var/lock/subsys/$prog
 
-# load the configuration file
-[ -f "$NODE_CONFIG" ] && . "$NODE_CONFIG"
-
 BONDING_MODCONF_FILE=/etc/modprobe.d/bonding
 AUGTOOL_CONFIG=/var/tmp/augtool-config
 EARLY_DIR=/etc/ovirt-early.d
@@ -181,6 +178,7 @@ start_ovirt_early () {
     #   ovirt_upgrade
     #   ovirt_standalone
     #   ovirt_firstboot
+    #   ovirt_runtime_mode
     #   rescue
     #   pxelinux format: ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask>
     #   anaconda format: ip=<client-ip> netmask=<netmask> gateway=<gw-ip>
@@ -242,6 +240,10 @@ start_ovirt_early () {
     # in auto-install mode, overwrite the disk chosen by ovirt_init parameter
     firstboot=
 
+    #   ovirt_runtime_mode
+    # overrides the runtime mode defined in /etc/sysconfig/node-config
+    runtime_mode=
+
     #   rescue
     # enter emergency shell for fixing configuration issues
     rescue=
@@ -367,7 +369,10 @@ start_ovirt_early () {
             ovirt_firstboot*)
             firstboot=1
             ;;
-            rescue)
+            runtime_mode*)
+            runtime_mode=${i#runtime_mode=}
+            ;;
+	    rescue)
             rescue=1
             ;;
             rootpw=*)
@@ -442,7 +447,7 @@ start_ovirt_early () {
         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 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"
+    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 runtime_mode"
     # mount /config unless firstboot is forced
     if [ "$firstboot" != "1" ]; then
         mount_config
@@ -459,7 +464,7 @@ start_ovirt_early () {
         fi
     done
     augtool $tmpaug
-
+    . $OVIRT_DEFAULTS
     if [ -f /etc/sysconfig/network ]; then
         . /etc/sysconfig/network
         if [ -n "$HOSTNAME" ]; then
diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index 8e6d770..f760b69 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -6,11 +6,15 @@ _log_status=1
 
 # label of the oVirt partition
 OVIRT_LABEL=OVIRT
-# configuration defaults
+# configuration values are loaded in the following order:
+# 1. /etc/sysconfig/node-config sets the default values
+# 2. /etc/default/ovirt is loaded to override defaults with karg values
+NODE_SYSCONFIG=/etc/sysconfig/node-config
 OVIRT_DEFAULTS=/etc/default/ovirt
-if [ -f $OVIRT_DEFAULTS ]; then
-    . $OVIRT_DEFAULTS
-fi
+
+if [ -f "$NODE_SYSCONFIG" ]; then . "$NODE_SYSCONFIG"; fi
+if [ -f $OVIRT_DEFAULTS ];   then . $OVIRT_DEFAULTS; fi
+
 # fallback when default is empty
 OVIRT_STANDALONE=${OVIRT_STANDALONE:-0}
 
diff --git a/scripts/ovirt-post b/scripts/ovirt-post
index d0d1d20..936a0fd 100755
--- a/scripts/ovirt-post
+++ b/scripts/ovirt-post
@@ -16,9 +16,6 @@
 prog=ovirt-post
 VAR_SUBSYS_OVIRT_POST=/var/lock/subsys/$prog
 
-# load the configuration file
-[ -f "$NODE_CONFIG" ] && . "$NODE_CONFIG"
-
 start_ovirt_post() {
     # wait for libvirt to finish initializing
     local count=0
-- 
1.6.6.1




More information about the ovirt-devel mailing list