From patchwork Tue Jun 4 13:10:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xavier Simonart X-Patchwork-Id: 1943319 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=O43QNmri; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (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 4VtrZG0FClz20PW for ; Tue, 4 Jun 2024 23:11:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 4641384821; Tue, 4 Jun 2024 13:10:58 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id XwZ9IrrmymXs; Tue, 4 Jun 2024 13:10:54 +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 smtp1.osuosl.org BA828847E9 Authentication-Results: smtp1.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=O43QNmri Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id BA828847E9; Tue, 4 Jun 2024 13:10:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C6518C0DD8; Tue, 4 Jun 2024 13:10:52 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 90AE1C0077 for ; Tue, 4 Jun 2024 13:10:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6454F606ED for ; Tue, 4 Jun 2024 13:10:46 +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 DsO_8eLzwKtQ for ; Tue, 4 Jun 2024 13:10:45 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=xsimonar@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp3.osuosl.org 7B34060087 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 7B34060087 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=O43QNmri Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 7B34060087 for ; Tue, 4 Jun 2024 13:10:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717506644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DYFtGZhYV4YGqC2aSMIj7A40Tlm3HgrwbXwNpr/pO5Q=; b=O43QNmriwjtS0lfIXiSVHFsnpzahydV9DNP9dvxIgRtxFU4jD83HemMW7eCWll3wGVZKnV evpcl7zVh29RvXt1Z8pTpymrvfvhQYKGoup8qrps1GjuCbLsYemZdAapGrnBa3TbhcRRJM y0xdxhtcoA/0S4Psc6XHulpNkM9hCOs= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-307-c-TAD0CCO9mfWa7MPwfIQA-1; Tue, 04 Jun 2024 09:10:43 -0400 X-MC-Unique: c-TAD0CCO9mfWa7MPwfIQA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id C59033C00085 for ; Tue, 4 Jun 2024 13:10:42 +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 smtp.corp.redhat.com (Postfix) with ESMTP id BF70F37C3; Tue, 4 Jun 2024 13:10:42 +0000 (UTC) From: Xavier Simonart To: xsimonar@redhat.com, dev@openvswitch.org Date: Tue, 4 Jun 2024 15:10:40 +0200 Message-Id: <20240604131042.825909-7-xsimonar@redhat.com> In-Reply-To: <20240604131042.825909-1-xsimonar@redhat.com> References: <20240604131042.825909-1-xsimonar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH ovn 6/8] tests: Wait for controller exit before restart. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 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 --- 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 47ada5c70..71a46db8b 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -1107,6 +1107,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_RESTART], + [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], [37]) diff --git a/tests/ovn.at b/tests/ovn.at index 2dd0dfd2e..8fa26c192 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -20615,7 +20615,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_RESTART([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"]) @@ -29316,7 +29316,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_RESTART([hv3]) wait_for_ports_up ovn-nbctl --wait=sb sync wait_row_count Chassis_Private 9 name!=hv3 nb_cfg=2 @@ -36252,7 +36252,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_RESTART([hv1]) # The tunnel should remain intact check_tunnel_port hv1 br-int hv2@192.168.0.2%192.168.0.1 @@ -36281,7 +36281,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_RESTART([hv1]) # The tunnel should remain intact check_tunnel_port hv1 br-int1 hv2@192.168.0.2%192.168.0.1 @@ -36371,10 +36371,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_RESTART([hv1]) # for some reason SSL ovsdb configuration overrides CLI, so # delete ssl config from ovsdb to give CLI arguments priority @@ -37086,9 +37083,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_RESTART([hv1]) replace_with_uuid lr0 replace_with_uuid sw0