[ovs-dev] [PATCH 2/2] debian: Add "force-reload-kmod" command to /etc/init.d/openvswitch-switch.

Ben Pfaff blp at nicira.com
Mon Jun 20 22:32:13 UTC 2011


On Mon, Jun 20, 2011 at 03:05:11PM -0700, Andrew Evans wrote:
> On Mon, Jun 20, 2011 at 2:50 PM, Ben Pfaff <blp at nicira.com> wrote:
> > On Mon, Jun 20, 2011 at 02:45:46PM -0700, Andrew Evans wrote:
> >> Does anything unlink $script on exit (normal or otherwise)?
> >
> > No, this feature is experimental enough that I suspect we'll need to
> > collect the generated scripts for debugging from time to time, even in
> > cases where OVS reports success.
> >
> > Hmm, maybe we could dump it to a log somewhere instead.
> 
> That sounds good to me. The fewer separate logs we have to collect, the better.

OK, here's a patch.  I haven't tested it yet.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <blp at nicira.com>
Date: Mon, 20 Jun 2011 15:31:41 -0700
Subject: [PATCH] ovs-ctl: Clean up temporary file used for force-reload-kmod.

Suggested-by: Andrew Evans <aevans at nicira.com>
---
 utilities/ovs-ctl.in |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 923e1b5..0eea59e 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -229,6 +229,7 @@ force_reload_kmod () {
     stop
 
     script=`mktemp`
+    trap 'rm -f $script' 0 1 2 13 15
     action "Save interface configuration to $script" true
     if "$datadir/scripts/ovs-save" $ifaces > "$script"; then
         :
@@ -249,7 +250,11 @@ force_reload_kmod () {
 
     start
 
-    action "Restore interface configuration from $script" "$script"
+    if action "Restore interface configuration from $script" "$script"; then
+        logger -p daemon.debug -t ovs-save -f "$script" "force-reload-kmod interface restore script:"
+    else
+        logger -p daemon.err -t ovs-save -f "$script" "Failed force-reload-kmod interface restore script:"
+    fi
 }
 
 ## ---- ##
-- 
1.7.4.4




More information about the dev mailing list