]> xenbits.xensource.com Git - libvirt.git/commitdiff
storage: fix RNG validation of gluster via netfs
authorEric Blake <eblake@redhat.com>
Tue, 12 Nov 2013 23:35:36 +0000 (16:35 -0700)
committerEric Blake <eblake@redhat.com>
Wed, 13 Nov 2013 19:10:00 +0000 (12:10 -0700)
While trying to compare netfs against my new gluster pool, I
discovered two things:

virt-xml-validate chokes on valid xml produced by 'virsh pool-dumpxml'
[yet another reason that ALL patches that add new xml should be adding
corresponding tests]

When using glusterfs FUSE mounts, you cannot access a subdirectory
of a gluster volume.  The recommended workaround in the gluster
community is to mount the volume to an intermediate location, then
bind-mount the desired subdirectory to the final location.  Maybe
we should teach libvirt to do bind-mounting, but for now I chose to
just document the limitation.

* docs/storage.html.in: Improve documentation.
* docs/schemas/storagepool.rng (sourcefmtnetfs): Allow all
formats, and drop redundant info-vendor.
* tests/storagepoolxml2xmltest.c (mymain): New test.
* tests/storagepoolxml2xmlin/pool-netfs-gluster.xml: New file.
* tests/storagepoolxml2xmlout/pool-netfs-gluster.xml: Likewise.

Signed-off-by: Eric Blake <eblake@redhat.com>
docs/schemas/storagepool.rng
docs/storage.html.in
tests/storagepoolxml2xmlin/pool-netfs-gluster.xml [new file with mode: 0644]
tests/storagepoolxml2xmlout/pool-netfs-gluster.xml [new file with mode: 0644]
tests/storagepoolxml2xmltest.c

index 66d3c2216990e5bfb94abe620ab46ed346da281b..61fa7a3eb3dbfa3b61394ccef7dc1e72ab9a32da 100644 (file)
           <choice>
             <value>auto</value>
             <value>nfs</value>
+            <value>cifs</value>
+            <value>glusterfs</value>
           </choice>
         </attribute>
-        <optional>
-          <ref name='sourceinfovendor'/>
-        </optional>
       </element>
     </optional>
   </define>
index 118144477c44d22fe21d149378d77f4241489a5a..0464565adb54b5477092773c287ad32deeec8c96 100644 (file)
       a local block device as the source, it requires the name of a
       host and path of an exported directory. It will mount this network
       filesystem and manage files within the directory of its mount
-      point. It will default to using NFS as the protocol.
+      point. It will default to using <code>auto</code> as the
+      protocol, which generally tries a mount via NFS first.
     </p>
 
     <h3>Example pool input</h3>
         &lt;source&gt;
           &lt;host name="nfs.example.com"/&gt;
           &lt;dir path="/var/lib/virt/images"/&gt;
+          &lt;format type='nfs'/&gt;
         &lt;/source&gt;
         &lt;target&gt;
           &lt;path&gt;/var/lib/virt/images&lt;/path&gt;
         <code>nfs</code>
       </li>
       <li>
-        <code>glusterfs</code>
+        <code>glusterfs</code> - use the glusterfs FUSE file system.
+        For now, the <code>dir</code> specified as the source can only
+        be a gluster volume name, as gluster does not provide a way to
+        directly mount subdirectories within a volume.
       </li>
       <li>
-        <code>cifs</code>
+        <code>cifs</code> - use the SMB (samba) or CIFS file system
       </li>
     </ul>
 
diff --git a/tests/storagepoolxml2xmlin/pool-netfs-gluster.xml b/tests/storagepoolxml2xmlin/pool-netfs-gluster.xml
new file mode 100644 (file)
index 0000000..9b39e87
--- /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>
diff --git a/tests/storagepoolxml2xmlout/pool-netfs-gluster.xml b/tests/storagepoolxml2xmlout/pool-netfs-gluster.xml
new file mode 100644 (file)
index 0000000..bab2a15
--- /dev/null
@@ -0,0 +1,20 @@
+<pool type='netfs'>
+  <name>netfs-gluster</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='/volume'/>
+    <format type='glusterfs'/>
+  </source>
+  <target>
+    <path>/mnt/gluster</path>
+    <permissions>
+      <mode>0755</mode>
+      <owner>-1</owner>
+      <group>-1</group>
+    </permissions>
+  </target>
+</pool>
index 0ae9b298f10edb3938016096c8f16029811ae379..743e1cb86d84fb7c76d4c4c3ab49a144789e4c45 100644 (file)
@@ -93,6 +93,7 @@ mymain(void)
     DO_TEST("pool-iscsi");
     DO_TEST("pool-iscsi-auth");
     DO_TEST("pool-netfs");
+    DO_TEST("pool-netfs-gluster");
     DO_TEST("pool-scsi");
     DO_TEST("pool-scsi-type-scsi-host");
     DO_TEST("pool-scsi-type-fc-host");