[libvirt] [PATCH 0/2] Fix storage schema issues

Fix https://bugzilla.redhat.com/show_bug.cgi?id=893273 Ján Tomko (2): schema: require target path in storage pool xml schema: make source optional in volume XML docs/schemas/storagepool.rng | 8 +++--- docs/schemas/storagevol.rng | 4 ++- tests/Makefile.am | 2 ++ .../dir-missing-target-path-invalid.xml | 12 +++++++++ tests/storagepoolschematest | 2 +- tests/storagevolschemadata/qcow2-no-source.xml | 29 ++++++++++++++++++++++ tests/storagevolschematest | 2 +- 7 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 tests/storagepoolschemadata/dir-missing-target-path-invalid.xml create mode 100644 tests/storagevolschemadata/qcow2-no-source.xml -- 1.8.1.5

Make target path mandatory for pool types that require target, since we refuse to parse a target without a path. https://bugzilla.redhat.com/show_bug.cgi?id=893273 --- docs/schemas/storagepool.rng | 8 +++----- tests/Makefile.am | 1 + .../dir-missing-target-path-invalid.xml | 12 ++++++++++++ tests/storagepoolschematest | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 tests/storagepoolschemadata/dir-missing-target-path-invalid.xml diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng index eb56497..3c2158a 100644 --- a/docs/schemas/storagepool.rng +++ b/docs/schemas/storagepool.rng @@ -200,11 +200,9 @@ <define name='target'> <element name='target'> - <optional> - <element name='path'> - <ref name='absFilePath'/> - </element> - </optional> + <element name='path'> + <ref name='absFilePath'/> + </element> <ref name='permissions'/> </element> </define> diff --git a/tests/Makefile.am b/tests/Makefile.am index 41c4067..04b76ba 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -73,6 +73,7 @@ EXTRA_DIST = \ securityselinuxlabeldata \ schematestutils.sh \ sexpr2xmldata \ + storagepoolschemadata \ storagepoolschematest \ storagepoolxml2xmlin \ storagepoolxml2xmlout \ diff --git a/tests/storagepoolschemadata/dir-missing-target-path-invalid.xml b/tests/storagepoolschemadata/dir-missing-target-path-invalid.xml new file mode 100644 index 0000000..8536781 --- /dev/null +++ b/tests/storagepoolschemadata/dir-missing-target-path-invalid.xml @@ -0,0 +1,12 @@ +<pool type='dir'> + <name>test</name> + <source> + </source> + <target> + <permissions> + <mode>0700</mode> + <owner>-1</owner> + <group>-1</group> + </permissions> + </target> +</pool> diff --git a/tests/storagepoolschematest b/tests/storagepoolschematest index 9844c76..d54b827 100755 --- a/tests/storagepoolschematest +++ b/tests/storagepoolschematest @@ -4,7 +4,7 @@ . $srcdir/test-lib.sh . $abs_srcdir/schematestutils.sh -DIRS="storagepoolxml2xmlin storagepoolxml2xmlout" +DIRS="storagepoolxml2xmlin storagepoolxml2xmlout storagepoolschemadata" SCHEMA="storagepool.rng" check_schema "$DIRS" "$SCHEMA" -- 1.8.1.5

On 05/16/2013 08:39 AM, Ján Tomko wrote:
Make target path mandatory for pool types that require target, since we refuse to parse a target without a path.
https://bugzilla.redhat.com/show_bug.cgi?id=893273 --- docs/schemas/storagepool.rng | 8 +++----- tests/Makefile.am | 1 + .../dir-missing-target-path-invalid.xml | 12 ++++++++++++ tests/storagepoolschematest | 2 +- 4 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 tests/storagepoolschemadata/dir-missing-target-path-invalid.xml
ACK. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

