From nobody Sun May 5 08:28:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1581913505544906.6186106807846; Sun, 16 Feb 2020 20:25:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-339-80KSybSMNFSg-J9cMmUIWA-1; Sun, 16 Feb 2020 23:23:41 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F077A13E6; Mon, 17 Feb 2020 04:23:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C6C6890F61; Mon, 17 Feb 2020 04:23:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7A79935AF7; Mon, 17 Feb 2020 04:23:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01H4N78s002258 for ; Sun, 16 Feb 2020 23:23:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3A49F5C10D; Mon, 17 Feb 2020 04:23:07 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-126.phx2.redhat.com [10.3.116.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id E7A885C112 for ; Mon, 17 Feb 2020 04:23:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581913503; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=P3q7d2+9j8o3zFjR6UriPZ9blFnL4bYamtA/wMaJ0CI=; b=ihuVg0wG0CztDGtf/p1oAyKnHewx5HlsmrSRBDGHEesk859KXVNcsMsg7MmS9YV2oxTsXa jx5wh/bPILBtgmRTSo42i73HuaFMWLx2ZEwX9HWX+2DN+khzww9nmGuVea9wIQMF3Q9HYa wGlcat2MezcndbUUaslfpXsv39QvTwA= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 01/10] schema: trivial indentation fix Date: Sun, 16 Feb 2020 23:22:50 -0500 Message-Id: <20200217042259.1066479-2-laine@redhat.com> In-Reply-To: <20200217042259.1066479-1-laine@redhat.com> References: <20200217042259.1066479-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: 80KSybSMNFSg-J9cMmUIWA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- docs/schemas/network.rng | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 56937d6a4e..677ec77724 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -237,9 +237,9 @@ - - - + + + --=20 2.24.1 From nobody Sun May 5 08:28:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1581913408529870.8580607897964; Sun, 16 Feb 2020 20:23:28 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-397-JN0vjFztPMyQWNUSzlzy3Q-1; Sun, 16 Feb 2020 23:23:24 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 55F0A18A6EC2; Mon, 17 Feb 2020 04:23:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F7A65E1AD; Mon, 17 Feb 2020 04:23:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DA07135AE0; Mon, 17 Feb 2020 04:23:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01H4N71X002267 for ; Sun, 16 Feb 2020 23:23:07 -0500 Received: by smtp.corp.redhat.com (Postfix) id AC0A05C10D; Mon, 17 Feb 2020 04:23:07 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-126.phx2.redhat.com [10.3.116.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65A6B90F5E for ; Mon, 17 Feb 2020 04:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581913407; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=voeo9u4bhNk3Q0oIuXOSqS86Rfh476tL1S5NjnGDxnU=; b=GW4JEXT2YdwGT5SQMTtltUZL0areM0XtEAf2IJlMlLVtyhSWunbxqSk51A2QsaeXJzSXO2 pXEptsUOaIWFcTmWOOWYIDd2toUqz9B8TxP/+N5uSHn9WN6dik8V8W4aE7CxVGChbkHQft Gen1RZ4w5h1k12fmmQM5o5lTa+Ug05c= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 02/10] schema: add missing vlan element to networkport RNG Date: Sun, 16 Feb 2020 23:22:51 -0500 Message-Id: <20200217042259.1066479-3-laine@redhat.com> In-Reply-To: <20200217042259.1066479-1-laine@redhat.com> References: <20200217042259.1066479-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: JN0vjFztPMyQWNUSzlzy3Q-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is in the data structure and the parse/format functions, and is getting passed all around correctly, it just was omitted from the RNG, which hasn't been noticed because no human is creating XML, and so it's never getting validated against the schema. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- docs/schemas/networkport.rng | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/schemas/networkport.rng b/docs/schemas/networkport.rng index 8cfc043a40..ea43c03d41 100644 --- a/docs/schemas/networkport.rng +++ b/docs/schemas/networkport.rng @@ -29,6 +29,9 @@ + + + --=20 2.24.1 From nobody Sun May 5 08:28:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1581913445519201.4730107961924; Sun, 16 Feb 2020 20:24:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-79-YzK0nMQfPeekdI6lN0bO_w-1; Sun, 16 Feb 2020 23:23:42 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E60BC13E5; Mon, 17 Feb 2020 04:23:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B959E1000322; Mon, 17 Feb 2020 04:23:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 743CA18089CD; Mon, 17 Feb 2020 04:23:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01H4N8hY002272 for ; Sun, 16 Feb 2020 23:23:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 285E15C112; Mon, 17 Feb 2020 04:23:08 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-126.phx2.redhat.com [10.3.116.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id D63F45C10D for ; Mon, 17 Feb 2020 04:23:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581913443; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XQY5OAZ2jdoEWnQ4WYauTOIdpqEZwgiLQWHb6gSb1ws=; b=cCUYQOHVQqUfaS6/NtDnHQt6UusILe4qHFxs3q5/ZgrvnSQjMk/2VD0hf8UQhJvXfgNgEB a6HnkUfgYfET54qnojrewASo1AdbUVMHXLJU3/txdZvDu1toHRRxf+7eyeaJQyJcVYYoHr AG3BDaY+/t+k9/J7e5Hw6WfSdWpXql0= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 03/10] qemu: save/restore original error when recovering from failed bridge attach Date: Sun, 16 Feb 2020 23:22:52 -0500 Message-Id: <20200217042259.1066479-4-laine@redhat.com> In-Reply-To: <20200217042259.1066479-1-laine@redhat.com> References: <20200217042259.1066479-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: YzK0nMQfPeekdI6lN0bO_w-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Not only was the original error code destroyed in the case of encountering an error during recovery from a failed attach to the bridge (and then *that* error was destroyed by logging a *second* error about the failure to recover - virNetDevBridgeAddPort() already logs an error, so the one about failing to recover was redundant), but if the recovery was successful, the function would then return success to the caller even though it had failed. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index c840889968..6395826c69 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3352,14 +3352,13 @@ qemuDomainChangeNetBridge(virDomainObjPtr vm, ret =3D virNetDevBridgeAddPort(newbridge, olddev->ifname); virDomainAuditNet(vm, NULL, newdev, "attach", ret =3D=3D 0); if (ret < 0) { + virErrorPtr err; + + virErrorPreserveLast(&err); ret =3D virNetDevBridgeAddPort(oldbridge, olddev->ifname); virDomainAuditNet(vm, NULL, olddev, "attach", ret =3D=3D 0); - if (ret < 0) { - virReportError(VIR_ERR_OPERATION_FAILED, - _("unable to recover former state by adding por= t " - "to bridge %s"), oldbridge); - } - return ret; + virErrorRestore(&err); + return -1; } /* caller will replace entire olddev with newdev in domain nets list */ return 0; --=20 2.24.1 From nobody Sun May 5 08:28:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1581913428934570.6652199907674; Sun, 16 Feb 2020 20:23:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-363-cVOXprSgNBeitphuuYDeIw-1; Sun, 16 Feb 2020 23:23:45 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3416F18A6EC3; Mon, 17 Feb 2020 04:23:40 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B6675C554; Mon, 17 Feb 2020 04:23:40 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id BE98118089D5; Mon, 17 Feb 2020 04:23:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01H4N8Iu002283 for ; Sun, 16 Feb 2020 23:23:08 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9A0275C112; Mon, 17 Feb 2020 04:23:08 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-126.phx2.redhat.com [10.3.116.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id 543745C10D for ; Mon, 17 Feb 2020 04:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581913427; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MRUq7F/CTOd9EyyUs7OKscNjRe0ydr/f3PDckKU3xJs=; b=bbG3NqgUWd2a1d4i12mFdmoC6DHh8TPyN11gUjcI0KCp/b1qd3YmRGPe8C6J0kWgiikzqB 5LwUUbw/h3ToMzKo3hKWYxw8sg9JF8VjJOQ1cLXahBkWeUuI/6I8veUtjeHDwFRDeV5E4M hEY4YdeVX8geoHO66hhMOvyX+RebmQE= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 04/10] util: query/set BR_ISOLATED flag on netdevs attached to bridge Date: Sun, 16 Feb 2020 23:22:53 -0500 Message-Id: <20200217042259.1066479-5-laine@redhat.com> In-Reply-To: <20200217042259.1066479-1-laine@redhat.com> References: <20200217042259.1066479-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: cVOXprSgNBeitphuuYDeIw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When this flag is set for an interface attached to a bridge, traffic to/from the specified interface can only enter/exit the bridge via another attached interface that *doesn't* have the BR_ISOLATED flag set. This can be used to permit guests to communicate with the rest of the network, but not with each other. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- src/libvirt_private.syms | 2 ++ src/util/virnetdevbridge.c | 46 ++++++++++++++++++++++++++++++++++++++ src/util/virnetdevbridge.h | 9 ++++++++ 3 files changed, 57 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index dc0449d1d8..5d043041e0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2552,8 +2552,10 @@ virNetDevBridgeFDBDel; virNetDevBridgeGetSTP; virNetDevBridgeGetSTPDelay; virNetDevBridgeGetVlanFiltering; +virNetDevBridgePortGetIsolated; virNetDevBridgePortGetLearning; virNetDevBridgePortGetUnicastFlood; +virNetDevBridgePortSetIsolated; virNetDevBridgePortSetLearning; virNetDevBridgePortSetUnicastFlood; virNetDevBridgeRemovePort; diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index 769289ae0b..d15e81daeb 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -311,6 +311,30 @@ virNetDevBridgePortSetUnicastFlood(const char *brname, } =20 =20 +int +virNetDevBridgePortGetIsolated(const char *brname, + const char *ifname, + bool *enable) +{ + unsigned long value; + + if (virNetDevBridgePortGet(brname, ifname, "isolated", &value) < 0) + return -1; + + *enable =3D !!value; + return 0; +} + + +int +virNetDevBridgePortSetIsolated(const char *brname, + const char *ifname, + bool enable) +{ + return virNetDevBridgePortSet(brname, ifname, "isolated", enable ? 1 := 0); +} + + #else int virNetDevBridgePortGetLearning(const char *brname G_GNUC_UNUSED, @@ -354,6 +378,28 @@ virNetDevBridgePortSetUnicastFlood(const char *brname = G_GNUC_UNUSED, _("Unable to set bridge port unicast_flood on thi= s platform")); return -1; } + + +int +virNetDevBridgePortGetIsolated(const char *brname G_GNUC_UNUSED, + const char *ifname G_GNUC_UNUSED, + bool *enable G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("Unable to get bridge port isolated on this pla= tform")); + return -1; +} + + +int +virNetDevBridgePortSetIsolated(const char *brname G_GNUC_UNUSED, + const char *ifname G_GNUC_UNUSED, + bool enable G_GNUC_UNUSED) +{ + virReportSystemError(ENOSYS, "%s", + _("Unable to set bridge port isolated on this pla= tform")); + return -1; +} #endif =20 =20 diff --git a/src/util/virnetdevbridge.h b/src/util/virnetdevbridge.h index 8137914da8..db4099bf0b 100644 --- a/src/util/virnetdevbridge.h +++ b/src/util/virnetdevbridge.h @@ -73,6 +73,15 @@ int virNetDevBridgePortSetUnicastFlood(const char *brnam= e, const char *ifname, bool enable) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; +int virNetDevBridgePortGetIsolated(const char *brname, + const char *ifname, + bool *enable) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3) + G_GNUC_WARN_UNUSED_RESULT; +int virNetDevBridgePortSetIsolated(const char *brname, + const char *ifname, + bool enable) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) G_GNUC_WARN_UNUSED_RESULT; =20 typedef enum { VIR_NETDEVBRIDGE_FDB_FLAG_ROUTER =3D (1 << 0), --=20 2.24.1 From nobody Sun May 5 08:28:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1581913407091753.1496506508684; Sun, 16 Feb 2020 20:23:27 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-ACS10v4AOQyG_iKgMsTygA-1; Sun, 16 Feb 2020 23:23:22 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0AAA618A6EC1; Mon, 17 Feb 2020 04:23:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0AFF5D9CA; Mon, 17 Feb 2020 04:23:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B4E5F18089CF; Mon, 17 Feb 2020 04:23:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01H4N9HJ002293 for ; Sun, 16 Feb 2020 23:23:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2F1C95C112; Mon, 17 Feb 2020 04:23:09 +0000 (UTC) Received: from vhost2.laine.org (ovpn-116-126.phx2.redhat.com [10.3.116.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7E375C10D for ; Mon, 17 Feb 2020 04:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581913405; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=D441mLSxXiol7jX+tueNphap9u4z69injrM7tk870xo=; b=AVJy/Z38m72gvLiECPDBRnRxOUDbNlKC/QFD4c0o7XH3vUikiUgZtR6cBqLBMLZgFXfu6r +tumd49RcttrKL2nqvtSyZWFtcgjX1uQ1mVCrGW6FKfdVIpsw6b/yalBLlwBC4E5Iig4W7 gqI1BHLHqaYHi1Hb52VCsnfi3iz1rUQ= From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] conf: parse/format Date: Sun, 16 Feb 2020 23:22:54 -0500 Message-Id: <20200217042259.1066479-6-laine@redhat.com> In-Reply-To: <20200217042259.1066479-1-laine@redhat.com> References: <20200217042259.1066479-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: ACS10v4AOQyG_iKgMsTygA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is a very simple thing to parse and format, but needs to be done in 4 places, so two trivial utility functions have been made that can be called from all the higher level parser/formatters: (only in domain status) Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- docs/schemas/domaincommon.rng | 3 + docs/schemas/network.rng | 3 + docs/schemas/networkcommon.rng | 11 ++++ docs/schemas/networkport.rng | 3 + src/conf/domain_conf.c | 19 ++++++ src/conf/domain_conf.h | 4 ++ src/conf/network_conf.c | 32 ++++++++++ src/conf/network_conf.h | 9 +++ src/conf/virnetworkportdef.c | 3 + src/conf/virnetworkportdef.h | 1 + src/libvirt_private.syms | 1 + tests/networkxml2xmlin/isolated-ports.xml | 7 +++ tests/networkxml2xmlout/isolated-ports.xml | 7 +++ tests/networkxml2xmltest.c | 1 + tests/qemuxml2argvdata/net-isolated-port.xml | 34 ++++++++++ .../net-isolated-port.x86_64-latest.xml | 63 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 17 files changed, 202 insertions(+) create mode 100644 tests/networkxml2xmlin/isolated-ports.xml create mode 100644 tests/networkxml2xmlout/isolated-ports.xml create mode 100644 tests/qemuxml2argvdata/net-isolated-port.xml create mode 100644 tests/qemuxml2xmloutdata/net-isolated-port.x86_64-lates= t.xml diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 29b6b95357..5bb8281a59 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3159,6 +3159,9 @@ + + + diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index 677ec77724..60453225d6 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -332,6 +332,9 @@ + + + =20 diff --git a/docs/schemas/networkcommon.rng b/docs/schemas/networkcommon.rng index fd1aac6485..c0eeb5f2c5 100644 --- a/docs/schemas/networkcommon.rng +++ b/docs/schemas/networkcommon.rng @@ -280,4 +280,15 @@ + + + + + + + + + + + diff --git a/docs/schemas/networkport.rng b/docs/schemas/networkport.rng index ea43c03d41..031c5241f0 100644 --- a/docs/schemas/networkport.rng +++ b/docs/schemas/networkport.rng @@ -32,6 +32,9 @@ + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7a0d126784..176550b62f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11480,6 +11480,9 @@ virDomainActualNetDefParseXML(xmlNodePtr node, if (vlanNode && virNetDevVlanParse(vlanNode, ctxt, &actual->vlan) < 0) goto error; =20 + if (virNetworkPortOptionsParseXML(ctxt, &actual->isolatedPort) < 0) + goto error; + *def =3D g_steal_pointer(&actual); ret =3D 0; error: @@ -12376,6 +12379,9 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, goto error; } =20 + if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0) + goto error; + cleanup: virDomainActualNetDefFree(actual); virHashFree(filterparams); @@ -25453,6 +25459,7 @@ virDomainActualNetDefContentsFormat(virBufferPtr bu= f, return -1; if (virNetDevBandwidthFormat(virDomainNetGetActualBandwidth(def), 0, b= uf) < 0) return -1; + virNetworkPortOptionsFormat(virDomainNetGetActualPortOptionsIsolated(d= ef), buf); return 0; } =20 @@ -25829,6 +25836,7 @@ virDomainNetDefFormat(virBufferPtr buf, return -1; if (virNetDevBandwidthFormat(def->bandwidth, 0, buf) < 0) return -1; + virNetworkPortOptionsFormat(def->isolatedPort, buf); =20 /* ONLY for internal status storage - format the ActualNetDef * as a subelement of so that no persistent config @@ -29906,6 +29914,17 @@ virDomainNetGetActualVlan(const virDomainNetDef *i= face) } =20 =20 +virTristateBool +virDomainNetGetActualPortOptionsIsolated(const virDomainNetDef *iface) +{ + if (iface->type =3D=3D VIR_DOMAIN_NET_TYPE_NETWORK && + iface->data.network.actual) { + return iface->data.network.actual->isolatedPort; + } + return iface->isolatedPort; +} + + bool virDomainNetGetActualTrustGuestRxFilters(const virDomainNetDef *iface) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 867a9c7661..cdc4d25700 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -928,6 +928,7 @@ struct _virDomainActualNetDef { virNetDevBandwidthPtr bandwidth; virNetDevVlan vlan; int trustGuestRxFilters; /* enum virTristateBool */ + virTristateBool isolatedPort; unsigned int class_id; /* class ID for bandwidth 'floor' */ }; =20 @@ -1032,6 +1033,7 @@ struct _virDomainNetDef { virNetDevBandwidthPtr bandwidth; virNetDevVlan vlan; int trustGuestRxFilters; /* enum virTristateBool */ + virTristateBool isolatedPort; int linkstate; unsigned int mtu; virNetDevCoalescePtr coalesce; @@ -3239,6 +3241,8 @@ const virNetDevBandwidth * virDomainNetGetActualBandwidth(const virDomainNetDef *iface); const virNetDevVlan *virDomainNetGetActualVlan(const virDomainNetDef *ifac= e); bool virDomainNetGetActualTrustGuestRxFilters(const virDomainNetDef *iface= ); +virTristateBool +virDomainNetGetActualPortOptionsIsolated(const virDomainNetDef *iface); const char *virDomainNetGetModelString(const virDomainNetDef *net); int virDomainNetSetModelString(virDomainNetDefPtr et, const char *model); diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 1f14a964a2..e9cc9bb55a 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1172,6 +1172,26 @@ virNetworkIPDefParseXML(const char *networkName, } =20 =20 +int +virNetworkPortOptionsParseXML(xmlXPathContextPtr ctxt, + virTristateBool *isolatedPort) +{ + g_autofree char *str =3D NULL; + int tmp =3D VIR_TRISTATE_BOOL_ABSENT; + + if ((str =3D virXPathString("string(./portOptions/@isolated)", ctxt)))= { + if ((tmp =3D virTristateBoolTypeFromString(str)) <=3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown port isolated value '%s'"), str); + return -1; + } + } + + *isolatedPort =3D tmp; + return 0; +} + + static int virNetworkPortGroupParseXML(virPortGroupDefPtr def, xmlNodePtr node, @@ -1725,6 +1745,9 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt, if (vlanNode && virNetDevVlanParse(vlanNode, ctxt, &def->vlan) < 0) goto error; =20 + if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0) + goto error; + /* Parse bridge information */ def->bridge =3D virXPathString("string(./bridge[1]/@name)", ctxt); def->bridgeZone =3D virXPathString("string(./bridge[1]/@zone)", ctxt); @@ -2331,6 +2354,14 @@ virNetworkIPDefFormat(virBufferPtr buf, return 0; } =20 +void +virNetworkPortOptionsFormat(virTristateBool isolatedPort, + virBufferPtr buf) +{ + if (isolatedPort !=3D VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(buf, "\n", + virTristateBoolTypeToString(isolatedPort)); +} =20 static int virPortGroupDefFormat(virBufferPtr buf, @@ -2608,6 +2639,7 @@ virNetworkDefFormatBuf(virBufferPtr buf, return -1; if (virNetDevBandwidthFormat(def->bandwidth, 0, buf) < 0) return -1; + virNetworkPortOptionsFormat(def->isolatedPort, buf); =20 for (i =3D 0; i < def->nips; i++) { if (virNetworkIPDefFormat(buf, &def->ips[i]) < 0) diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index d5dd8480db..db7243eef5 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -272,6 +272,7 @@ struct _virNetworkDef { virNetDevBandwidthPtr bandwidth; virNetDevVlan vlan; int trustGuestRxFilters; /* enum virTristateBool */ + virTristateBool isolatedPort; =20 /* Application-specific custom metadata */ xmlNodePtr metadata; @@ -377,6 +378,14 @@ virNetworkConfigFile(const char *dir, void virNetworkSetBridgeMacAddr(virNetworkDefPtr def); =20 +int +virNetworkPortOptionsParseXML(xmlXPathContextPtr ctxt, + virTristateBool *isolatedPort); + +void +virNetworkPortOptionsFormat(virTristateBool isolatedPort, + virBufferPtr buf); + VIR_ENUM_DECL(virNetworkForward); =20 #define VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE \ diff --git a/src/conf/virnetworkportdef.c b/src/conf/virnetworkportdef.c index 28a58ad8f8..a0705a8322 100644 --- a/src/conf/virnetworkportdef.c +++ b/src/conf/virnetworkportdef.c @@ -161,6 +161,8 @@ virNetworkPortDefParseXML(xmlXPathContextPtr ctxt) if (vlanNode && virNetDevVlanParse(vlanNode, ctxt, &def->vlan) < 0) return NULL; =20 + if (virNetworkPortOptionsParseXML(ctxt, &def->isolatedPort) < 0) + return NULL; =20 trustGuestRxFilters =3D virXPathString("string(./rxfilters/@trustGuest)", ctxt); @@ -360,6 +362,7 @@ virNetworkPortDefFormatBuf(virBufferPtr buf, virNetDevBandwidthFormat(def->bandwidth, def->class_id, buf); if (virNetDevVlanFormat(&def->vlan, buf) < 0) return -1; + virNetworkPortOptionsFormat(def->isolatedPort, buf); if (def->trustGuestRxFilters) virBufferAsprintf(buf, "\n", virTristateBoolTypeToString(def->trustGuestRxFil= ters)); diff --git a/src/conf/virnetworkportdef.h b/src/conf/virnetworkportdef.h index f5ba337fc9..78cf2c1ba4 100644 --- a/src/conf/virnetworkportdef.h +++ b/src/conf/virnetworkportdef.h @@ -60,6 +60,7 @@ struct _virNetworkPortDef { unsigned int class_id; /* class ID for bandwidth 'floor' */ virNetDevVlan vlan; int trustGuestRxFilters; /* enum virTristateBool */ + virTristateBool isolatedPort; =20 int plugtype; /* virNetworkPortPlugType */ union { diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5d043041e0..8f3312d0df 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -513,6 +513,7 @@ virDomainNetGetActualBridgeName; virDomainNetGetActualDirectDev; virDomainNetGetActualDirectMode; virDomainNetGetActualHostdev; +virDomainNetGetActualPortOptionsIsolated; virDomainNetGetActualTrustGuestRxFilters; virDomainNetGetActualType; virDomainNetGetActualVirtPortProfile; diff --git a/tests/networkxml2xmlin/isolated-ports.xml b/tests/networkxml2x= mlin/isolated-ports.xml new file mode 100644 index 0000000000..be21f155b2 --- /dev/null +++ b/tests/networkxml2xmlin/isolated-ports.xml @@ -0,0 +1,7 @@ + + port-isolation-test + 81ff0d90-c91e-6742-64da-4a736edb9a9b + + + + diff --git a/tests/networkxml2xmlout/isolated-ports.xml b/tests/networkxml2= xmlout/isolated-ports.xml new file mode 100644 index 0000000000..eed4461574 --- /dev/null +++ b/tests/networkxml2xmlout/isolated-ports.xml @@ -0,0 +1,7 @@ + + port-isolation-test + 81ff0d90-c91e-6742-64da-4a736edb9a9b + + + + diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index f784b90c69..ec679e72ee 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -160,6 +160,7 @@ mymain(void) DO_TEST("metadata"); DO_TEST("set-mtu"); DO_TEST("dnsmasq-options"); + DO_TEST("isolated-ports"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } diff --git a/tests/qemuxml2argvdata/net-isolated-port.xml b/tests/qemuxml2a= rgvdata/net-isolated-port.xml new file mode 100644 index 0000000000..1d53c0cd6b --- /dev/null +++ b/tests/qemuxml2argvdata/net-isolated-port.xml @@ -0,0 +1,34 @@ + + q35-test + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + +
+ + + + + + + + + + + + diff --git a/tests/qemuxml2xmloutdata/net-isolated-port.x86_64-latest.xml b= /tests/qemuxml2xmloutdata/net-isolated-port.x86_64-latest.xml new file mode 100644 index 0000000000..0605d36a87 --- /dev/null +++ b/tests/qemuxml2xmloutdata/net-isolated-port.x86_64-latest.xml @@ -0,0 +1,63 @@ + + q35-test + 11dbdcdd-4c3b-482b-8903-9bdb8c0a2774 + 2097152 + 2097152 + 2 + + hvm + + + + qemu64 + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + + + +
+ + + +