[Ovirt-devel] [PATCH] Redirecting all logs to /var/log/ovirt.log

Darryl L. Pierce dpierce at redhat.com
Mon Jul 14 19:16:31 UTC 2008


From: Darryl Pierce <dpierce at redhat.com>

This incorporates feedback and ensures that any function call that fails 
shows the [FAILED] output in the console, while still ensuring data is 
captured to the /var/log/ovirt.log file.


Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 ovirt-managed-node/src/scripts/ovirt           |   21 ++++++++++++---------
 ovirt-managed-node/src/scripts/ovirt-awake     |    2 +-
 ovirt-managed-node/src/scripts/ovirt-early     |   11 +++++++++--
 ovirt-managed-node/src/scripts/ovirt-functions |    5 ++++-
 ovirt-managed-node/src/scripts/ovirt-post      |   14 ++++++++------
 5 files changed, 34 insertions(+), 19 deletions(-)

diff --git a/ovirt-managed-node/src/scripts/ovirt b/ovirt-managed-node/src/scripts/ovirt
index 92a0e40..7a5ba80 100755
--- a/ovirt-managed-node/src/scripts/ovirt
+++ b/ovirt-managed-node/src/scripts/ovirt
@@ -11,15 +11,14 @@
 . /etc/init.d/ovirt-functions
 
 start() {
-    echo -n $"Starting ovirt: "
-
     find_srv ipa tcp
     krb5_conf=/etc/krb5.conf
     if [ ! -s $krb5_conf ]; then
         rm -f $krb5_conf
         # FIXME this is IPA specific
-        wget -q http://$SRV_HOST:$SRV_PORT/ipa/config/krb5.ini -O $krb5_conf \
-            || die "Failed to get $krb5_conf"
+        wget -q \
+            http://$SRV_HOST:$SRV_PORT/ipa/config/krb5.ini -O $krb5_conf \
+            || echo "Failed to get $krb5_conf" && return 1
     fi
     IPA_HOST=$SRV_HOST
     IPA_PORT=$SRV_PORT
@@ -34,16 +33,20 @@ start() {
         sed -e "s/@COLLECTD_SERVER@/$SRV_HOST/" \
             -e "s/@COLLECTD_PORT@/$SRV_PORT/" $collectd_conf.in \
             > $collectd_conf \
-            || die "Failed to write $collectd_conf"
+            || echo "Failed to write $collectd_conf" && return 1
     fi
-
-    success
-    echo
 }
 
 case "$1" in
     start)
-        start
+        echo -n $"Starting ovirt: "
+
+        {
+            start
+        } >> $OVIRT_LOGFILE 2>&1
+
+        test $? == 0 && success || failure
+        echo
         ;;
     *)
         echo "Usage: ovirt {start}"
diff --git a/ovirt-managed-node/src/scripts/ovirt-awake b/ovirt-managed-node/src/scripts/ovirt-awake
index 4e43d45..38d405e 100755
--- a/ovirt-managed-node/src/scripts/ovirt-awake
+++ b/ovirt-managed-node/src/scripts/ovirt-awake
@@ -66,7 +66,7 @@ start () {
             if [ -n $KEYTAB ]; then
                 echo "Retrieving keytab: '$KEYTAB'"
 
-                wget $KEYTAB --output-document=$KEYTAB_FILE
+                wget -q $KEYTAB --output-document=$KEYTAB_FILE
             else
                 echo "No keytab to retrieve"
             fi
diff --git a/ovirt-managed-node/src/scripts/ovirt-early b/ovirt-managed-node/src/scripts/ovirt-early
index 4116847..6c7aaa3 100755
--- a/ovirt-managed-node/src/scripts/ovirt-early
+++ b/ovirt-managed-node/src/scripts/ovirt-early
@@ -27,7 +27,7 @@ configure_from_network() {
                 find_srv ovirt tcp
                 printf .
                 if [ -n "$SRV_HOST" -a -n "$SRV_PORT" ]; then
-                    wget --quiet -O - "http://$SRV_HOST:$SRV_PORT/ovirt/cfgdb/$(hostname)" \
+                    wget -q -O - "http://$SRV_HOST:$SRV_PORT/ovirt/cfgdb/$(hostname)" \
                         | augtool > /dev/null 2>&1
                     if [ $? -eq 0 ]; then
                         printf "remote config applied."
@@ -96,7 +96,14 @@ start() {
 
 case "$1" in
     start)
-        start
+        echo -n $"Starting ovirt-early: "
+
+        {
+            start
+        } >> $OVIRT_LOGFILE 2>&1
+
+        test $? == 0 && success || failure
+        echo
         ;;
     *)
         echo "Usage: ovirt-early {start}"
diff --git a/ovirt-managed-node/src/scripts/ovirt-functions b/ovirt-managed-node/src/scripts/ovirt-functions
index 9974533..5b530f7 100644
--- a/ovirt-managed-node/src/scripts/ovirt-functions
+++ b/ovirt-managed-node/src/scripts/ovirt-functions
@@ -1,6 +1,9 @@
 # -*-Shell-script-*-
 
-find_srv() {
+OVIRT_LOGFILE=/var/log/ovirt.log
+
+find_srv()
+{
     local dnsreply
     dnsreply=$(dig +short -t srv _$1._$2.$(dnsdomainname))
     if [ $? -eq 0 ]; then
diff --git a/ovirt-managed-node/src/scripts/ovirt-post b/ovirt-managed-node/src/scripts/ovirt-post
index 3bb0f6d..f113b28 100755
--- a/ovirt-managed-node/src/scripts/ovirt-post
+++ b/ovirt-managed-node/src/scripts/ovirt-post
@@ -11,8 +11,6 @@
 . /etc/init.d/ovirt-functions
 
 start() {
-    echo -n $"Starting ovirt-post: "
-
     find_srv identify tcp
     UUID=`hal-get-property --udi \
         /org/freedesktop/Hal/devices/computer --key system.hardware.uuid`
@@ -22,14 +20,18 @@ start() {
     else
         ovirt-identify-node -s $SRV_HOST -p $SRV_PORT -u $UUID
     fi
-
-    success
-    echo
 }
 
 case "$1" in
     start)
-        start
+        echo -n $"Starting ovirt-post: "
+
+        {
+            start
+        } >> $OVIRT_LOGFILE 2>&1
+
+        test $? -eq 0 &&  success || failure
+        echo
         ;;
     *)
         echo "Usage: ovirt-post {start}"
-- 
1.5.5.1




More information about the ovirt-devel mailing list