render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c401cc
From ab0ed8b667a8af400965bcc046b3d583831eaed5 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <ab0ed8b667a8af400965bcc046b3d583831eaed5@dist-git>
c401cc
From: Eric Blake <eblake@redhat.com>
c401cc
Date: Wed, 26 Feb 2014 14:54:22 +0100
c401cc
Subject: [PATCH] storage: document gluster pool
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1032370
c401cc
c401cc
Add support for a new <pool type='gluster'>, similar to
c401cc
RBD and Sheepdog.  Terminology wise, a gluster volume
c401cc
forms a libvirt storage pool, within the gluster volume,
c401cc
individual files are treated as libvirt storage volumes.
c401cc
c401cc
* docs/schemas/storagepool.rng (poolgluster): New pool type.
c401cc
* docs/formatstorage.html.in: Document gluster.
c401cc
* docs/storage.html.in: Likewise, and contrast it with netfs.
c401cc
* tests/storagepoolxml2xmlin/pool-gluster.xml: New test.
c401cc
* tests/storagepoolxml2xmlout/pool-gluster.xml: Likewise.
c401cc
* tests/storagepoolxml2xmltest.c (mymain): Likewise.
c401cc
c401cc
Signed-off-by: Eric Blake <eblake@redhat.com>
c401cc
(cherry picked from commit ed5fa7f39399080b0aeb5a657fc71b75019edbe9)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 docs/formatstorage.html.in                       | 15 ++--
c401cc
 docs/schemas/storagepool.rng                     | 26 ++++++-
c401cc
 docs/storage.html.in                             | 91 +++++++++++++++++++++++-
c401cc
 tests/storagepoolxml2xmlin/pool-gluster-sub.xml  |  9 +++
c401cc
 tests/storagepoolxml2xmlin/pool-gluster.xml      |  8 +++
c401cc
 tests/storagepoolxml2xmlout/pool-gluster-sub.xml | 12 ++++
c401cc
 tests/storagepoolxml2xmlout/pool-gluster.xml     | 12 ++++
c401cc
 tests/storagepoolxml2xmltest.c                   |  2 +
c401cc
 8 files changed, 168 insertions(+), 7 deletions(-)
c401cc
 create mode 100644 tests/storagepoolxml2xmlin/pool-gluster-sub.xml
c401cc
 create mode 100644 tests/storagepoolxml2xmlin/pool-gluster.xml
c401cc
 create mode 100644 tests/storagepoolxml2xmlout/pool-gluster-sub.xml
c401cc
 create mode 100644 tests/storagepoolxml2xmlout/pool-gluster.xml
c401cc
c401cc
diff --git a/docs/formatstorage.html.in b/docs/formatstorage.html.in
c401cc
index 2bb29b1..015de1e 100644
c401cc
--- a/docs/formatstorage.html.in
c401cc
+++ b/docs/formatstorage.html.in
c401cc
@@ -21,8 +21,10 @@
c401cc
       iscsi, logical, scsi
c401cc
       (all since 0.4.1), mpath
c401cc
       (since 0.7.1), rbd
c401cc
-      (since 0.9.13), or sheepdog
c401cc
-      (since 0.10.0). This corresponds to the
c401cc
+      (since 0.9.13), sheepdog
c401cc
+      (since 0.10.0),
c401cc
+      or gluster (since
c401cc
+      1.2.0). This corresponds to the
c401cc
       storage backend drivers listed further along in this document.
c401cc
     

c401cc
     

General metadata

c401cc
@@ -101,7 +103,9 @@
c401cc
         path to the block device node. Since 0.4.1
c401cc
       
dir
c401cc
       
Provides the source for pools backed by directories (pool
c401cc
-        type dir). May
c401cc
+        type dir), or optionally to select a subdirectory
c401cc
+        within a pool that resembles a filesystem (pool
c401cc
+        type gluster). May
c401cc
         only occur once. Contains a single attribute path
c401cc
         which is the fully qualified path to the backing directory.
c401cc
         Since 0.4.1
c401cc
@@ -129,7 +133,7 @@
c401cc
       
host
c401cc
       
Provides the source for pools backed by storage from a
c401cc
         remote server (pool types netfs, iscsi,
c401cc
-        rbd, sheepdog). Will be
c401cc
+        rbd, sheepdog, gluster). Will be
c401cc
         used in combination with a directory
c401cc
         or device element. Contains an attribute name
c401cc
         which is the hostname or IP address of the server. May optionally
c401cc
@@ -160,7 +164,8 @@
c401cc
       
name
c401cc
       
Provides the source for pools backed by storage from a
c401cc
         named element (pool types logical, rbd,
c401cc
-        sheepdog).  Contains a string identifier.
c401cc
+        sheepdog, gluster).  Contains a
c401cc
+        string identifier.
c401cc
         Since 0.4.5
c401cc
       
format
c401cc
       
Provides information about the format of the pool (pool
c401cc
diff --git a/docs/schemas/storagepool.rng b/docs/schemas/storagepool.rng
c401cc
index 72c4fd6..d1e8f36 100644
c401cc
--- a/docs/schemas/storagepool.rng
c401cc
+++ b/docs/schemas/storagepool.rng
c401cc
@@ -21,6 +21,7 @@
c401cc
         <ref name='poolmpath'/>
c401cc
         <ref name='poolrbd'/>
c401cc
         <ref name='poolsheepdog'/>
c401cc
+        <ref name='poolgluster'/>
c401cc
       </choice>
c401cc
     </element>
c401cc
   </define>
c401cc
@@ -125,6 +126,17 @@
c401cc
     <ref name='sourcesheepdog'/>
c401cc
   </define>
c401cc
 
c401cc
+  <define name='poolgluster'>
c401cc
+    <attribute name='type'>
c401cc
+      <value>gluster</value>
c401cc
+    </attribute>
c401cc
+    <interleave>
c401cc
+      <ref name='commonmetadata'/>
c401cc
+      <ref name='sizing'/>
c401cc
+      <ref name='sourcegluster'/>
c401cc
+    </interleave>
c401cc
+  </define>
c401cc
+
c401cc
   <define name='sourceinfovendor'>
c401cc
     <optional>
c401cc
       <element name='vendor'>
c401cc
@@ -277,7 +289,7 @@
c401cc
   <define name='sourceinfodir'>
c401cc
     <element name='dir'>
c401cc
       <attribute name='path'>
c401cc
-        <ref name='absFilePath'/>
c401cc
+        <ref name='absDirPath'/>
c401cc
       </attribute>
c401cc
       <empty/>
c401cc
     </element>
c401cc
@@ -506,6 +518,18 @@
c401cc
     </element>
c401cc
   </define>
c401cc
 
c401cc
+  <define name='sourcegluster'>
c401cc
+    <element name='source'>
c401cc
+      <interleave>
c401cc
+        <ref name='sourceinfohost'/>
c401cc
+        <ref name='sourceinfoname'/>
c401cc
+        <optional>
c401cc
+          <ref name='sourceinfodir'/>
c401cc
+        </optional>
c401cc
+      </interleave>
c401cc
+    </element>
c401cc
+  </define>
c401cc
+
c401cc
   <define name='IscsiQualifiedName'>
c401cc
     <data type='string'>
c401cc
       <param name="pattern">iqn\.[0-9]{4}-(0[1-9]|1[0-2])\.[a-zA-Z0-9\.\-]+(:.+)?</param>
c401cc
diff --git a/docs/storage.html.in b/docs/storage.html.in
c401cc
index 0464565..6a32c95 100644
c401cc
--- a/docs/storage.html.in
c401cc
+++ b/docs/storage.html.in
c401cc
@@ -114,6 +114,9 @@
c401cc
       
  • c401cc
             Sheepdog backend
    c401cc
           
    c401cc
    +      
  • c401cc
    +        Gluster backend
    c401cc
    +      
    c401cc
         
    c401cc
     
    c401cc
         

    Directory pool

    c401cc
    @@ -280,7 +283,9 @@
    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
    +        directly mount subdirectories within a volume.  (To bypass the
    c401cc
    +        file system completely, see
    c401cc
    +        the gluster pool.)
    c401cc
           
    c401cc
           
  • c401cc
             cifs - use the SMB (samba) or CIFS file system
    c401cc
    @@ -652,5 +657,89 @@
    c401cc
           The Sheepdog pool does not use the volume format type element.
    c401cc
         

    c401cc
     
    c401cc
    +    

    Gluster pools

    c401cc
    +    

    c401cc
    +      This provides a pool based on native Gluster access.  Gluster is
    c401cc
    +      a distributed file system that can be exposed to the user via
    c401cc
    +      FUSE, NFS or SMB (see the netfs
    c401cc
    +      pool for that usage); but for minimal overhead, the ideal access
    c401cc
    +      is via native access (only possible for QEMU/KVM compiled with
    c401cc
    +      libgfapi support).
    c401cc
    +
    c401cc
    +      The cluster and storage volume must already be running, and it
    c401cc
    +      is recommended that the volume be configured with gluster
    c401cc
    +      volume set $volname storage.owner-uid=$uid
    c401cc
    +      and gluster volume set $volname
    c401cc
    +      storage.owner-gid=$gid for the uid and gid that qemu will
    c401cc
    +      be run as.  It may also be necessary to
    c401cc
    +      set rpc-auth-allow-insecure on for the glusterd
    c401cc
    +      service, as well as gluster set $volname
    c401cc
    +      server.allow-insecure on, to allow access to the gluster
    c401cc
    +      volume.
    c401cc
    +
    c401cc
    +      Since 1.2.0
    c401cc
    +    

    c401cc
    +
    c401cc
    +    

    Example pool input

    c401cc
    +    

    A gluster volume corresponds to a libvirt storage pool. If a

    c401cc
    +      gluster volume could be mounted as mount -t glusterfs
    c401cc
    +      localhost:/volname /some/path, then the following example
    c401cc
    +      will describe the same pool without having to create a local
    c401cc
    +      mount point.  Remember that with gluster, the mount point can be
    c401cc
    +      through any machine in the cluster, and gluster will
    c401cc
    +      automatically pick the ideal transport to the actual bricks
    c401cc
    +      backing the gluster volume, even if on a different host than the
    c401cc
    +      one named in the host designation.
    c401cc
    +      The <name> element is always the volume name
    c401cc
    +      (no slash).  The pool source also supports an
    c401cc
    +      optional <dir> element with
    c401cc
    +      a path attribute that lists the absolute name of a
    c401cc
    +      subdirectory relative to the gluster volume to use instead of
    c401cc
    +      the top-level directory of the volume.

    c401cc
    +    
    c401cc
    +      <pool type="gluster">
    c401cc
    +        <name>myglusterpool</name>
    c401cc
    +        <source>
    c401cc
    +          <name>volname</name>
    c401cc
    +          <host name='localhost'/>
    c401cc
    +          <dir path='/'/>
    c401cc
    +        </source>
    c401cc
    +      </pool>
    c401cc
    +
    c401cc
    +    

    Example volume output

    c401cc
    +    

    Libvirt storage volumes associated with a gluster pool

    c401cc
    +      correspond to the files that can be found when mounting the
    c401cc
    +      gluster volume.  The name is the path relative to
    c401cc
    +      the effective mount specified for the pool; and
    c401cc
    +      the key is a path including the gluster volume
    c401cc
    +      name and any subdirectory specified by the pool.

    c401cc
    +    
    c401cc
    +       <volume>
    c401cc
    +         <name>myfile</name>
    c401cc
    +         <key>volname/myfile</key>
    c401cc
    +         <source>
    c401cc
    +         </source>
    c401cc
    +         <capacity unit='bytes'>53687091200</capacity>
    c401cc
    +         <allocation unit='bytes'>53687091200</allocation>
    c401cc
    +       </volume>
    c401cc
    +
    c401cc
    +    

    Example disk attachment

    c401cc
    +    

    Files within a gluster volume can be attached to Qemu guests.

    c401cc
    +    Information about attaching a Gluster image to a
    c401cc
    +    guest can be found
    c401cc
    +    at the format domain
    c401cc
    +    page.

    c401cc
    +
    c401cc
    +    

    Valid pool format types

    c401cc
    +    

    c401cc
    +      The Gluster pool does not use the pool format type element.
    c401cc
    +    

    c401cc
    +
    c401cc
    +    

    Valid volume format types

    c401cc
    +    

    c401cc
    +      The valid volume types are the same as for the directory
    c401cc
    +      pool type.
    c401cc
    +    

    c401cc
    +
    c401cc
       </body>
    c401cc
     </html>
    c401cc
    diff --git a/tests/storagepoolxml2xmlin/pool-gluster-sub.xml b/tests/storagepoolxml2xmlin/pool-gluster-sub.xml
    c401cc
    new file mode 100644
    c401cc
    index 0000000..ba4458f
    c401cc
    --- /dev/null
    c401cc
    +++ b/tests/storagepoolxml2xmlin/pool-gluster-sub.xml
    c401cc
    @@ -0,0 +1,9 @@
    c401cc
    +<pool type='gluster'>
    c401cc
    +  <source>
    c401cc
    +    <name>volume</name>
    c401cc
    +    <dir path='/sub'/>
    c401cc
    +    <host name='localhost'/>
    c401cc
    +  </source>
    c401cc
    +  <name>mygluster</name>
    c401cc
    +  <uuid>65fcba04-5b13-bd93-cff3-52ce48e11ad8</uuid>
    c401cc
    +</pool>
    c401cc
    diff --git a/tests/storagepoolxml2xmlin/pool-gluster.xml b/tests/storagepoolxml2xmlin/pool-gluster.xml
    c401cc
    new file mode 100644
    c401cc
    index 0000000..ae9401f
    c401cc
    --- /dev/null
    c401cc
    +++ b/tests/storagepoolxml2xmlin/pool-gluster.xml
    c401cc
    @@ -0,0 +1,8 @@
    c401cc
    +<pool type='gluster'>
    c401cc
    +  <source>
    c401cc
    +    <name>volume</name>
    c401cc
    +    <host name='localhost'/>
    c401cc
    +  </source>
    c401cc
    +  <name>mygluster</name>
    c401cc
    +  <uuid>65fcba04-5b13-bd93-cff3-52ce48e11ad8</uuid>
    c401cc
    +</pool>
    c401cc
    diff --git a/tests/storagepoolxml2xmlout/pool-gluster-sub.xml b/tests/storagepoolxml2xmlout/pool-gluster-sub.xml
    c401cc
    new file mode 100644
    c401cc
    index 0000000..df7d719
    c401cc
    --- /dev/null
    c401cc
    +++ b/tests/storagepoolxml2xmlout/pool-gluster-sub.xml
    c401cc
    @@ -0,0 +1,12 @@
    c401cc
    +<pool type='gluster'>
    c401cc
    +  <name>mygluster</name>
    c401cc
    +  <uuid>65fcba04-5b13-bd93-cff3-52ce48e11ad8</uuid>
    c401cc
    +  <capacity unit='bytes'>0</capacity>
    c401cc
    +  <allocation unit='bytes'>0</allocation>
    c401cc
    +  <available unit='bytes'>0</available>
    c401cc
    +  <source>
    c401cc
    +    <host name='localhost'/>
    c401cc
    +    <dir path='/sub'/>
    c401cc
    +    <name>volume</name>
    c401cc
    +  </source>
    c401cc
    +</pool>
    c401cc
    diff --git a/tests/storagepoolxml2xmlout/pool-gluster.xml b/tests/storagepoolxml2xmlout/pool-gluster.xml
    c401cc
    new file mode 100644
    c401cc
    index 0000000..a7fa506
    c401cc
    --- /dev/null
    c401cc
    +++ b/tests/storagepoolxml2xmlout/pool-gluster.xml
    c401cc
    @@ -0,0 +1,12 @@
    c401cc
    +<pool type='gluster'>
    c401cc
    +  <name>mygluster</name>
    c401cc
    +  <uuid>65fcba04-5b13-bd93-cff3-52ce48e11ad8</uuid>
    c401cc
    +  <capacity unit='bytes'>0</capacity>
    c401cc
    +  <allocation unit='bytes'>0</allocation>
    c401cc
    +  <available unit='bytes'>0</available>
    c401cc
    +  <source>
    c401cc
    +    <host name='localhost'/>
    c401cc
    +    <dir path='/'/>
    c401cc
    +    <name>volume</name>
    c401cc
    +  </source>
    c401cc
    +</pool>
    c401cc
    diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
    c401cc
    index c75480b..9c25f2f 100644
    c401cc
    --- a/tests/storagepoolxml2xmltest.c
    c401cc
    +++ b/tests/storagepoolxml2xmltest.c
    c401cc
    @@ -102,6 +102,8 @@ mymain(void)
    c401cc
         DO_TEST("pool-iscsi-multiiqn");
    c401cc
         DO_TEST("pool-iscsi-vendor-product");
    c401cc
         DO_TEST("pool-sheepdog");
    c401cc
    +    DO_TEST("pool-gluster");
    c401cc
    +    DO_TEST("pool-gluster-sub");
    c401cc
     
    c401cc
         return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
    c401cc
     }
    c401cc
    -- 
    c401cc
    1.9.0
    c401cc