[Ovirt-devel] [PATCH node] Fixed check for whether the network restarted.

Darryl L. Pierce dpierce at redhat.com
Mon Jan 19 22:32:05 UTC 2009


The last network interface touched by the script is checked to see if it
has active ARP entries. If not then the restart is considered a failure
even through the service itself restarted.

Signed-off-by: Darryl L. Pierce <dpierce at redhat.com>
---
 scripts/ovirt-config-networking |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/ovirt-config-networking b/scripts/ovirt-config-networking
index 5727c47..646b36d 100755
--- a/scripts/ovirt-config-networking
+++ b/scripts/ovirt-config-networking
@@ -17,6 +17,7 @@ trap '__st=$?; rm -rf "$WORKDIR"; stop_log; exit $__st' 0
 trap 'exit $?' 1 2 13 15
 
 CONFIG_FILE_ROOT="/files/etc/sysconfig/network-scripts/ifcfg"
+CONFIGURED_IFACE=""
 
 function configure_interface
 {
@@ -34,6 +35,8 @@ function configure_interface
     local IF_FILENAME="$WORKDIR/augtool-$NIC"
     local BR_FILENAME="$WORKDIR/augtool-$BRIDGE"
 
+    CONFIGURED_IFACE=$BRIDGE
+
     printf "\nConfigure $BRIDGE for use by $NIC..\n\n"
 
     local IF_ROOT="$CONFIG_FILE_ROOT-$NIC"
@@ -239,10 +242,12 @@ if ls "$WORKDIR"/augtool-* > /dev/null 2>&1 ; then
     cat "$WORKDIR"/augtool-* > $config \
         && augtool $config  \
         && service network restart
-    if [ $? = 0 ]; then
-        log "Network configured successfully"
-    else
+    # check of rthe bridge's existence
+    net_check=$(arp -i $CONFIGURED_IFACE)
+    if [[ $net_check =~ "no match found" ]]; then
         log "Error configuring network, see $OVIRT_LOGFILE"
+    else
+        log "Network configured successfully"
     fi
 fi
 ovirt_store_config /etc/sysconfig/network-scripts/ifcfg*
-- 
1.6.0.6




More information about the ovirt-devel mailing list