[ovs-dev] [PATCH] ovs-save: Use timeout option for ovs-vsctl.

Gurucharan Shetty gshetty at nicira.com
Fri Oct 26 18:28:42 UTC 2012


Running ovs-save directly to save datapath configuration can
wait forever if ovsdb-server is not running. Use a timeout.

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 utilities/ovs-save |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/utilities/ovs-save b/utilities/ovs-save
index 9ed14eb..01e5791 100755
--- a/utilities/ovs-save
+++ b/utilities/ovs-save
@@ -177,6 +177,10 @@ save_flows () {
     done
 }
 
+ovs_vsctl () {
+    ovs-vsctl --no-wait --timeout=5 "$@"
+}
+
 save_datapaths () {
     if missing_program ovs-dpctl; then
         echo "$0: ovs-dpctl not found in $PATH" >&2
@@ -225,20 +229,20 @@ save_datapaths () {
             # For ipsec, ovs-dpctl does not show the key value pairs related
             # to certificates. Get that information from ovs-vsctl.
             if [ "${type}" = "ipsec_gre" ] ; then
-                if peer_cert=`ovs-vsctl get interface \
+                if peer_cert=`ovs_vsctl get interface \
                                 "${netdev}" options:peer_cert 2>/dev/null`; then
                     # The option peer_cert comes with an accompanying
                     # "certificate" or "use_ssl_cert"
-                    if certificate=`ovs-vsctl get interface "${netdev}" \
+                    if certificate=`ovs_vsctl get interface "${netdev}" \
                             options:certificate 2>/dev/null` ; then
                         command="${command},peer_cert=${peer_cert},certificate=${certificate}"
                     else
-                        use_ssl_cert=`ovs-vsctl get interface "${netdev}" \
+                        use_ssl_cert=`ovs_vsctl get interface "${netdev}" \
                                         options:use_ssl_cert 2>/dev/null`
                         command="${command},peer_cert=${peer_cert},use_ssl_cert=${use_ssl_cert}"
                     fi
                 else
-                    psk=`ovs-vsctl get interface "${netdev}" \
+                    psk=`ovs_vsctl get interface "${netdev}" \
                             options:psk 2>/dev/null`
                     command="${command},psk=${psk}"
                 fi
-- 
1.7.9.5




More information about the dev mailing list