[ovs-dev] [ovs-ctl 2/4] ovs-ctl: Use "action" to print success or failure directly.

Ben Pfaff blp at nicira.com
Tue Jun 21 19:45:32 UTC 2011


We have to use a shell function here so that the redirection to a
temporary file doesn't write the messages for the admin to the file instead
to the console, but this will display errors in whatever fashion the
distro prefers.
---
 utilities/ovs-ctl.in |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/utilities/ovs-ctl.in b/utilities/ovs-ctl.in
index 923e1b5..a127149 100755
--- a/utilities/ovs-ctl.in
+++ b/utilities/ovs-ctl.in
@@ -222,6 +222,10 @@ internal_interfaces () {
     done
 }
 
+save_interfaces () {
+    "$datadir/scripts/ovs-save" $ifaces > "$script"
+}
+
 force_reload_kmod () {
     ifaces=`internal_interfaces`
     action "Detected internal interfaces: $ifaces" true
@@ -229,8 +233,7 @@ force_reload_kmod () {
     stop
 
     script=`mktemp`
-    action "Save interface configuration to $script" true
-    if "$datadir/scripts/ovs-save" $ifaces > "$script"; then
+    if action "Save interface configuration to $script" save_interfaces; then
         :
     else
         log_warning_msg "Failed to save configuration, not replacing kernel module"
-- 
1.7.4.4




More information about the dev mailing list