Bug 1581670 - [RFE] Report list of supported storage pools
Summary: [RFE] Report list of supported storage pools
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: ---
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: pre-dev-freeze
: ---
Assignee: John Ferlan
QA Contact: Meina Li
URL:
Whiteboard:
Depends On:
Blocks: 1525575
TreeView+ depends on / blocked
 
Reported: 2018-05-23 11:23 UTC by Pavel Hrdina
Modified: 2019-11-06 07:12 UTC (History)
11 users (show)

Fixed In Version: libvirt-5.3.0-1.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-06 07:11:30 UTC
Type: Feature Request
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:3723 None None None 2019-11-06 07:12:01 UTC

Description Pavel Hrdina 2018-05-23 11:23:11 UTC
Currently there is no simple way how to get list of supported storage pools.  It would be nice to report it in capabilities.

Comment 3 John Ferlan 2019-01-10 13:44:58 UTC
Does it only matter which storage pools by type?  That is output such as:

  <pool>
    <type>dir</pool>
  </pool>

  <pool>
    <type>fs</pool>
  </pool>
...



Would it be useful to know what functions the backend supports as well?  And by functions I'm thinking _virStorageBackend "pool" and "volume" type data.
I'd take suggestions over the format for output too! Not every backend supports every pool and volume function. Some don't make sense, such as for the
dir pool, it doesn't make sense to start the pool and there's no create function; however, there is build, refresh, and delete.

The pool functions would be findPoolSources, start, build, refresh, stop, and delete

The volume functions would be build, buildFrom, create, delete, refresh, resize, upload, download, and wipe.

Finally, generation of such output would be available through the "storage:///" connection pointer and not other hypervisor's.

Comment 4 John Ferlan 2019-03-06 16:24:00 UTC
A couple series were posted:

v2: https://www.redhat.com/archives/libvir-list/2019-February/msg00709.html
v1: https://www.redhat.com/archives/libvir-list/2019-January/msg00479.html

The v2 series was pushed w/ minor changes

Author: John Ferlan <jferlan@redhat.com>
Date:   Thu Feb 7 12:02:53 2019 -0500

    virsh: Expose virConnectGetStoragePoolCapabilities
    
...
    
    Add a new storage pool command "pool-capabilities" to output
    the storage pool capabilities.
    
    Signed-off-by: John Ferlan <jferlan@redhat.com>
    ACKed-by: Michal Privoznik <mprivozn@redhat.com>

$ git describe d9a411589292dce17203e52fd042fa35f13f87e8
v5.1.0-122-gd9a4115892
$

Example of my output:

$ virsh -c storage:///system capabilities
<capabilities>

  <pool>
    <enum name='type'>
      <value>dir</value>
      <value>fs</value>
      <value>netfs</value>
      <value>logical</value>
      <value>iscsi</value>
      <value>iscsi-direct</value>
      <value>scsi</value>
      <value>mpath</value>
      <value>disk</value>
      <value>rbd</value>
      <value>sheepdog</value>
      <value>gluster</value>
      <value>zfs</value>
    </enum>
  </pool>

</capabilities>

$ virsh -c storage:///system pool-capabilities
<storagepoolCapabilities>
  <pool type='dir' supported='yes'>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='fs' supported='yes'>
    <poolOptions>
      <defaultFormat type='auto'/>
      <enum name='sourceFormatType'>
        <value>auto</value>
        <value>ext2</value>
        <value>ext3</value>
        <value>ext4</value>
        <value>ufs</value>
        <value>iso9660</value>
        <value>udf</value>
        <value>gfs</value>
        <value>gfs2</value>
        <value>vfat</value>
        <value>hfs+</value>
        <value>xfs</value>
        <value>ocfs2</value>
      </enum>
      <enum name='requiredSourceElements'>
        <value>device</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='netfs' supported='yes'>
    <poolOptions>
      <defaultFormat type='auto'/>
      <enum name='sourceFormatType'>
        <value>auto</value>
        <value>nfs</value>
        <value>glusterfs</value>
        <value>cifs</value>
      </enum>
      <enum name='requiredSourceElements'>
        <value>host</value>
        <value>dir</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='logical' supported='yes'>
    <poolOptions>
      <defaultFormat type='lvm2'/>
      <enum name='sourceFormatType'>
        <value>unknown</value>
        <value>lvm2</value>
      </enum>
      <enum name='requiredSourceElements'>
        <value>device</value>
        <value>name</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='disk' supported='yes'>
    <poolOptions>
      <defaultFormat type='unknown'/>
      <enum name='sourceFormatType'>
        <value>unknown</value>
        <value>dos</value>
        <value>dvh</value>
        <value>gpt</value>
        <value>mac</value>
        <value>bsd</value>
        <value>pc98</value>
        <value>sun</value>
        <value>lvm2</value>
      </enum>
      <enum name='requiredSourceElements'>
        <value>device</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='none'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>linux</value>
        <value>fat16</value>
        <value>fat32</value>
        <value>linux-swap</value>
        <value>linux-lvm</value>
        <value>linux-raid</value>
        <value>extended</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='iscsi' supported='yes'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>host</value>
        <value>device</value>
        <value>initiator</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='iscsi-direct' supported='yes'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>host</value>
        <value>device</value>
        <value>initiator</value>
        <value>network</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='scsi' supported='yes'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>adapter</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='mpath' supported='yes'>
  </pool>
  <pool type='rbd' supported='yes'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>host</value>
        <value>name</value>
        <value>network</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='sheepdog' supported='yes'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>host</value>
        <value>name</value>
        <value>network</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='gluster' supported='yes'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>host</value>
        <value>dir</value>
        <value>name</value>
        <value>network</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='zfs' supported='yes'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>device</value>
        <value>name</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='vstorage' supported='no'>
    <poolOptions>
      <enum name='requiredSourceElements'>
        <value>name</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
