c401cc
From 20030393a5302c5bf7a003d0005fddaedb8bfbe9 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <20030393a5302c5bf7a003d0005fddaedb8bfbe9@dist-git>
c401cc
From: Eric Blake <eblake@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:54:14 +0100
c401cc
Subject: [PATCH] storage: fix RNG validation of gluster via netfs
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
While trying to compare netfs against my new gluster pool, I
c401cc
discovered two things:
c401cc
c401cc
virt-xml-validate chokes on valid xml produced by 'virsh pool-dumpxml'
c401cc
[yet another reason that ALL patches that add new xml should be adding
c401cc
corresponding tests]
c401cc
c401cc
When using glusterfs FUSE mounts, you cannot access a subdirectory
c401cc
of a gluster volume.  The recommended workaround in the gluster
c401cc
community is to mount the volume to an intermediate location, then
c401cc
bind-mount the desired subdirectory to the final location.  Maybe
c401cc
we should teach libvirt to do bind-mounting, but for now I chose to
c401cc
just document the limitation.
c401cc
c401cc
* docs/storage.html.in: Improve documentation.
c401cc
* docs/schemas/storagepool.rng (sourcefmtnetfs): Allow all
c401cc
formats, and drop redundant info-vendor.
c401cc
* tests/storagepoolxml2xmltest.c (mymain): New test.
c401cc
* tests/storagepoolxml2xmlin/pool-netfs-gluster.xml: New file.
c401cc
* tests/storagepoolxml2xmlout/pool-netfs-gluster.xml: Likewise.
c401cc
c401cc
Signed-off-by: Eric Blake <eblake@redhat.com>
c401cc
c401cc
(cherry picked from commit 887dd3625b71e6d71aa362a46cf6075b13cb1bb5)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 docs/schemas/storagepool.rng                       |  5 ++---
c401cc
 docs/storage.html.in                               | 11 ++++++++---
c401cc
 tests/storagepoolxml2xmlin/pool-netfs-gluster.xml  | 12 ++++++++++++
c401cc
 tests/storagepoolxml2xmlout/pool-netfs-gluster.xml | 20 ++++++++++++++++++++
c401cc
 tests/storagepoolxml2xmltest.c                     |  1 +
c401cc
 5 files changed, 43 insertions(+), 6 deletions(-)
c401cc
 create mode 100644 tests/storagepoolxml2xmlin/pool-netfs-gluster.xml
c401cc
 create mode 100644 tests/storagepoolxml2xmlout/pool-netfs-gluster.xml
c401cc
c401cc
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
c401cc
index a4ef5af..72c4fd6 100644
c401cc
--- a/docs/schemas/storagepool.rng
c401cc
+++ b/docs/schemas/storagepool.rng
c401cc
@@ -349,11 +349,10 @@
c401cc
           <choice>
c401cc
             <value>auto</value>
c401cc
             <value>nfs</value>
c401cc
+            <value>cifs</value>
c401cc
+            <value>glusterfs</value>
c401cc
           </choice>
c401cc
         </attribute>
c401cc
-        <optional>
c401cc
-          <ref name='sourceinfovendor'/>
c401cc
-        </optional>
c401cc
       </element>
c401cc
     </optional>
c401cc
   </define>
c401cc
diff --git a/docs/storage.html.in b/docs/storage.html.in
c401cc
index 1181444..0464565 100644
c401cc
--- a/docs/storage.html.in
c401cc
+++ b/docs/storage.html.in
c401cc
@@ -249,7 +249,8 @@
c401cc
       a local block device as the source, it requires the name of a
c401cc
       host and path of an exported directory. It will mount this network
c401cc
       filesystem and manage files within the directory of its mount
c401cc
-      point. It will default to using NFS as the protocol.
c401cc
+      point. It will default to using auto as the
c401cc
+      protocol, which generally tries a mount via NFS first.
c401cc
     

c401cc
 
c401cc
     

Example pool input

c401cc
@@ -259,6 +260,7 @@
c401cc
         <source>
c401cc
           <host name="nfs.example.com"/>
