[PATCH 1/2] schema: require target path in storage pool xml

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]