Bug 1349441

Summary: find-storage-pool-sources-as/find-storage-pool-sources doesn't work for gluster type pool
Product: Red Hat Enterprise Linux 7 Reporter: yisun
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: yisun
Severity: low Docs Contact:
Priority: low    
Version: 7.3CC: dyuan, jdenemar, pkrempa, rbalakri, xuzhang, yanyang, yisun
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.1.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 17:09:12 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 yisun 2016-06-23 13:03:14 UTC
Description:
find-storage-pool-sources-as/find-storage-pool-sources doesn't work for gluster type pool


versions:
libvirt-1.3.4-1.el7.x86_64

How reproducible:
100%

Steps:
1.
# virsh pool-dumpxml gluster-vol2
<pool type='gluster'>
  <name>gluster-vol2</name>
  <uuid>c41bfbbc-ab34-4533-87ce-98a48aa4c6f3</uuid>
  <capacity unit='bytes'>214643507200</capacity>
  <allocation unit='bytes'>116166967296</allocation>
  <available unit='bytes'>98476539904</available>
  <source>
    <host name='10.66.4.200'/>
    <dir path='/'/>
    <name>gluster-vol2</name>
  </source>
</pool>

2. # virsh pool-list --type gluster
 Name                 State      Autostart
-------------------------------------------
 gluster-vol2         active     no    


3. # virsh find-storage-pool-sources-as gluster 10.66.4.200
<sources>
</sources>

4. # cat sources.xml
<source>
<host name='10.66.4.200'/>
</source>

5. # virsh find-storage-pool-sources gluster sources.xml
<sources>
</sources>


Expected result:
In step 3&5, the find-storage-pool-sources[-as] cmd should return info as:
  <source>
    <host name='10.66.4.200'/>
    <dir path='/'/>
    <name>gluster-vol2</name>
  </source>


Actual result:
It returns null.

Additional info:
BZ 1072714 has fixed this issue with gluster backend storage used as netfs pool.

Comment 1 Peter Krempa 2016-12-12 14:38:43 UTC
The series for BZ 1072714 implemented the functionality for 'gluster' pools too.

I currently can't reproduce it in my setup:
 $  virsh find-storage-pool-sources-as gluster virt-gluster-node1.usersys.redhat.com
<sources>
  <source>
    <host name='virt-gluster-node1.usersys.redhat.com'/>
    <dir path='vol0'/>
  </source>
</sources>

At any rate. Libvirt merely parses output of:

gluster --xml --log-file=/dev/null volume info all --remote-host=virt-gluster-node1.usersys.redhat.com

I'm closing this bug since it appears to work for me. If you manage to reproduce this bug, please reopen it and attach output of the gluster tool as libvirt doesn't really do much here.

Comment 3 yisun 2016-12-26 10:24:04 UTC
Hi Peter, 
I repopen this issue according to above comment. Still cannot see any sources as following step shows. 
[root@localhost ~]# virsh find-storage-pool-sources-as gluster xxx.xxx.xxx.xxx
<sources>
</sources> <==== nothing here

And I added the output of 
gluster --xml --log-file=/dev/null volume info all --remote-host=xxx.xxx.xxx.xxx

please have a check if it's a problem. thx.

Comment 4 yisun 2016-12-28 06:16:05 UTC
Hi Peter,
Seems the reason is that your compile env has the glusterfs-cli, and then the rpm you build enabled related functions. And the compile env for libvirt rpm in brewweb doesn't have glusterfs-cli, which make related functions disabled. So this may be a issue when build brewweb rpms. pls have a check.

Comment 5 Peter Krempa 2017-01-09 12:41:01 UTC
Good point. It appears that the 'gluster' command line tool was moved into it's own sub-package and I was not testing the official build. This indeed requires some fixing.

Comment 6 Peter Krempa 2017-01-18 10:10:33 UTC
Fixed upstream:

commit dd335d03e819284016e650923dadf6806b8ac03a
Author: Peter Krempa <pkrempa>
Date:   Tue Jan 10 18:08:44 2017 +0100

    spec: Depend on the gluster command line tool
    
    The gluster command line tool that is used to lookup storage pool
    sources moved from the gluster-client package to gluster-cli.

Comment 8 yisun 2017-03-27 04:31:18 UTC
Verified on libvirt-3.1.0-2.el7.x86_64
According to comment 1, libvirt just calls
gluster --xml --log-file=/dev/null volume info all --remote-host=virt-gluster-node1.usersys.redhat.com

So, I prepare a gluster server yisun.com
and test with find-storage-pool-sources-as 

Steps:
1. ## virsh pool-dumpxml gluster
<pool type='gluster'>
  <name>gluster</name>
  <uuid>1fb76004-6e19-4ba1-8ac6-43f5901675f4</uuid>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <host name='yisun.com'/>
    <dir path='/'/>
    <name>gluster-vol1</name>
  </source>
</pool>

2. virsh vol-list gluster
 Name                 Path                                    
------------------------------------------------------------------------------
 .trashcan            gluster://yisun.com/gluster-vol1/.trashcan
 1.img                gluster://yisun.com/gluster-vol1/1.img 
 2.img                gluster://yisun.com/gluster-vol1/2.img 
 luks_1.img           gluster://yisun.com/gluster-vol1/luks_1.img
 rh7.img              gluster://yisun.com/gluster-vol1/rh7.img

3. ## virsh find-storage-pool-sources-as gluster yisun.com
<sources>
  <source>
    <host name='yisun.com'/>
    <dir path='gluster-vol1'/>
  </source>
</sources>

Comment 9 yisun 2017-03-27 04:32:59 UTC
Also test with find-storage-pool-source
## cat sources.xml 
<source>
    <host name='yisun.com'/>
</source>
 

## virsh find-storage-pool-sources gluster sources.xml
<sources>
  <source>
    <host name='yisun.com'/>
    <dir path='gluster-vol1'/>
  </source>
</sources>

Comment 10 errata-xmlrpc 2017-08-01 17:09:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846

Comment 11 errata-xmlrpc 2017-08-01 23:51:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:1846