From nobody Sat May 18 09:48:31 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1713772628607835.9859549793774; Mon, 22 Apr 2024 00:57:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 4AFF21EAD; Mon, 22 Apr 2024 03:57:07 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 564361E1C; Mon, 22 Apr 2024 03:56:34 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id C74E31E21; Mon, 22 Apr 2024 03:56:26 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 083EB1E73 for ; Mon, 22 Apr 2024 03:56:17 -0400 (EDT) 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-592-BP1_8WbuM8uDDhGM-jyRwA-1; Mon, 22 Apr 2024 03:56:14 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (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 88F6329AA2D3 for ; Mon, 22 Apr 2024 07:56:14 +0000 (UTC) Received: from maggie.brq.redhat.com (unknown [10.43.3.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 34229492BC6 for ; Mon, 22 Apr 2024 07:56:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: BP1_8WbuM8uDDhGM-jyRwA-1 From: Michal Privoznik To: devel@lists.libvirt.org Subject: [PATCH] virnetdevopenvswitch: Create OVS ports as transient Date: Mon, 22 Apr 2024 09:56:11 +0200 Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: QIMQZ52DISWIZ3ACSFJMSHRTAWX2N4GF X-Message-ID-Hash: QIMQZ52DISWIZ3ACSFJMSHRTAWX2N4GF X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1713772629212100001 Since OVS keeps desired state in a DB, upon sudden crash of the host we may leave a port behind. There's no problem on VM shutdown or NIC hotunplug as we call corresponding del-port function (virNetDevOpenvswitchRemovePort()). But if the host suddenly crashes we won't ever do that. What happens next, is when OVS starts it finds desired state in its DB and creates a stale port. OVS added support for transient ports in v2.5.0 (Feb 2016) and since its v2.9.0 it even installs a systemd service (ovs-delete-transient-ports) that automatically deletes transient ports on system startup. If we mark a port as transient then OVS won't restore its state on restart after crash. This change may render "--may-exist" argument redundant, but I'm not sure about all the implications if it was removed. Let's keep it for now. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/615 Signed-off-by: Michal Privoznik Reviewed-by: Laine Stump --- src/util/virnetdevopenvswitch.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitc= h.c index f1765ae1c8..e23f4c83b6 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -164,7 +164,9 @@ int virNetDevOpenvswitchAddPort(const char *brname, con= st char *ifname, =20 cmd =3D virNetDevOpenvswitchCreateCmd(&errbuf); virCommandAddArgList(cmd, "--", "--may-exist", - "add-port", brname, ifname, NULL); + "add-port", brname, ifname, + "--", "set", "Port", ifname, "other_config:transi= ent=3Dtrue", + NULL); =20 virNetDevOpenvswitchConstructVlans(cmd, virtVlan); =20 --=20 2.43.2 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org