From nobody Tue May 13 20:21:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1534230090845568.0044059778712; Tue, 14 Aug 2018 00:01:30 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 77C28317C3F7; Tue, 14 Aug 2018 07:01:28 +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 305CA10694D7; Tue, 14 Aug 2018 07:01:28 +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 AB2384A464; Tue, 14 Aug 2018 07:01:27 +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 w7E71KeW005314 for ; Tue, 14 Aug 2018 03:01:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id F35085D761; Tue, 14 Aug 2018 07:01:19 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E914B5D750 for ; Tue, 14 Aug 2018 07:01:16 +0000 (UTC) Received: from mout-xforward.gmx.net (mout-xforward.gmx.net [82.165.159.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 809C9307D853 for ; Tue, 14 Aug 2018 07:01:13 +0000 (UTC) Received: from localhost.localdomain ([58.56.27.130]) by mail.gmx.com (mrgmx101 [212.227.17.174]) with ESMTPSA (Nemesis) id 0MaW7Z-1faGvX09sH-00K5qb; Tue, 14 Aug 2018 09:01:11 +0200 From: Shi Lei To: libvir-list@redhat.com Date: Tue, 14 Aug 2018 15:00:52 +0800 Message-Id: <1534230052-10359-4-git-send-email-shilei.massclouds@gmx.com> In-Reply-To: <1534230052-10359-1-git-send-email-shilei.massclouds@gmx.com> References: <1534230052-10359-1-git-send-email-shilei.massclouds@gmx.com> X-Provags-ID: V03:K1:JSO91F3qWhbGXB/pn0TSwo7KgobW0GeeE17s4186kru32WSRtcD tHfJtB2Eg1d4x2E7NeR9Ftkg7NaUDj7+aRSAoc3Ig++IhGzF1SJguIueFzuvFw4pAbmMvS2 tdiXQuqciea/EXO0mM04EpP/59tJE4jEx7hVQhAHyLKS/rmtP5g3KczVWqb4mpmFJPHXotG tj07mfR3r5SNFmn2mq68w== X-UI-Out-Filterresults: junk:10;V01:K0:k9zkAjajNBg=:a6dhiAfmShPc1kzkcUSC/cS/ iCbJ4rCZZoFpXqliHbiWwriWdrg96ClAv3h7XEXYDviQgaalA08TsYE0aBHxmV6lTIa7WTW7w wbkyOm6O9uGmwa+oTUscBHcM4obQkphsrt0mO10jtfmoKPfpCr1EGT9NTJgEQ2RkksP/w38zy zpnjMZk2AU0PSPs68mXKX3vQBFwVLykHNEwmIQGWuj6B+XryVos5N9DC8wzTkkHpYGwr0nDK+ FOstWwqGRRO18zVR6wuDoereFWtIzjiSnM5mwFrMK3Mxd16SK/HEERBQpvrJz0uawG+BjjtRq OE/jP8u4dYB6KvhGumrTt2jhIZh7UBTAUWHRL6ix6+8REcXgbO/8LY6gZ5xL3hgcdU7fsTJm1 lEykThdxHTFjVLlh0TBx4cXHotqp1aaTFpED/Vc6ZBui+fX9lVnfCODV3atmcXLqV73bEsL0R syga1wK0dtshdQcto6IY9i7iX/4wklKls3HyFJ7jHyUMrfssxuDn34/0iZ1mFS8JUO1og9lLB uFnx9c+udnrkrZkBHx0ry/Z0e1U+zXWEaswqarDQK8Y1hgEsGwoirH5rjrki8g/4yyscqh/bp SUEC4Lu1CMB2Oyf80z6oZ6nHqo7X+s9AXZTTQ6sjHkOz5fmDCwLrVVE/n8oNEv6HEOGIifFyf 96J59MISezVsx+uWTEEbtQ3ySEas5WuRL38FMNOpwdvICbpXcSaBntHJ6lhxAASFndKrMpVhL kMJJswuYGkJZK180PQXTYoAh/OrwOxA+cl0g1olgNAQ5wd1ZYuT/CNcKw/Q8tOiXzL6MJ1WCG 8hp/1NHqj9Rpkfka2l/zOgsytYoxvBeJvvj6FPGeVxvo3LopFB0YZ2KbtjszsZI1w+TkzuIaS jMSA9xk7iQbdUstT/yGwdeRQ4gy0LAZHmtcRU7BcnSv80J0Mj9iD63iOF9zT X-Greylist: Sender passed SPF test, ACL 232 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 14 Aug 2018 07:01:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 14 Aug 2018 07:01:14 +0000 (UTC) for IP:'82.165.159.41' DOMAIN:'mout-xforward.gmx.net' HELO:'mout-xforward.gmx.net' FROM:'shilei.massclouds@gmx.com' RCPT:'' X-RedHat-Spam-Score: 0 (FREEMAIL_FROM, SPF_PASS) 82.165.159.41 mout-xforward.gmx.net 82.165.159.41 mout-xforward.gmx.net X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Shi Lei Subject: [libvirt] [PATCHv2 3/3] tests and docs for new forward mode 'vlan' 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 14 Aug 2018 07:01:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Shi Lei --- docs/formatnetwork.html.in | 27 ++++++++++++++++++= +++- docs/schemas/network.rng | 1 + tests/networkxml2confdata/vlan-network.conf | 16 +++++++++++++ tests/networkxml2confdata/vlan-network.xml | 13 +++++++++++ tests/networkxml2conftest.c | 1 + .../vlan-network-multi-vlan-tag.xml | 11 +++++++++ .../vlan-network-no-forward-dev.xml | 10 ++++++++ tests/networkxml2xmlin/vlan-network-with-dhcp.xml | 15 ++++++++++++ tests/networkxml2xmlin/vlan-network.xml | 10 ++++++++ tests/networkxml2xmlout/vlan-network-with-dhcp.xml | 17 ++++++++++++++ tests/networkxml2xmlout/vlan-network.xml | 12 ++++++++++ tests/networkxml2xmltest.c | 5 ++++ 12 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 tests/networkxml2confdata/vlan-network.conf create mode 100644 tests/networkxml2confdata/vlan-network.xml create mode 100644 tests/networkxml2xmlin/vlan-network-multi-vlan-tag.xml create mode 100644 tests/networkxml2xmlin/vlan-network-no-forward-dev.xml create mode 100644 tests/networkxml2xmlin/vlan-network-with-dhcp.xml create mode 100644 tests/networkxml2xmlin/vlan-network.xml create mode 100644 tests/networkxml2xmlout/vlan-network-with-dhcp.xml create mode 100644 tests/networkxml2xmlout/vlan-network.xml diff --git a/docs/formatnetwork.html.in b/docs/formatnetwork.html.in index 363a72b..294256c 100644 --- a/docs/formatnetwork.html.in +++ b/docs/formatnetwork.html.in @@ -156,7 +156,7 @@ =20
mtu
- The size attribute of the mtu> + The size attribute of the mtu element specifies the Maximum Transmission Unit (MTU) for the network. Since 3.1.0. In the case of a libvirt-managed network (one with forward mode @@ -299,6 +299,31 @@ Since 2.2.0
=20 +
vlan
+
+ All guests linked to this network will belong to a VLan. + Guests communicate with each other directly and communicate + with outside network via this network. Egress traffic from + this network will be tagged transparently by the VLan-Tag; + ingress traffic will be untagged and transport into this + network only if traffic has the same VLan-Tag, or be dropped. + The dev attribute must be set to specify the + host's interface which forwards traffice between this network + and outside. The vlan element and its tag + element must be one and only, and the id attribute + specifies the tag of this VLan. The bridge element + can be ignored since it is a internal bridge. This network + supports ip and dhcp. + Since 4.7.0 +
+...
+  <forward mode=3D'vlan' dev=3D'eth1'/>
+  <vlan>
+    <tag id=3D"20"/>
+  </vlan>
+...
+
+
bridge
This network describes either 1) an existing host bridge diff --git a/docs/schemas/network.rng b/docs/schemas/network.rng index f37c422..046f6dd 100644 --- a/docs/schemas/network.rng +++ b/docs/schemas/network.rng @@ -114,6 +114,7 @@ private vepa hostdev + vlan diff --git a/tests/networkxml2confdata/vlan-network.conf b/tests/networkxml= 2confdata/vlan-network.conf new file mode 100644 index 0000000..5d1d091 --- /dev/null +++ b/tests/networkxml2confdata/vlan-network.conf @@ -0,0 +1,16 @@ +##WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE +##OVERWRITTEN AND LOST. Changes to this configuration should be made usin= g: +## virsh net-edit vlanB +## or other application using the libvirt API. +## +## dnsmasq conf file created by libvirt +strict-order +except-interface=3Dlo +bind-dynamic +interface=3Dvirbr1 +dhcp-range=3D192.168.126.60,192.168.126.69 +dhcp-no-override +dhcp-authoritative +dhcp-lease-max=3D10 +dhcp-hostsfile=3D/var/lib/libvirt/dnsmasq/vlanB.hostsfile +addn-hosts=3D/var/lib/libvirt/dnsmasq/vlanB.addnhosts diff --git a/tests/networkxml2confdata/vlan-network.xml b/tests/networkxml2= confdata/vlan-network.xml new file mode 100644 index 0000000..0faa7bb --- /dev/null +++ b/tests/networkxml2confdata/vlan-network.xml @@ -0,0 +1,13 @@ + + vlanB + + + + + + + + + + + diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c index 8e7751e..d106c6a 100644 --- a/tests/networkxml2conftest.c +++ b/tests/networkxml2conftest.c @@ -144,6 +144,7 @@ mymain(void) DO_TEST("dhcp6-nat-network", dhcpv6); DO_TEST("dhcp6host-routed-network", dhcpv6); DO_TEST("ptr-domains-auto", dhcpv6); + DO_TEST("vlan-network", full); =20 virObjectUnref(dhcpv6); virObjectUnref(full); diff --git a/tests/networkxml2xmlin/vlan-network-multi-vlan-tag.xml b/tests= /networkxml2xmlin/vlan-network-multi-vlan-tag.xml new file mode 100644 index 0000000..328e9a4 --- /dev/null +++ b/tests/networkxml2xmlin/vlan-network-multi-vlan-tag.xml @@ -0,0 +1,11 @@ + + vlanB + d29b765a-896c-450c-b94a-1b6b21c340db + + + + + + + + diff --git a/tests/networkxml2xmlin/vlan-network-no-forward-dev.xml b/tests= /networkxml2xmlin/vlan-network-no-forward-dev.xml new file mode 100644 index 0000000..c8384cf --- /dev/null +++ b/tests/networkxml2xmlin/vlan-network-no-forward-dev.xml @@ -0,0 +1,10 @@ + + vlanB + d29b765a-896c-450c-b94a-1b6b21c340db + + + + + + + diff --git a/tests/networkxml2xmlin/vlan-network-with-dhcp.xml b/tests/netw= orkxml2xmlin/vlan-network-with-dhcp.xml new file mode 100644 index 0000000..e51eaeb --- /dev/null +++ b/tests/networkxml2xmlin/vlan-network-with-dhcp.xml @@ -0,0 +1,15 @@ + + vlanB + d29b765a-896c-450c-b94a-1b6b21c340db + + + + + + + + + + + + diff --git a/tests/networkxml2xmlin/vlan-network.xml b/tests/networkxml2xml= in/vlan-network.xml new file mode 100644 index 0000000..3bf075a --- /dev/null +++ b/tests/networkxml2xmlin/vlan-network.xml @@ -0,0 +1,10 @@ + + vlanB + d29b765a-896c-450c-b94a-1b6b21c340db + + + + + + + diff --git a/tests/networkxml2xmlout/vlan-network-with-dhcp.xml b/tests/net= workxml2xmlout/vlan-network-with-dhcp.xml new file mode 100644 index 0000000..58ab96d --- /dev/null +++ b/tests/networkxml2xmlout/vlan-network-with-dhcp.xml @@ -0,0 +1,17 @@ + + vlanB + d29b765a-896c-450c-b94a-1b6b21c340db + + + + + + + + + + + + + + diff --git a/tests/networkxml2xmlout/vlan-network.xml b/tests/networkxml2xm= lout/vlan-network.xml new file mode 100644 index 0000000..e19ce49 --- /dev/null +++ b/tests/networkxml2xmlout/vlan-network.xml @@ -0,0 +1,12 @@ + + vlanB + d29b765a-896c-450c-b94a-1b6b21c340db + + + + + + + + + diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index eb7db76..72957c7 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -44,6 +44,7 @@ testCompareXMLToXMLFiles(const char *inxml, const char *o= utxml, result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FORMAT; goto cleanup; } + if (expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FORMAT) goto cleanup; =20 @@ -160,6 +161,10 @@ mymain(void) DO_TEST_PARSE_ERROR("passthrough-duplicate"); DO_TEST("metadata"); DO_TEST("set-mtu"); + DO_TEST("vlan-network"); + DO_TEST("vlan-network-with-dhcp"); + DO_TEST_PARSE_ERROR("vlan-network-no-forward-dev"); + DO_TEST_PARSE_ERROR("vlan-network-multi-vlan-tag"); =20 return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE; } --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list