Bug 1726609

Summary: Pool-list should support list iscsi-direct pools with --type iscsi-direct option
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: Meina Li <meili>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: gaojianan <jgao>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: dyuan, hhan, jdenemar, jgao, lmen, mprivozn, xuzhang, yisun
Target Milestone: rcKeywords: Upstream
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-5.6.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-06 07:17:18 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:
Attachments:
Description Flags
Code coverage report none

Description Meina Li 2019-07-03 09:30:12 UTC
Description of problem:
Pool-list should support list iscsi-direct pools with --type iscsi-direct option

Version-Release number of selected component (if applicable):
libvirt-5.4.0-1.module+el8.1.0+3304+7eb41d5f.x86_64
qemu-kvm-4.0.0-4.module+el8.1.0+3356+cda7f1ee.x86_64
kernel-4.18.0-107.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Create a iscsi-direct pool.
# virsh pool-dumpxml iscsi-direct 
<pool type='iscsi-direct'>
  <name>iscsi-direct</name>
  <uuid>2b621385-f734-4b98-8131-0fc17ed29e67</uuid>
  <capacity unit='bytes'>64424704512</capacity>
  <allocation unit='bytes'>64424704512</allocation>
  <available unit='bytes'>0</available>
  <source>
    <host name='**IP**'/>
    <device path='iqn.2017-12.com.virttest:emulated-iscsi-noauth.target2'/>
    <initiator>
      <iqn name='iqn.2017-12.com.example:client'/>
    </initiator>
  </source>
</pool>

2. List all pools.
# virsh pool-list --all
 Name           State    Autostart
------------------------------------
 default        active   yes
 images         active   yes
 iscsi-direct   active   no

3. List dir pools with --type dir.
# virsh pool-list --type dir
 Name      State    Autostart
-------------------------------
 default   active   yes
 images    active   yes

4. List iscsi-direct pools with --type iscsi-direct.
# virsh pool-list --type iscsi-direct
 Name   State   Autostart
---------------------------

Actual results:
pool-list can't list pools with --type iscsi-direct option

Expected results:
Pool-list should support list iscsi-direct pools with --type iscsi-direct option

Additional info:
# man virsh
...
pool-list [--inactive] [--all] [--persistent] [--transient] [--autostart] [--no-autostart] [[--details] [--uuid] [--name] [<type>]
...
You may also want to list pools with specified types using type, the pool types must be separated by comma, e.g. --type dir,disk. The valid pool types include 'dir', 'fs', 'netfs', 'logical', 'disk', 'iscsi', 'scsi', 'mpath', 'rbd', 'sheepdog' and 'gluster'.
...

Comment 1 Han Han 2019-07-04 02:28:39 UTC
The iscsi-direct pool type is missing in VIR_CONNECT_LIST_STORAGE_POOLS groups:
src/libvirt-storage.c:
  84  * The last group of @flags is provided to filter the pools by the types,       
  85  * the flags include:                                                           
  86  * VIR_CONNECT_LIST_STORAGE_POOLS_DIR                                           
  87  * VIR_CONNECT_LIST_STORAGE_POOLS_FS                                            
  88  * VIR_CONNECT_LIST_STORAGE_POOLS_NETFS                                         
  89  * VIR_CONNECT_LIST_STORAGE_POOLS_LOGICAL                                       
  90  * VIR_CONNECT_LIST_STORAGE_POOLS_DISK                                          
  91  * VIR_CONNECT_LIST_STORAGE_POOLS_ISCSI                                         
  92  * VIR_CONNECT_LIST_STORAGE_POOLS_SCSI                                          
  93  * VIR_CONNECT_LIST_STORAGE_POOLS_MPATH                                         
  94  * VIR_CONNECT_LIST_STORAGE_POOLS_RBD                                           
  95  * VIR_CONNECT_LIST_STORAGE_POOLS_SHEEPDOG

Comment 2 Han Han 2019-07-11 06:52:52 UTC
One upstream patch:
https://www.redhat.com/archives/libvir-list/2019-July/msg00603.html

Comment 3 Han Han 2019-07-11 07:24:49 UTC
v2 to add more missing flags in comment and virsh mannual: https://www.redhat.com/archives/libvir-list/2019-July/msg00605.html

Comment 4 Michal Privoznik 2019-07-13 15:50:06 UTC
I've pushed the patches upstream:

3efdffc450 storage: Add iscsi-direct pool list type flag
355fb766c9 virsh.pod: Add zfs and vstorage pool types
8462467cf7 storage: Add missing pool type flags in comment

v5.5.0-151-g3efdffc450

Comment 6 gaojianan 2019-08-12 03:00:04 UTC
Created attachment 1602661 [details]
Code coverage report

Version-Release number of selected component (if applicable):
libvirt-5.6.0-1.virtcov.el8.x86_64
qemu-kvm-4.0.0-6.module+el8.1.0+3736+a2aefea3.x86_64
kernel-4.18.0-129.el8.x86_64

Steps to verify:
1. Create a iscsi-direct pool.
# virsh pool-dumpxml iscsi-direct 
<pool type='iscsi-direct'>
  <name>iscsi-direct</name>
  <uuid>2b621385-f734-4b98-8131-0fc17ed29e67</uuid>
  <capacity unit='bytes'>64424704512</capacity>
  <allocation unit='bytes'>64424704512</allocation>
  <available unit='bytes'>0</available>
  <source>
    <host name='10.66.4.119'/>
    <device path='iqn.2016-03.com.virttest:logical-pool.target'/>
    <initiator>
      <iqn name='iqn.2017-12.com.example:client'/>
    </initiator>
  </source>
</pool>

2. List iscsi-direct pools with --type iscsi-direct.
# virsh pool-list --type iscsi-direct
 Name           State    Autostart
------------------------------------
 iscsi-direct   active   no

Work as expected

Comment 8 errata-xmlrpc 2019-11-06 07:17:18 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/RHBA-2019:3723