c401cc
           <dir path="/var/lib/virt/images"/>
c401cc
+          <format type='nfs'/>
c401cc
         </source>
c401cc
         <target>
c401cc
           <path>/var/lib/virt/images</path>
c401cc
@@ -275,10 +277,13 @@
c401cc
         nfs
c401cc
       
c401cc
       
  • c401cc
    -        glusterfs
    c401cc
    +        glusterfs - use the glusterfs FUSE file system.
    c401cc
    +        For now, the dir specified as the source can only
    c401cc
    +        be a gluster volume name, as gluster does not provide a way to
    c401cc
    +        directly mount subdirectories within a volume.
    c401cc
           
    c401cc
           
  • c401cc
    -        cifs
    c401cc
    +        cifs - use the SMB (samba) or CIFS file system
    c401cc
           
    c401cc
         
    c401cc
     
    c401cc
    diff --git a/tests/storagepoolxml2xmlin/pool-netfs-gluster.xml b/tests/storagepoolxml2xmlin/pool-netfs-gluster.xml
    c401cc
    new file mode 100644
    c401cc
    index 0000000..9b39e87
    c401cc
    --- /dev/null
    c401cc
    +++ b/tests/storagepoolxml2xmlin/pool-netfs-gluster.xml
    c401cc
    @@ -0,0 +1,12 @@
    c401cc
    +<pool type='netfs'>
    c401cc
    +  <source>
    c401cc
    +    <host name='example.com'/>
    c401cc
    +    <format type='glusterfs'/>
    c401cc
    +    <dir path='/volume'/>
    c401cc
    +  </source>
    c401cc
    +  <name>netfs-gluster</name>
    c401cc
    +  <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid>
    c401cc
    +  <target>
    c401cc
    +    <path>/mnt/gluster</path>
    c401cc
    +  </target>
    c401cc
    +</pool>
    c401cc
    diff --git a/tests/storagepoolxml2xmlout/pool-netfs-gluster.xml b/tests/storagepoolxml2xmlout/pool-netfs-gluster.xml
    c401cc
    new file mode 100644
    c401cc
    index 0000000..bab2a15
    c401cc
    --- /dev/null
    c401cc
    +++ b/tests/storagepoolxml2xmlout/pool-netfs-gluster.xml
    c401cc
    @@ -0,0 +1,20 @@
    c401cc
    +<pool type='netfs'>
    c401cc
    +  <name>netfs-gluster</name>
    c401cc
    +  <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid>
    c401cc
    +  <capacity unit='bytes'>0</capacity>
    c401cc
    +  <allocation unit='bytes'>0</allocation>
    c401cc
    +  <available unit='bytes'>0</available>
    c401cc
    +  <source>
    c401cc
    +    <host name='example.com'/>
    c401cc
    +    <dir path='/volume'/>
    c401cc
    +    <format type='glusterfs'/>
    c401cc
    +  </source>
    c401cc
    +  <target>
    c401cc
    +    <path>/mnt/gluster</path>
    c401cc
    +    <permissions>
    c401cc
    +      <mode>0755</mode>
    c401cc
    +      <owner>-1</owner>
    c401cc
    +      <group>-1</group>
    c401cc
    +    </permissions>
    c401cc
    +  </target>
    c401cc
    +</pool>
    c401cc
    diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
    c401cc
    index d59cff9..8e4ea42 100644
    c401cc
    --- a/tests/storagepoolxml2xmltest.c
    c401cc
    +++ b/tests/storagepoolxml2xmltest.c
    c401cc
    @@ -93,6 +93,7 @@ mymain(void)
    c401cc
         DO_TEST("pool-iscsi");
    c401cc
         DO_TEST("pool-iscsi-auth");
    c401cc
         DO_TEST("pool-netfs");
    c401cc
    +    DO_TEST("pool-netfs-gluster");
    c401cc
         DO_TEST("pool-scsi");
    c401cc
         DO_TEST("pool-scsi-type-scsi-host");
    c401cc
         DO_TEST("pool-scsi-type-fc-host");
    c401cc
    -- 
    c401cc
    1.9.0
    c401cc