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

Darryl L. Pierce dpierce at redhat.com
Wed Feb 24 15:36:46 UTC 2010


This argument should override what is defined in the
/etc/sysconfig/node-config file if the karg is present.

Refactored how the node default configuration and kernel argument
overrides are loaded as well.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt           |    3 ---
 scripts/ovirt-awake     |    4 ----
 scripts/ovirt-early     |   15 +++++++++++----
 scripts/ovirt-functions |   13 +++++++++----
 scripts/ovirt-post      |    3 ---
 5 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/scripts/ovirt b/scripts/ovirt
index d8d52cc..38ea7ac 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 55db140..dd03160 100755
--- a/scripts/ovirt-awake
+++ b/scripts/ovirt-awake
@@ -33,12 +33,8 @@
 . /etc/init.d/ovirt-functions
 
 prog=ovirt-early
-NODE_CONFIG=/etc/sysconfig/node-config
 VAR_SUBSYS_NODECONFIG=/var/lock/subsys/node-config
 
-# load the configuration file
-[ -f "$NODE_CONFIG" ] && . "$NODE_CONFIG"
-
 send_text () {
     local text=${1}
 
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index c3befdc..066ce38 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -16,9 +16,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
@@ -182,6 +179,7 @@ start() {
     #   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>
@@ -243,6 +241,10 @@ start() {
     # 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=
@@ -362,6 +364,11 @@ start() {
             ovirt_firstboot*)
             firstboot=1
             ;;
+
+            runtime_mode*)
+            runtime_mode=${i#runtime_mode=}
+            ;;
+
             rescue)
             rescue=1
             ;;
@@ -434,7 +441,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 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
diff --git a/scripts/ovirt-functions b/scripts/ovirt-functions
index ff2b016..30987fe 100644
--- a/scripts/ovirt-functions
+++ b/scripts/ovirt-functions
@@ -6,11 +6,16 @@ _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 951d108..2f1a23e 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() {
     # wait for libvirt to finish initializing
     local count=0
-- 
1.6.6




More information about the ovirt-devel mailing list