]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
docs,rng: Adjust storage pool name grammar checks
authorJohn Ferlan <jferlan@redhat.com>
Tue, 3 Oct 2017 11:14:04 +0000 (07:14 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 5 Oct 2017 12:10:46 +0000 (08:10 -0400)
https://bugzilla.redhat.com/show_bug.cgi?id=1475250

It's possible to define and start a pool with a '.' in the
name; however, when trying to add a volume to a domain using
the storage pool source with a '.' in the storage pool name,
the domain RNG validation fails because RNG uses 'genericName'
which does not allow a '.' in the name.

Domain XML def parsing has a virXMLValidateAgainstSchema which
generates the error. The Storage Pool XML def parsing has no
call to virXMLValidateAgainstSchema. The only Storage Pool name
validation occurs in virStoragePoolDefParseXML to ensure the
name doesn't have a '/' in it and in storagePoolDefineXML to
call virXMLCheckIllegalChars using the same parameter "\n" as
qemuDomainDefineXMLFlags would check after the RNG check
could be succesful.

In order to resolve this, create a poolName definition in
storagecommon.rng that will mimic the domain name regex that
disallows a newline character, but add the "/" in the exclude
list. Then modify the pool and volume source name definitions
to key off that poolName.

docs/schemas/domaincommon.rng
docs/schemas/storagecommon.rng
docs/schemas/storagepool.rng

index 66b3d70c66ba61d714599c9872f7892778fb1f04..4dbda6932da84268d7cc1f0f14d0b463c073c419 100644 (file)
     <optional>
       <element name="source">
         <attribute name="pool">
-          <ref name="genericName"/>
+          <ref name="poolName"/>
         </attribute>
         <attribute name="volume">
           <ref name="volName"/>
index 717f3c603ae1b70768221c0e2a510c7133a1345c..edee1b08455a9e6c45e826f1b2ecf74012b76cf1 100644 (file)
@@ -6,6 +6,14 @@
   <!-- This schema is not designed for standalone use; another file
        must include both this file and basictypes.rng -->
 
+  <define name="poolName">
+    <data type="string">
+      <!-- Use literal newline instead of \n for bug in libxml2 2.7.6 -->
+      <param name="pattern">[^/
+]+</param>
+    </data>
+  </define>
+
   <define name='encryption'>
     <element name='encryption'>
       <attribute name='format'>
index f0117bd69fb76b2857fab7428c35dae214f328d8..52b2044bef0fa0ee001cd7b63298e4e2ad8d1530 100644 (file)
     <interleave>
       <optional>
         <element name='name'>
-          <ref name='genericName'/>
+          <ref name='poolName'/>
         </element>
       </optional>
       <optional>
   <define name='commonmetadata'>
     <interleave>
       <element name='name'>
-        <ref name='genericName'/>
+        <ref name='poolName'/>
       </element>
       <optional>
         <element name='uuid'>