[ovs-dev] [PATCH v1] utilities: check datapath exists before conntrack flush

Martin Xu martinxu9.ovs at gmail.com
Tue Jul 31 05:47:18 UTC 2018

As part of "force-reload-kmod," conntrack flush command is issued as
'action "ovs-appctl dpctl/flush-conntrack"'. In case no datapath exists
yet when issuing "force-reload-kmod," there is an error message
"ovs-vswitchd: no datapaths exist\ ovs-appctl: ovs-vswitchd: server
returned an error", which is harmless but potentially shows up as "FAILED."
Add an if condition to check whether datapath exists before running the
conntrack flush command.

VMware-BZ: #2170402
Fixes: 265d70310c69 ("utilities: Fix conntrack flush command")

Signed-off-by: Martin Xu <martinxu9.ovs at gmail.com>
CC: Greg Rose <gvrose8192 at gmail.com>
CC: Aaron Conole <aconole at redhat.com>
CC: Justin Pettit <jpettit at ovn.org>
 utilities/ovs-lib.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in
index 92f98ad..d6ef77b 100644
--- a/utilities/ovs-lib.in
+++ b/utilities/ovs-lib.in
@@ -605,7 +605,9 @@ force_reload_kmod () {
     start_ovsdb || return 1
-    action "Flush old conntrack entries" ovs-appctl dpctl/flush-conntrack
+    if [[ $(ovs-dpctl show) ]]; then
+        action "Flush old conntrack entries" ovs-appctl dpctl/flush-conntrack
+    fi
     if action "Saving interface configuration" save_interfaces; then

More information about the dev mailing list