</storagepoolCapabilities>

Comment 5 John Ferlan 2019-03-11 13:20:40 UTC
Note at update by Pavel to the code removes the requiredSourceElements elements, see:

$ git show commit 9dadc7302920f9fca0057c655d03c2b0206b9a70
Author: Pavel Hrdina <phrdina@redhat.com>
Date:   Wed Mar 6 18:59:39 2019 +0100

    caps: drop requiredSourceElements from storage pool capabilities
    
    Capabilities should not duplicate data that are obvious from our
    documentation and will not change with different QEMU binaries
    or the way how we compile libvirt.
    
    Signed-off-by: Pavel Hrdina <phrdina@redhat.com>


$ git describe 9dadc7302920f9fca0057c655d03c2b0206b9a70
v5.1.0-133-g9dadc73029
$

Comment 9 Meina Li 2019-07-01 07:48:17 UTC
Verified Version:
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

Verified Steps:
Scenario 1: Report list of supported storage pools by virsh -c storage:///system capabilities
# virsh -c storage:///system capabilities
<capabilities>
  <pool>
    <enum name='type'>
      <value>dir</value>
      <value>fs</value>
      <value>netfs</value>
      <value>logical</value>
      <value>iscsi</value>
      <value>iscsi-direct</value>
      <value>scsi</value>
      <value>mpath</value>
      <value>disk</value>
      <value>rbd</value>
      <value>gluster</value>
    </enum>
  </pool>
</capabilities>

Scenario 2: Report list of supported storage pools by virsh pool-capabilities or virsh -c storage:///system pool-capabilities
# virsh pool-capabilities
<storagepoolCapabilities>
  <pool type='dir' supported='yes'>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='fs' supported='yes'>
    <poolOptions>
      <defaultFormat type='auto'/>
      <enum name='sourceFormatType'>
        <value>auto</value>
        <value>ext2</value>
        <value>ext3</value>
        <value>ext4</value>
        <value>ufs</value>
        <value>iso9660</value>
        <value>udf</value>
        <value>gfs</value>
        <value>gfs2</value>
        <value>vfat</value>
        <value>hfs+</value>
        <value>xfs</value>
        <value>ocfs2</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='netfs' supported='yes'>
    <poolOptions>
      <defaultFormat type='auto'/>
      <enum name='sourceFormatType'>
        <value>auto</value>
        <value>nfs</value>
        <value>glusterfs</value>
        <value>cifs</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='logical' supported='yes'>
    <poolOptions>
      <defaultFormat type='lvm2'/>
      <enum name='sourceFormatType'>
        <value>unknown</value>
        <value>lvm2</value>
      </enum>
    </poolOptions>
  </pool>
  <pool type='disk' supported='yes'>
    <poolOptions>
      <defaultFormat type='unknown'/>
      <enum name='sourceFormatType'>
        <value>unknown</value>
        <value>dos</value>
        <value>dvh</value>
        <value>gpt</value>
        <value>mac</value>
        <value>bsd</value>
        <value>pc98</value>
        <value>sun</value>
        <value>lvm2</value>
      </enum>
    </poolOptions>
    <volOptions>
      <defaultFormat type='none'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>linux</value>
        <value>fat16</value>
        <value>fat32</value>
        <value>linux-swap</value>
        <value>linux-lvm</value>
        <value>linux-raid</value>
        <value>extended</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='iscsi' supported='yes'>
  </pool>
  <pool type='iscsi-direct' supported='yes'>
  </pool>
  <pool type='scsi' supported='yes'>
  </pool>
  <pool type='mpath' supported='yes'>
  </pool>
  <pool type='rbd' supported='yes'>
  </pool>
  <pool type='sheepdog' supported='no'>
  </pool>
  <pool type='gluster' supported='yes'>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
  <pool type='zfs' supported='no'>
  </pool>
  <pool type='vstorage' supported='no'>
    <volOptions>
      <defaultFormat type='raw'/>
      <enum name='targetFormatType'>
        <value>none</value>
        <value>raw</value>
        <value>dir</value>
        <value>bochs</value>
        <value>cloop</value>
        <value>dmg</value>
        <value>iso</value>
        <value>vpc</value>
        <value>vdi</value>
        <value>fat</value>
        <value>vhd</value>
        <value>ploop</value>
        <value>cow</value>
        <value>qcow</value>
        <value>qcow2</value>
        <value>qed</value>
        <value>vmdk</value>
      </enum>
    </volOptions>
  </pool>
</storagepoolCapabilities>

Scenario 3: Check related doc.
1) # man virsh | grep pool-capabilities -a4
2) # virsh pool-capabilities --help

All the result of scenarios are expected, so move this bug to be verified.

Comment 11 errata-xmlrpc 2019-11-06 07:11:30 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


Note You need to log in before you can comment on or make changes to this bug.