13.8. GlusterFS Storage Pools

This section covers enabling a GlusterFS based storage pool. Red Hat Enterprise Linux 6.5 includes native support for creating virtual machines with GlusterFS. GlusterFS is a user-space file system that uses FUSE. When enabled in a guest virtual machine it enables a KVM host physical machine to boot guest virtual machine images from one or more GlusterFS storage volumes, and to use images from a GlusterFS storage volume as data disks for guest virtual machines.

13.8.1. Creating a GlusterFS Storage Pool Using virsh

This section will demonstrate how to prepare a Gluster server and an active Gluster volume.

Procedure 13.9. Preparing a Gluster server and an active Gluster volume

  1. Obtain the IP address of the Gluster server by listing its status with the following command:
    # gluster volume status
    Status of volume: gluster-vol1
    Gluster process						Port	Online	Pid
    ------------------------------------------------------------------------------
    Brick 222.111.222.111:/gluster-vol1 			49155	Y	18634
    
    Task Status of Volume gluster-vol1
    ------------------------------------------------------------------------------
    There are no active volume tasks
    
  2. If you have not already done so, install glusterfs-fuse and enable virt_use_fusefs. Then prepare one host which will connect to the Gluster server by running the following commands:
    # setsebool virt_use_fusefs on
    # getsebool virt_use_fusefs
    virt_use_fusefs --> on
    
  3. Create a new XML file to configure a Gluster storage pool (named glusterfs-pool.xml in this example) specifying pool type as gluster, and add the following data:
    			
    <pool type='gluster'>
    	<name>glusterfs-pool</name>
    	<source>
    		<host name='111.222.111.222'/>
    		<dir path='/'/>
    		<name>gluster-vol1</name>
    	</source>
    </pool>
    			

    Figure 13.24. GlusterFS XML file contents

  4. Define and start the Gluster pool, using the following commands:
    # virsh pool-define glusterfs-pool.xml
    Pool gluster-pool defined from glusterfs-pool.xml
    
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------
    gluster-pool         inactive   no
    
    # virsh pool-start gluster-pool
    Pool gluster-pool started
    
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------
    gluster-pool         active     no
    
    # virsh vol-list gluster-pool
    Name                 Path
    -----------------------------------------
    qcow2.img            gluster://111.222.111.222/gluster-vol1/qcow2.img
    raw.img              gluster://111.222.111.222/gluster-vol1/raw.img
    

13.8.2. Deleting a GlusterFS Storage Pool Using virsh

This section details how to delete a storage pool using virsh.

Procedure 13.10. Deleting a GlusterFS storage pool

  1. Set the status of the storage pool to inactive, using the following command:
    # virsh pool-destroy gluster-pool
    Pool gluster-pool destroyed
    
  2. Confirm the pool is inactive, using the following command
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------
    gluster-pool         inactive   no
    
  3. Undefine the GlusterFS storage pool using the following command:
    # virsh pool-undefine gluster-pool
    Pool gluster-pool has been undefined
    
  4. Confirm the pool is undefined, using the following command:
    # virsh pool-list --all
    Name                 State      Autostart
    -----------------------------------------