Bug 1072714

Summary: find-storage-pool-sources should look up glusterfs pool sources (for netfs pools)
Product: [Community] Virtualization Tools Reporter: chhu
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, ajia, dyuan, mzhan, pkrempa, shyu, yanyang
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-17 14:58:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description chhu 2014-03-05 05:11:00 UTC
Description:
find-storage-pool-sources/find-storage-pool-sources-as got wrong source format type

Version-Release number of selected component (if applicable):
libvirt-1.1.1-25.el7.x86_64
qemu-kvm-rhev-1.5.3-50.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. define and start a netfs pool with source format type='glusterfs'
# virsh pool-dumpxml netfs-gluster
<pool type='netfs'>
  <name>netfs-gluster</name>
  <uuid>d5609ced-94b1-489e-b218-eff35c30336a</uuid>
  <capacity unit='bytes'>856564301824</capacity>
  <allocation unit='bytes'>35528245248</allocation>
  <available unit='bytes'>821036056576</available>
  <source>
    <host name='10.66.84.12'/>
    <dir path='/gluster-vol1'/>
    <format type='glusterfs'/>
  </source>
  <target>
    <path>/mnt/gluster</path>
    <permissions>
      <mode>0755</mode>
      <owner>-1</owner>
      <group>-1</group>
    </permissions>
  </target>
</pool>

# virsh pool-list --type netfs
Name                 State      Autostart
-----------------------------------------
netfs-gluster        active     no

2. check the gluster mount type on the host is fuse.glusterfs
# mount |grep gluster
10.66.84.12:/gluster-vol1 on /mnt/gluster type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)

3. run find-storage-pool-sources to find the source: the source format type='nfs'
# more sources.xml
  <source>
    <host name='10.66.84.12'/>
  </source>

# virsh find-storage-pool-sources netfs sources.xml
<sources>
  <source>
    <host name='10.66.84.12'/>
    <dir path='/gluster-vol1'/>
    <format type='nfs'/>
  </source>
</sources>

# virsh find-storage-pool-sources-as netfs 10.66.84.12
<sources>
  <source>
    <host name='10.66.84.12'/>
    <dir path='/gluster-vol1'/>
    <format type='nfs'/>
  </source>
</sources>

Expected results:
In step3: find-storage-pool-sources/find-storage-pool-sources-as got the source format type='glusterfs'

Actual results:
In step3: find-storage-pool-sources/find-storage-pool-sources-as got the source format type='nfs'

Comment 1 Peter Krempa 2014-03-05 09:03:26 UTC
Is your gluster server configured to export the volumes using NFS in addition to the native protocol?

http://gluster.org/community/documentation/index.php/Gluster_3.2:_Using_NFS_with_Gluster

If it's so, then the output is correct. The bug should then be changed to support lookup of gluster sources along with nfs.

Comment 2 chhu 2014-03-06 05:43:46 UTC
(In reply to Peter Krempa from comment #1)
> Is your gluster server configured to export the volumes using NFS in
> addition to the native protocol?
> 
> http://gluster.org/community/documentation/index.php/Gluster_3.2:
> _Using_NFS_with_Gluster
> 
> If it's so, then the output is correct. The bug should then be changed to
> support lookup of gluster sources along with nfs.

The gluster server configured to export the volumes using NFS in addition to the native protocol.

# gluster volume info gluster-vol1 | grep nfs.disable
nfs.disable: off


After I set the nfs.disable=on in the gluster server, the test results are:
# gluster volume info gluster-vol1 | grep nfs.disable
nfs.disable: on

# virsh pool-list --type netfs
Name                 State      Autostart 
-----------------------------------------
netfs-gluster        active     no

# mount| grep gluster
10.66.84.12:/gluster-vol1 on /mnt/gluster type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)

# virsh find-storage-pool-sources netfs sources.xml 
error: Failed to find any netfs pool sources
error: internal error: Child process (/usr/sbin/showmount --no-headers --exports 10.66.84.12) unexpected exit status 1

# virsh find-storage-pool-sources-as netfs 10.66.84.12
error: Failed to find any netfs pool sources
error: internal error: Child process (/usr/sbin/showmount --no-headers --exports 10.66.84.12) unexpected exit status 1

Comment 3 Peter Krempa 2014-03-06 12:41:49 UTC
The issue here is that our code isn't able to find glusterfs pools via the native protocol. The output provided in comment 1 is correct as the volumes in question are indeed exported via glusterd's NFS export.

Libvirt should be able to look up native glusterfs exports too.

Additionally if the lookup command fails the reported error should be improved.

Comment 4 Peter Krempa 2014-04-01 11:35:08 UTC
Added upstream:

commit cb93802958e0f2f7f2d8c494826d9c583094da8d
Author: Peter Krempa <pkrempa>
Date:   Thu Mar 27 13:39:51 2014 +0100

    storage: gluster: Implement storage pool lookup
    
    Use the previously implemented function to lookup glusterfs source pools
    for the netfs pool to lookup native gluster pools too.

commit 05671b95dbe3a141a8ec93262df9d28e0509ae24
Author: Peter Krempa <pkrempa>
Date:   Wed Mar 26 19:17:55 2014 +0100

    storage: netfs: Support lookup of glusterfs pool sources
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1072714
    
    Use the "gluster" command line tool to retrieve information about remote
    volumes on a gluster server to allow storage pool source lookup.
    
    Unfortunately gluster doesn't provide a management library so that we
    could use that directly, instead the RPC calls are hardcoded in the
    command line tool.

commit 18642d100f2f73c3a9a42211cddf5cda38943656
Author: Peter Krempa <pkrempa>
Date:   Wed Mar 26 17:25:40 2014 +0100

    storage: netfs: Split up and tidy up NFS storage pool source function
    
    Extract the NFS related stuff into a separate function and tidy up the
    rest of the code so we can reuse it to add gluster backend detection.
    
    Additionally avoid reporting of errors from "showmount" and return an
    empty source list instead. This will help when adding other detection
    backends.

Comment 8 Peter Krempa 2014-07-17 14:58:06 UTC
Libvirt's 1.2.4 release contains this functionality.