From patchwork Wed Oct 2 08:39:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1991875 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LnjrzaQM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJSsT0SZqz1xtr for ; Wed, 2 Oct 2024 18:39:24 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id F167A40CD7; Wed, 2 Oct 2024 08:39:22 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Bpv7okLW3BRF; Wed, 2 Oct 2024 08:39:20 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 1F11840C67 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LnjrzaQM Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1F11840C67; Wed, 2 Oct 2024 08:39:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C849DC08A6; Wed, 2 Oct 2024 08:39:19 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 791E9C08A3 for ; Wed, 2 Oct 2024 08:39:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5770A60A8D for ; Wed, 2 Oct 2024 08:39:18 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id anYaJ_s5mn66 for ; Wed, 2 Oct 2024 08:39:17 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 5DE6D60A8E Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 5DE6D60A8E Authentication-Results: smtp3.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=LnjrzaQM Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 5DE6D60A8E for ; Wed, 2 Oct 2024 08:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727858356; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pJ9gR7oIEIbnAa1Ss83l9hyJ900i8hvmfNgKGqsSrXA=; b=LnjrzaQMAM+SpbV5Qlf/bSlwTeULURZQcgEXeDtITH8rihC6X1QxiZXSjUMtysnvNEL97n FW8K07VsB7uXjgrPlpV/TaJ/1bVNxu5fhvc9mZJQtZckWYstTDyQEtKidBaTGMEFMvEaFN hzk2I7DRQOTwfU6piW1/524u5qP/FzM= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-38-eMe_sL-kPEWlo4jFMlxMKQ-1; Wed, 02 Oct 2024 04:39:15 -0400 X-MC-Unique: eMe_sL-kPEWlo4jFMlxMKQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 56F4D1956095 for ; Wed, 2 Oct 2024 08:39:14 +0000 (UTC) Received: from wsfd-netdev90.ntdv.lab.eng.bos.redhat.com (wsfd-netdev90.anl.eng.rdu2.dc.redhat.com [10.6.38.135]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7EDAE19560A2; Wed, 2 Oct 2024 08:39:13 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Wed, 2 Oct 2024 10:39:12 +0200 Message-Id: <20241002083912.1630118-1-xsimonar@redhat.com> In-Reply-To: <20240604131042.825909-7-xsimonar@redhat.com> References: <20240604131042.825909-7-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn v2] tests: Wait for controller exit before restart. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" In some rare cases, and despite "recent" changes to wait for cleanup before replying to exit, ovn-controller was still running when trying to restart it. Signed-off-by: Xavier Simonart --- v2: - Renamed OVN_CONTROLLER_EXIT_RESTART to OVN_CONTROLLER_EXIT as per Mark's suggestion. - Rebased on origin/main. --- tests/ovn-macros.at | 9 +++++++++ tests/ovn.at | 17 ++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 77d1515f6..7d11663ec 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -1193,6 +1193,15 @@ m4_define([OVN_CHECK_SCAPY_EDNS_CLIENT_SUBNET_SUPPORT], AT_SKIP_IF([! echo "from scapy.layers.dns import EDNS0ClientSubnet" | python 2>&1 > /dev/null]) ]) +m4_define([OVN_CONTROLLER_EXIT], + [TMPPID=$(cat $1/ovn-controller.pid) + AT_CHECK([as $1 ovn-appctl -t ovn-controller exit --restart]) + # 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" + OVS_WAIT_WHILE([kill -0 $TMPPID 2>/dev/null]) +]) + m4_define([OFTABLE_PHY_TO_LOG], [0]) m4_define([OFTABLE_LOG_INGRESS_PIPELINE], [8]) m4_define([OFTABLE_OUTPUT_LARGE_PKT_DETECT], [40]) diff --git a/tests/ovn.at b/tests/ovn.at index 826b52051..4d5d8152e 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -20701,7 +20701,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 -as hv2 ovs-appctl -t ovn-controller exit --restart +OVN_CONTROLLER_EXIT([hv2]) # Now send the packet again. This time, it should still arrive OVS_WAIT_UNTIL([as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet"]) @@ -29480,7 +29480,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 -check as hv3 ovn-appctl -t ovn-controller exit --restart +OVN_CONTROLLER_EXIT([hv3]) wait_for_ports_up ovn-nbctl --wait=sb sync wait_row_count Chassis_Private 9 name!=hv3 nb_cfg=2 @@ -36460,7 +36460,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 -check as hv1 ovn-appctl -t ovn-controller exit --restart +OVN_CONTROLLER_EXIT([hv1]) # The tunnel should remain intact check_tunnel_port hv1 br-int hv2@192.168.0.2%192.168.0.1 @@ -36489,7 +36489,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 -check as hv1 ovn-appctl -t ovn-controller exit --restart +OVN_CONTROLLER_EXIT([hv1]) # The tunnel should remain intact check_tunnel_port hv1 br-int1 hv2@192.168.0.2%192.168.0.1 @@ -36579,10 +36579,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 -check ovn-appctl -t ovn-controller exit --restart - -# Make sure ovn-controller stopped before restarting it -OVS_WAIT_UNTIL([test x$(ovn-appctl -t ovn-controller debug/status) != "xrunning"]) +OVN_CONTROLLER_EXIT([hv1]) # for some reason SSL ovsdb configuration overrides CLI, so # delete ssl config from ovsdb to give CLI arguments priority @@ -37298,9 +37295,7 @@ AT_CHECK([grep -c "NXT_CT_FLUSH_ZONE" hv1/ovs-vswitchd.log], [0], [dnl ]) AS_BOX([Check conversion from UUID - restart]) -ovn-appctl -t ovn-controller exit --restart -# Make sure ovn-controller stopped before restarting it -OVS_WAIT_UNTIL([test "$(ovn-appctl -t ovn-controller debug/status)" != "running"]) +OVN_CONTROLLER_EXIT([hv1]) replace_with_uuid lr0 replace_with_uuid sw0