We don't parse it anyway. https://bugzilla.redhat.com/show_bug.cgi?id=893273 --- docs/schemas/storagevol.rng | 4 +++- tests/Makefile.am | 3 ++- tests/storagevolschemadata/qcow2-no-source.xml | 29 ++++++++++++++++++++++++++ tests/storagevolschematest | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 tests/storagevolschemadata/qcow2-no-source.xml diff --git a/docs/schemas/storagevol.rng b/docs/schemas/storagevol.rng index ca8ce56..4649d91 100644 --- a/docs/schemas/storagevol.rng +++ b/docs/schemas/storagevol.rng @@ -20,7 +20,9 @@ <text/> </element> </optional> - <ref name='source'/> + <optional> + <ref name='source'/> + </optional> <ref name='sizing'/> <ref name='target'/> <optional> diff --git a/tests/Makefile.am b/tests/Makefile.am index 04b76ba..c3573a8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -73,11 +73,12 @@ EXTRA_DIST = \ securityselinuxlabeldata \ schematestutils.sh \ sexpr2xmldata \ - storagepoolschemadata \ storagepoolschematest \ + storagepoolschemadata \ storagepoolxml2xmlin \ storagepoolxml2xmlout \ storagevolxml2argvdata \ + storagevolschemadata \ storagevolschematest \ storagevolxml2xmlin \ storagevolxml2xmlout \ diff --git a/tests/storagevolschemadata/qcow2-no-source.xml b/tests/storagevolschemadata/qcow2-no-source.xml new file mode 100644 index 0000000..777294e --- /dev/null +++ b/tests/storagevolschemadata/qcow2-no-source.xml @@ -0,0 +1,29 @@ +<volume> + <name>OtherDemo.img</name> + <key>/var/lib/libvirt/images/OtherDemo.img</key> + <capacity unit="G">5</capacity> + <allocation>294912</allocation> + <target> + <path>/var/lib/libvirt/images/OtherDemo.img</path> + <format type='qcow2'/> + <permissions> + <mode>0644</mode> + <owner>0</owner> + <group>0</group> + <label>unconfined_u:object_r:virt_image_t:s0</label> + </permissions> + <encryption format='qcow'> + <secret type='passphrase' uuid='e78d4b51-a2af-485f-b0f5-afca709a80f4'/> + </encryption> + </target> + <backingStore> + <path>/dev/null</path> + <format type='raw'/> + <permissions> + <mode>0644</mode> + <owner>0</owner> + <group>0</group> + <label>unconfined_u:object_r:virt_image_t:s0</label> + </permissions> + </backingStore> +</volume> diff --git a/tests/storagevolschematest b/tests/storagevolschematest index e1afa8d..9045e6b 100755 --- a/tests/storagevolschematest +++ b/tests/storagevolschematest @@ -4,7 +4,7 @@ . $srcdir/test-lib.sh . $abs_srcdir/schematestutils.sh -DIRS="storagevolxml2xmlin storagevolxml2xmlout" +DIRS="storagevolxml2xmlin storagevolxml2xmlout storagevolschemadata" SCHEMA="storagevol.rng" check_schema "$DIRS" "$SCHEMA" -- 1.8.1.5

On 05/16/2013 08:39 AM, Ján Tomko wrote:
We don't parse it anyway.
https://bugzilla.redhat.com/show_bug.cgi?id=893273 --- docs/schemas/storagevol.rng | 4 +++- tests/Makefile.am | 3 ++- tests/storagevolschemadata/qcow2-no-source.xml | 29 ++++++++++++++++++++++++++ tests/storagevolschematest | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 tests/storagevolschemadata/qcow2-no-source.xml
+++ b/tests/Makefile.am @@ -73,11 +73,12 @@ EXTRA_DIST = \ securityselinuxlabeldata \ schematestutils.sh \ sexpr2xmldata \ - storagepoolschemadata \ storagepoolschematest \ + storagepoolschemadata \
Why the change to unsorted? ACK with that spurious change undone. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 05/16/2013 09:48 PM, Eric Blake wrote:
On 05/16/2013 08:39 AM, Ján Tomko wrote:
We don't parse it anyway.
https://bugzilla.redhat.com/show_bug.cgi?id=893273 --- docs/schemas/storagevol.rng | 4 +++- tests/Makefile.am | 3 ++- tests/storagevolschemadata/qcow2-no-source.xml | 29 ++++++++++++++++++++++++++ tests/storagevolschematest | 2 +- 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 tests/storagevolschemadata/qcow2-no-source.xml
+++ b/tests/Makefile.am @@ -73,11 +73,12 @@ EXTRA_DIST = \ securityselinuxlabeldata \ schematestutils.sh \ sexpr2xmldata \ - storagepoolschemadata \ storagepoolschematest \ + storagepoolschemadata \
Why the change to unsorted?
It's what I had in 1/2 originally and I didn't rebase 2/2 correctly after I fixed it.
ACK with that spurious change undone.
Thanks, I've undone it and pushed the series. Jan
participants (2)
-
Eric Blake
-
Ján Tomko