ovs-save: Use timeout option for ovs-vsctl
authorGurucharan Shetty <gshetty@nicira.com>
Fri, 26 Oct 2012 18:17:17 +0000 (11:17 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Fri, 26 Oct 2012 19:26:55 +0000 (12:26 -0700)
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@nicira.com>
utilities/ovs-save

index 9ed14ebb33deae377eb1eaa32647f89901829cf7..01e57914e6ff8760ccf89baf357902a60bfd8f30 100755 (executable)
@@ -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