]> xenbits.xensource.com Git - libvirt.git/commitdiff
schema: pool: netfs: Don't enforce slash in glusterfs pool source
authorPeter Krempa <pkrempa@redhat.com>
Wed, 28 May 2014 13:47:38 +0000 (15:47 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 21 Jul 2014 16:28:17 +0000 (18:28 +0200)
Gluster volumes don't start with a leading slash. Our schema for netfs
gluster pools enforces it though. Luckily mount.glusterfs skips it.
Allow a slashless volume name for glusterfs netfs mounts in the schema.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1101999

docs/schemas/basictypes.rng
docs/schemas/storagepool.rng
tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml [new file with mode: 0644]

index 5fe3a97daeb5df370d5f3f781fd17a85dcaca0a2..6d357b73404aa6e54bc9b1875fdfbc2367cd36d4 100644 (file)
     </data>
   </define>
 
+  <define name="dirPath">
+    <data type="string">
+      <param name="pattern">[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%]+</param>
+    </data>
+  </define>
+
   <define name="absFilePath">
     <data type="string">
       <param name="pattern">/[a-zA-Z0-9_\.\+\-\\&amp;&quot;&apos;&lt;&gt;/%,]+</param>
index 8d7a94d6568aa0f9521363ad26c7cb98a4181221..b2d1473309c245dde05f691f2d4a5b2af657b034 100644 (file)
     </element>
   </define>
 
+  <define name='sourceinfonetfsgluster'>
+    <element name='dir'>
+      <attribute name='path'>
+        <ref name='dirPath'/>
+      </attribute>
+      <empty/>
+    </element>
+  </define>
+
   <define name='sourceinfoname'>
     <element name='name'>
       <text/>
             <value>auto</value>
             <value>nfs</value>
             <value>cifs</value>
-            <value>glusterfs</value>
           </choice>
         </attribute>
       </element>
 
   <define name='sourcenetfs'>
     <element name='source'>
-      <interleave>
-        <ref name='sourceinfohost'/>
-        <ref name='sourceinfodir'/>
-        <ref name='sourcefmtnetfs'/>
-        <optional>
-          <ref name='sourceinfovendor'/>
-        </optional>
-      </interleave>
+      <choice>
+        <group>
+          <interleave>
+            <ref name='sourceinfohost'/>
+            <ref name='sourceinfodir'/>
+            <ref name='sourcefmtnetfs'/>
+            <optional>
+                <ref name='sourceinfovendor'/>
+            </optional>
+          </interleave>
+        </group>
+        <group>
+          <interleave>
+            <ref name='sourceinfohost'/>
+            <ref name='sourceinfonetfsgluster'/>
+            <element name='format'>
+              <attribute name='type'>
+                <value>glusterfs</value>
+              </attribute>
+            </element>
+            <optional>
+                <ref name='sourceinfovendor'/>
+            </optional>
+          </interleave>
+        </group>
+      </choice>
     </element>
   </define>
 
diff --git a/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml b/tests/storagepoolxml2xmlin/pool-netfs-gluster-without-slash.xml
new file mode 100644 (file)
index 0000000..69a2c6d
--- /dev/null
@@ -0,0 +1,12 @@
+<pool type='netfs'>
+  <source>
+    <host name='example.com'/>
+    <format type='glusterfs'/>
+    <dir path='volume'/>
+  </source>
+  <name>netfs-gluster</name>
+  <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid>
+  <target>
+    <path>/mnt/gluster</path>
+  </target>
+</pool>