[Ovirt-devel] [PATCH node] Replaced calls to echo with log so that we get datestamps in the log file

Perry Myers pmyers at redhat.com
Mon Jan 19 16:46:19 UTC 2009


Also, swallow output from mount_config in ovirt-early so that it doesn't
confuse users into thinking that an error has occured.  It's normal for
this function to error out in two cases:
1. firstboot before /config partition is created
2. stateless mode when there is no /config partition

Signed-off-by: Perry Myers <pmyers at redhat.com>
---
 scripts/ovirt       |   14 +++++++-------
 scripts/ovirt-early |   28 ++++++++++++++--------------
 scripts/ovirt-post  |    2 +-
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/scripts/ovirt b/scripts/ovirt
index f789d24..8694db9 100755
--- a/scripts/ovirt
+++ b/scripts/ovirt
@@ -21,11 +21,11 @@ start() {
         wget -q \
             http://$SRV_HOST:$SRV_PORT/ipa/config/krb5.ini -O $krb5_conf.tmp
         if [ $? -ne 0 ]; then
-            echo "Failed to get $krb5_conf"; return 1
+            log "Failed to get $krb5_conf"; return 1
         fi
         mv $krb5_conf.tmp $krb5_conf
     else
-        echo "skipping Kerberos configuration"
+        log "skipping Kerberos configuration"
     fi
 
     find_srv identify tcp
@@ -37,10 +37,10 @@ start() {
         fi
         ovirt-awake start $SRV_HOST $SRV_PORT $krb5_tab
         if [ $? -ne 0 ]; then
-            echo "ovirt-awake failed"; return 1
+            log "ovirt-awake failed"; return 1
         fi
     else
-        echo "skipping ovirt-awake, oVirt identify service not available"
+        log "skipping ovirt-awake, oVirt identify service not available"
     fi
 
     find_srv collectd tcp
@@ -52,11 +52,11 @@ start() {
                 -e /<Plugin rrdtool>/,/<\/Plugin>/d $collectd_conf.in \
                 > $collectd_conf
             if [ $? -ne 0 ]; then
-                echo "Failed to write $collectd_conf"; return 1
+                log "Failed to write $collectd_conf"; return 1
             fi
         fi
     else
-        echo "skipping collectd configuration, collectd service not available"
+        log "skipping collectd configuration, collectd service not available"
     fi
 
     find_srv qpidd tcp
@@ -66,7 +66,7 @@ start() {
             echo "LIBVIRT_QPID_ARGS=\"--broker $SRV_HOST --port $SRV_PORT\"" >> $libvirt_qpid_conf
         fi
     else
-        echo "skipping libvirt-qpid configuration, could not find $libvirt_qpid_conf"
+        log "skipping libvirt-qpid configuration, could not find $libvirt_qpid_conf"
     fi
 }
 
diff --git a/scripts/ovirt-early b/scripts/ovirt-early
index a7cf4dc..4968ab1 100755
--- a/scripts/ovirt-early
+++ b/scripts/ovirt-early
@@ -21,36 +21,36 @@ get_mac_addresses() {
 configure_from_network() {
     DEVICE=$1
     if [ -n "$DEVICE" ]; then
-        echo "Configuring network Using interface $DEVICE"
+        log "Configuring network Using interface $DEVICE"
         # setup temporary interface to retrieve configuration
         echo "network --device $DEVICE --bootproto dhcp" | nash
         if [ $? -eq 0 ]; then
             # from network-scripts/ifup-post
             IPADDR=$(LC_ALL=C ip -o -4 addr ls dev ${DEVICE} | awk '{ print $4 ; exit }')
-            echo "Interface brought up with $IPADDR"
+            log "Interface brought up with $IPADDR"
             eval $(ipcalc --silent --hostname ${IPADDR} ; echo "status=$?")
             if [ "$status" = "0" ]; then
                 hostname $HOSTNAME
-                echo "Hostname resolved to $HOSTNAME"
+                log "Hostname resolved to $HOSTNAME"
                 # retrieve remote config
                 find_srv ovirt tcp
                 if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
-                    echo "oVirt Server found at: $SRV_HOST:$SRV_PORT"
+                    log "oVirt Server found at: $SRV_HOST:$SRV_PORT"
                     cfgdb=$(mktemp)
                     get_mac_addresses
-                    echo "MACs to use: $macs"
+                    log "MACs to use: $macs"
                     wget -O $cfgdb \
                       "http://$SRV_HOST:$SRV_PORT/ovirt/managed_node/config?host=$(hostname)&macs=$macs"
                     if [ $? -eq 0 ]; then
-                        echo "Remote configuration bundle retrieved to $cfgdb"
+                        log "Remote configuration bundle retrieved to $cfgdb"
                         ovirt-process-config $cfgdb $BONDING_MODCONF_FILE $AUGTOOL_CONFIG
 			if [ $? -eq 0 ]; then
-			    echo "Remote configuration retrieved and applied"
+			    log "Remote configuration retrieved and applied"
 			else
-			    echo "Failure to retrieve or apply remote configuration"
+			    log "Failure to retrieve or apply remote configuration"
 			fi
                     else
-                        echo "Failed to retrieve configuration bundle"
+                        log "Failed to retrieve configuration bundle"
                     fi
                     rm $cfgdb
                 fi
@@ -62,14 +62,14 @@ configure_from_network() {
     ETHDEVS=$(cd /sys/class/net && ls -d eth*)
     for eth in $ETHDEVS; do
         BRIDGE=ovirtbr`echo $eth | cut -b4-`
-        echo "Applying default configuration to $eth and $BRIDGE"
+        log "Applying default configuration to $eth and $BRIDGE"
         printf '%s\n' "DEVICE=$eth" ONBOOT=yes "BRIDGE=$BRIDGE" \
             > /etc/sysconfig/network-scripts/ifcfg-$eth
         printf '%s\n' "DEVICE=$BRIDGE" BOOTPROTO=dhcp \
             ONBOOT=yes TYPE=Bridge PEERNTP=yes DELAY=0 \
             > /etc/sysconfig/network-scripts/ifcfg-$BRIDGE
     done
-    echo "Default config applied"
+    log "Default config applied"
 }
 
 # $(get_live_disk)
@@ -310,9 +310,9 @@ start() {
     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 syslog_server syslog_port collectd_server collectd_port bootparams hostname"
-    mount_config
+    mount_config > /dev/null 2>&1
     if [ -e $OVIRT_DEFAULTS ]; then
-        echo "update ovirt defaults"
+        log "update ovirt defaults"
         tmpaug=$(mktemp)
         for p in $params; do
             PARAM=$(uc $p)
@@ -322,7 +322,7 @@ start() {
         done
         augtool $tmpaug
     else
-        echo "initial startup"
+        log "initial startup"
         # dump all ovirt bootparams
         mkdir -p $(dirname $OVIRT_DEFAULTS)
         echo > $OVIRT_DEFAULTS
diff --git a/scripts/ovirt-post b/scripts/ovirt-post
index 3861973..068c709 100755
--- a/scripts/ovirt-post
+++ b/scripts/ovirt-post
@@ -25,7 +25,7 @@ start() {
     if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
         ovirt-identify-node -s $SRV_HOST -p $SRV_PORT
     else
-        echo "skipping ovirt-identify-node, oVirt registration service not available"
+        log "skipping ovirt-identify-node, oVirt registration service not available"
     fi
 }
 
-- 
1.6.0.6




More information about the ovirt-devel mailing list