[libvirt] [PATCH] schema: allow a <rule> element with no subelements in a nwfilter

Laine Stump posted 1 patch 5 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180621061203.373789-1-laine@laine.org
Test syntax-check passed
docs/schemas/nwfilter.rng | 1 +
tests/virschematest.c     | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
[libvirt] [PATCH] schema: allow a <rule> element with no subelements in a nwfilter
Posted by Laine Stump 5 years, 9 months ago
This is a regression in behavior caused by commit 37359814. It was
intended to limit the schema to allow only a single subelement of
<rule>, but it is also acceptable for <rule> to have no subelement at
all.

To prevent the same error from reoccurring in the future, the
examples/xml/nwfilter directory was added to the list of nwfilter
schema test directories.

Resolves: https://bugzilla.redhat.com/1593549
Signed-off-by: Laine Stump <laine@laine.org>
---
 docs/schemas/nwfilter.rng | 1 +
 tests/virschematest.c     | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/docs/schemas/nwfilter.rng b/docs/schemas/nwfilter.rng
index cca6ff2954..17cda5c78d 100644
--- a/docs/schemas/nwfilter.rng
+++ b/docs/schemas/nwfilter.rng
@@ -20,6 +20,7 @@
           <element name="rule">
             <ref name="rule-node-attributes"/>
             <choice>
+                <empty/>
                 <element name="mac">
                   <ref name="match-attribute"/>
                   <ref name="common-l2-attributes"/>
diff --git a/tests/virschematest.c b/tests/virschematest.c
index 2d35833919..aa65a434ff 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -229,7 +229,7 @@ mymain(void)
     DO_TEST_DIR("network.rng", "../src/network", "networkxml2xmlin",
                 "networkxml2xmlout", "networkxml2confdata");
     DO_TEST_DIR("nodedev.rng", "nodedevschemadata");
-    DO_TEST_DIR("nwfilter.rng", "nwfilterxml2xmlout");
+    DO_TEST_DIR("nwfilter.rng", "nwfilterxml2xmlout", "../examples/xml/nwfilter");
     DO_TEST_DIR("secret.rng", "secretxml2xmlin");
     DO_TEST_DIR("storagepool.rng", "storagepoolxml2xmlin", "storagepoolxml2xmlout",
                 "storagepoolschemadata");
-- 
2.14.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] schema: allow a <rule> element with no subelements in a nwfilter
Posted by Michal Privoznik 5 years, 9 months ago
On 06/21/2018 08:12 AM, Laine Stump wrote:
> This is a regression in behavior caused by commit 37359814. It was
> intended to limit the schema to allow only a single subelement of
> <rule>, but it is also acceptable for <rule> to have no subelement at
> all.
> 
> To prevent the same error from reoccurring in the future, the
> examples/xml/nwfilter directory was added to the list of nwfilter
> schema test directories.
> 
> Resolves: https://bugzilla.redhat.com/1593549
> Signed-off-by: Laine Stump <laine@laine.org>
> ---
>  docs/schemas/nwfilter.rng | 1 +
>  tests/virschematest.c     | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list