This caused ovn-controller restart to sometimes fail due with an error: "already running as pid xxx, aborting".
Signed-off-by: Xavier Simonart <xsimo...@redhat.com> --- - v2: Updated based on Mark's review i.e. update OVN_CONTROLLER_EXIT macro. --- tests/ovn-controller.at | 16 ++++++++-------- tests/ovn-macros.at | 6 ++++-- tests/ovn.at | 12 ++++++------ tests/system-ovn.at | 10 ++++------ 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at index 6007a7454..afdc76a32 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -3331,7 +3331,7 @@ AT_CHECK([test $(ovn-appctl -t ovn-controller ct-zone-list | awk '/lr_snat/{prin n_flush=$(grep -c -i ct_flush_zone hv1/ovs-vswitchd.log) # Stop ovn-controller on hv1 with --restart flag -OVN_CONTROLLER_EXIT([hv1]) +OVN_CONTROLLER_EXIT([hv1],[--restart]) start_daemon ovn-controller --verbose="ct_zone:dbg" wait_for_ports_up @@ -3349,7 +3349,7 @@ check_ct_zone_max 22 AT_CHECK([test $(ovn-appctl -t ovn-controller ct-zone-list | awk '/lr_snat/{print $2}') -eq 0]) n_flush=$(grep -c -i ct_flush_zone hv1/ovs-vswitchd.log) -OVN_CONTROLLER_EXIT([hv1]) +OVN_CONTROLLER_EXIT([hv1],[--restart]) start_daemon ovn-controller --verbose="ct_zone:dbg" wait_for_ports_up check ovn-nbctl --wait=hv sync @@ -3729,12 +3729,12 @@ start_controller() { } # Stop ovn-controller, without any argument it will cleanup resources. -check ovn-appctl -t ovn-controller exit +OVN_CONTROLLER_EXIT([hv1],[]) check grep -q "Exiting ovn-controller, resource cleanup: True" hv1/ovn-controller.log # Stop ovn-controller without cleanup. start_controller -check ovn-appctl -t ovn-controller exit --restart +OVN_CONTROLLER_EXIT([hv1],[--restart]) check grep -q "Exiting ovn-controller, resource cleanup: False (--restart)" hv1/ovn-controller.log # Set cleanup on exit. @@ -3742,12 +3742,12 @@ check ovs-vsctl set open . external-ids:ovn-cleanup-on_exit=true # Stop ovn-controller, without any argument it will cleanup resources. start_controller -check ovn-appctl -t ovn-controller exit +OVN_CONTROLLER_EXIT([hv1],[]) check grep -q "Exiting ovn-controller, resource cleanup: True" hv1/ovn-controller.log # Stop ovn-controller, --restart flag has priority over external-ids, no cleanup. start_controller -check ovn-appctl -t ovn-controller exit --restart +OVN_CONTROLLER_EXIT([hv1],[--restart]) check grep -q "Exiting ovn-controller, resource cleanup: False (--restart)" hv1/ovn-controller.log # Set cleanup on exit to false. @@ -3755,12 +3755,12 @@ check ovs-vsctl set open . external-ids:ovn-cleanup-on-exit=false # Stop ovn-controller, without any argument it won't cleanup due to the external-ids. start_controller -check ovn-appctl -t ovn-controller exit +OVN_CONTROLLER_EXIT([hv1],[]) check grep -q "Exiting ovn-controller, resource cleanup: False (--restart)" hv1/ovn-controller.log # Stop ovn-controller without cleanup. start_controller -check ovn-appctl -t ovn-controller exit --restart +OVN_CONTROLLER_EXIT([hv1],[--restart]) check grep -q "Exiting ovn-controller, resource cleanup: False (--restart)" hv1/ovn-controller.log # Start the controller so the test cleanup routing doesn't get stuck. diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 13cff5c38..642d2a619 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -1459,9 +1459,11 @@ m4_define([OVN_CHECK_SCAPY_EDNS_CLIENT_SUBNET_SUPPORT], AT_SKIP_IF([! echo "from scapy.layers.dns import EDNS0ClientSubnet" | python 2>&1 > /dev/null]) ]) +# OVN_CONTROLLER_EXIT exits ovn-controller running on $1, with option $2 (e.g. --restart) m4_define([OVN_CONTROLLER_EXIT], - [TMPPID=$(cat $1/ovn-controller.pid) - AT_CHECK([as $1 ovn-appctl -t ovn-controller exit --restart]) + [TMPPID=$(cat ./$1/ovn-controller.pid) + AT_CHECK([as $1 +check ovn-appctl -t ovn-controller exit $2]) # Make sure ovn-controller stopped so that a future restart will not fail. # Checking debug/status is running is not enough as there might be a small race condition. echo "Waiting for pid $TMPPID" diff --git a/tests/ovn.at b/tests/ovn.at index 108de260e..feb240c11 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -21811,7 +21811,7 @@ echo $expected | ovstest test-ovn expr-to-packets > expected OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) # Stop ovn-controller on hv2 with --restart flag -OVN_CONTROLLER_EXIT([hv2]) +OVN_CONTROLLER_EXIT([hv2],[--restart]) # Now send the packet again. This time, it should still arrive OVS_WAIT_UNTIL([as hv1 ovn-appctl -t ovn-controller inject-pkt "$packet"]) @@ -30843,7 +30843,7 @@ check test "$hvt2" -gt 0 # Kill ovn-controller on chassis hv3, so that it won't update nb_cfg. # Then wait for 9 out of 10 sleep 1 -OVN_CONTROLLER_EXIT([hv3]) +OVN_CONTROLLER_EXIT([hv3],[--restart]) wait_for_ports_up check ovn-nbctl --wait=sb sync wait_row_count Chassis_Private 9 name!=hv3 nb_cfg=2 @@ -38417,7 +38417,7 @@ check_tunnel_port hv1 br-int hv2@192.168.0.2%192.168.0.1 check_tunnel_port hv2 br-int hv1@192.168.0.1%192.168.0.2 # Stop ovn-controller on hv1 -OVN_CONTROLLER_EXIT([hv1]) +OVN_CONTROLLER_EXIT([hv1],[--restart]) # The tunnel should remain intact check_tunnel_port hv1 br-int hv2@192.168.0.2%192.168.0.1 @@ -38446,7 +38446,7 @@ check_tunnel_port hv2 br-int1 hv1@192.168.0.1%192.168.0.2 check grep -q "Clearing old tunnel port \"ovn-hv1-0\" (hv1@192.168.0.1%192.168.0.2) from bridge \"br-int\"" hv2/ovn-controller.log # Stop ovn-controller on hv1 -OVN_CONTROLLER_EXIT([hv1]) +OVN_CONTROLLER_EXIT([hv1],[--restart]) # The tunnel should remain intact check_tunnel_port hv1 br-int1 hv2@192.168.0.2%192.168.0.1 @@ -38536,7 +38536,7 @@ prev_id2=$(ovs-vsctl --bare --columns _uuid find port external_ids:ovn-chassis-i # The hv2 is running we can remove the override file rm -f ${OVN_SYSCONFDIR}/system-id-override -OVN_CONTROLLER_EXIT([hv1]) +OVN_CONTROLLER_EXIT([hv1],[--restart]) # for some reason SSL/TLS ovsdb configuration overrides CLI, so # delete ssl config from ovsdb to give CLI arguments priority @@ -39336,7 +39336,7 @@ AT_CHECK([grep -c "NXT_CT_FLUSH_ZONE" hv1/ovs-vswitchd.log], [0], [dnl ]) AS_BOX([Check conversion from UUID - restart]) -OVN_CONTROLLER_EXIT([hv1]) +OVN_CONTROLLER_EXIT([hv1],[--restart]) replace_with_uuid lr0 replace_with_uuid sw0 diff --git a/tests/system-ovn.at b/tests/system-ovn.at index c2b70d3a1..e0407383a 100644 --- a/tests/system-ovn.at +++ b/tests/system-ovn.at @@ -16266,9 +16266,8 @@ blackhole 198.51.100.0/24 proto ovn metric 1000 233.252.0.0/24 via 192.168.10.10 dev lo onlink 233.253.0.0/24 via 192.168.20.20 dev hv1-mll onlink]) -# Stoping with --restart will not touch the routes. -check ovn-appctl -t ovn-controller exit --restart -OVS_WAIT_UNTIL([test "$(ovn-appctl -t ovn-controller debug/status)" != "running"]) +# Stopping with --restart will not touch the routes. +OVN_CONTROLLER_EXIT([],[--restart]) OVN_ROUTE_EQUAL([ovnvrf1338], [dnl blackhole 192.0.2.1 proto ovn metric 1000 blackhole 192.0.2.2 proto ovn metric 100 @@ -16610,9 +16609,8 @@ blackhole 198.51.100.0/24 proto ovn metric 1000 233.252.0.0/24 via 192.168.10.10 dev lo onlink 233.253.0.0/24 via 192.168.20.20 dev hv1-mll onlink]) -# Stoping with --restart will not touch the routes. -check ovn-appctl -t ovn-controller exit --restart -OVS_WAIT_UNTIL([test "$(ovn-appctl -t ovn-controller debug/status)" != "running"]) +# Stopping with --restart will not touch the routes. +OVN_CONTROLLER_EXIT([],[--restart]) OVN_ROUTE_EQUAL([ovnvrf1337], [dnl blackhole 192.0.2.1 proto ovn metric 100 blackhole 192.0.2.2 proto ovn metric 100 -- 2.47.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev