[libvirt] [PATCH] docs, rng: Allow a pool name to be line domain name

John Ferlan jferlan at redhat.com
Wed Sep 27 19:07:35 UTC 2017


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 name with a '.' in the name,
the domain RNG validation fails because RNG uses 'genericName'
which does not allow a '.' in the name. Pool definition has
no similar call to virXMLValidateAgainstSchema. Pool name
validation occurs in storagePoolDefineXML and only calls
virXMLCheckIllegalChars using the same parameter "\n" as
qemuDomainDefineXMLFlags would check after the RNG check
could be succesful.

So in order to resolve this, create a poolName definition
in the RNG and allow the pool name and the volume source
pool name to use that definition.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 docs/schemas/domaincommon.rng  | 2 +-
 docs/schemas/storagecommon.rng | 8 ++++++++
 docs/schemas/storagepool.rng   | 4 ++--
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 76852abb3..2cc8dcecf 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1669,7 +1669,7 @@
     <optional>
       <element name="source">
         <attribute name="pool">
-          <ref name="genericName"/>
+          <ref name="poolName"/>
         </attribute>
         <attribute name="volume">
           <ref name="volName"/>
diff --git a/docs/schemas/storagecommon.rng b/docs/schemas/storagecommon.rng
index 717f3c603..49578312e 100644
--- a/docs/schemas/storagecommon.rng
+++ b/docs/schemas/storagecommon.rng
@@ -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'>
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index f0117bd69..52b2044be 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -209,7 +209,7 @@
     <interleave>
       <optional>
         <element name='name'>
-          <ref name='genericName'/>
+          <ref name='poolName'/>
         </element>
       </optional>
       <optional>
@@ -223,7 +223,7 @@
   <define name='commonmetadata'>
     <interleave>
       <element name='name'>
-        <ref name='genericName'/>
+        <ref name='poolName'/>
       </element>
       <optional>
         <element name='uuid'>
-- 
2.13.5




More information about the libvir-list mailing list