[libvirt] [PATCH 1/2] storage: Fix the schema and add tests for cifs pool

John Ferlan jferlan at redhat.com
Wed Jun 3 17:06:57 UTC 2015


Commit id '887dd362' added support for a netfs pool format type 'cifs'
and 'gluster' in order to add rng support for Samba and glusterfs netfs
pools. Originally, the CIFS type support was added as part of commit
id '61fb6979'. Eventually commit id 'b325be12' fixed the gluster rng
definition to match expectations.

As it turns out the CIFS rng needed a similar change since the directory
path is not an absDirPath, rather just a dirPath will be required.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 docs/schemas/storagepool.rng                    | 24 +++++++++++++++++++++++-
 tests/storagepoolxml2xmlin/pool-netfs-cifs.xml  | 12 ++++++++++++
 tests/storagepoolxml2xmlout/pool-netfs-cifs.xml | 15 +++++++++++++++
 tests/storagepoolxml2xmltest.c                  |  1 +
 4 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-cifs.xml
 create mode 100644 tests/storagepoolxml2xmlout/pool-netfs-cifs.xml

diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
index db6ff49..d6bf772 100644
--- a/docs/schemas/storagepool.rng
+++ b/docs/schemas/storagepool.rng
@@ -314,6 +314,15 @@
     </element>
   </define>
 
+  <define name='sourceinfonetfscifs'>
+    <element name='dir'>
+      <attribute name='path'>
+        <ref name='dirPath'/>
+      </attribute>
+      <empty/>
+    </element>
+  </define>
+
   <define name='sourceinfonetfsgluster'>
     <element name='dir'>
       <attribute name='path'>
@@ -400,7 +409,6 @@
           <choice>
             <value>auto</value>
             <value>nfs</value>
-            <value>cifs</value>
           </choice>
         </attribute>
       </element>
@@ -488,6 +496,20 @@
         <group>
           <interleave>
             <ref name='sourceinfohost'/>
+            <ref name='sourceinfonetfscifs'/>
+            <element name='format'>
+              <attribute name='type'>
+                <value>cifs</value>
+              </attribute>
+            </element>
+            <optional>
+                <ref name='sourceinfovendor'/>
+            </optional>
+          </interleave>
+        </group>
+        <group>
+          <interleave>
+            <ref name='sourceinfohost'/>
             <ref name='sourceinfonetfsgluster'/>
             <element name='format'>
               <attribute name='type'>
diff --git a/tests/storagepoolxml2xmlin/pool-netfs-cifs.xml b/tests/storagepoolxml2xmlin/pool-netfs-cifs.xml
new file mode 100644
index 0000000..0bc6380
--- /dev/null
+++ b/tests/storagepoolxml2xmlin/pool-netfs-cifs.xml
@@ -0,0 +1,12 @@
+<pool type='netfs'>
+  <source>
+    <host name='example.com'/>
+    <format type='cifs'/>
+    <dir path='samba_share'/>
+  </source>
+  <name>netfs-cifs</name>
+  <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid>
+  <target>
+    <path>/mnt/cifs</path>
+  </target>
+</pool>
diff --git a/tests/storagepoolxml2xmlout/pool-netfs-cifs.xml b/tests/storagepoolxml2xmlout/pool-netfs-cifs.xml
new file mode 100644
index 0000000..afaa7d0
--- /dev/null
+++ b/tests/storagepoolxml2xmlout/pool-netfs-cifs.xml
@@ -0,0 +1,15 @@
+<pool type='netfs'>
+  <name>netfs-cifs</name>
+  <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid>
+  <capacity unit='bytes'>0</capacity>
+  <allocation unit='bytes'>0</allocation>
+  <available unit='bytes'>0</available>
+  <source>
+    <host name='example.com'/>
+    <dir path='samba_share'/>
+    <format type='cifs'/>
+  </source>
+  <target>
+    <path>/mnt/cifs</path>
+  </target>
+</pool>
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index bec1b8f..b03c4b0 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -84,6 +84,7 @@ mymain(void)
     DO_TEST("pool-iscsi-auth");
     DO_TEST("pool-netfs");
     DO_TEST("pool-netfs-gluster");
+    DO_TEST("pool-netfs-cifs");
     DO_TEST("pool-scsi");
     DO_TEST("pool-scsi-type-scsi-host");
     DO_TEST("pool-scsi-type-fc-host");
-- 
2.1.0




More information about the libvir-list mailing list