RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1710575 - Incorrect capacity and allocation fields in iscsi pool XML
Summary: Incorrect capacity and allocation fields in iscsi pool XML
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: libvirt
Version: 8.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: 8.1
Assignee: Michal Privoznik
QA Contact: gaojianan
URL:
Whiteboard:
Depends On:
Blocks: 1709708
TreeView+ depends on / blocked
 
Reported: 2019-05-15 19:41 UTC by Katerina Koukiou
Modified: 2020-11-14 08:36 UTC (History)
6 users (show)

Fixed In Version: libvirt-4.5.0-30.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-05 20:49:21 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:3345 0 None None None 2019-11-05 20:50:16 UTC

Description Katerina Koukiou 2019-05-15 19:41:48 UTC
Description of problem:
ISCSI storage pools not showing correct values for capacity and allocation.

Version-Release number of selected component (if applicable):
libvirt-daemon-driver-qemu-4.5.0-23.module+el8.1.0+2983+b2ae9c0a.x86_64
libvirt-daemon-driver-storage-iscsi-4.5.0-23.module+el8.1.0+2983+b2ae9c0a.x86_64


How reproducible:
Always

Steps to Reproduce:
1. Create a ramdisk backstore of 50M size, an ISCSI target and a LUN associated with that.

The following commands can be used for quick setup:

Get the initiator name with:
sed </etc/iscsi/initiatorname.iscsi -e 's/^.*=//'

For me it's:
iqn.1994-05.com.redhat:8dd547fc8758

Set up the target, the backstore the LUN and the ACLS with the following commands.
Replace the initiator name accordingly:

```
targetcli /backstores/ramdisk create test 50M
targetcli /iscsi create iqn.2019-09.cockpit.lan
targetcli /iscsi/iqn.2019-09.cockpit.lan/tpg1/luns create /backstores/ramdisk/test
targetcli /iscsi/iqn.2019-09.cockpit.lan/tpg1/acls create iqn.1994-05.com.redhat:8dd547fc8758
```

On my system the iscsi setup looks like that 

[root@localhost ~]# targetcli 
targetcli shell version 2.1.fb49
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.
/> ls
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 0]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 1]
  |   o- test ................................................................................................ [(50.0MiB) activated]
  |     o- alua ................................................................................................... [ALUA Groups: 1]
  |       o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  o- iscsi ............................................................................................................ [Targets: 1]
  | o- iqn.2019-09.cockpit.lan ........................................................................................... [TPGs: 1]
  |   o- tpg1 ............................................................................................... [no-gen-acls, no-auth]
  |     o- acls .......................................................................................................... [ACLs: 1]
  |     | o- iqn.1994-05.com.redhat:95e67d7f3114 .................................................................. [Mapped LUNs: 1]
  |     |   o- mapped_lun0 ................................................................................ [lun0 ramdisk/test (rw)]
  |     o- luns .......................................................................................................... [LUNs: 1]
  |     | o- lun0 ................................................................................ [ramdisk/test (default_tg_pt_gp)]
  |     o- portals .................................................................................................... [Portals: 1]
  |       o- 0.0.0.0:3260 ..................................................................................................... [OK]
  o- loopback ......................................................................................................... [Targets: 0]


2. Create a libvirt iscsi storage pool on the same machine with the following XML

# virsh pool-dumpxml my_iscsi_pool
<pool type='iscsi'>
  <name>my_iscsi_pool</name>
  <source>
    <host name='127.0.0.1' port='3260'/>
    <device path='iqn.2019-09.cockpit.lan'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
  </target>
</pool>

3. Confirm that the capacity is 0 even though I specified it to be 50M.

Actual results:

virsh # pool-info my_iscsi_pool
Name:           my_iscsi_pool
UUID:           7a045d65-5452-49c7-80c3-e5e10152b1a0
State:          running
Persistent:     yes
Autostart:      yes
Capacity:       0.00 B
Allocation:     0.00 B
Available:      0.00 B


Expected results:

virsh # pool-info my_iscsi_pool
...
Capacity:       50.00 MiB
Allocation:     50.00 MiB
Available:      0.00 B

Additional info:

With libvirt-daemon-5.1.0 the values are printed correctly, so the the bug was at some point fixed between these two versions.
Still I created it since I needed to track it because of https://bugzilla.redhat.com/show_bug.cgi?id=1709708

Comment 1 Michal Privoznik 2019-05-17 08:30:53 UTC
I think I know what the problem is. When libvirt starts an iscsi pool it then calls virWaitForDevices() which is supposed to call 'udevadm settle' so that udev is done and libvirt can proceed to discovering LUNs and their sized. Well, since in RHEL-8 the build root is as minimal as possible there's no 'udevadm' binary and thus our configure script hasn't found any:

From libvirt-4.5.0-24.module+el8.1.0+3205+41ff0a42 build.log:

checking for udevadm... no
checking for udevsettle... no

And therefore our virWaitForDevices() is a NO-OP and therefore we proceed to scanning LUNs before udev even created some nodes. Let me see if I can cook a patch that will resolve this.
BTW: This also explains why I was unable to reproduce this under GDB because stepping through lines gives system enough time to settle down.

Comment 2 Michal Privoznik 2019-05-17 09:55:11 UTC
Here we go:

https://www.redhat.com/archives/libvir-list/2019-May/msg00438.html

Comment 3 Michal Privoznik 2019-05-17 14:04:56 UTC
To POST:

3c8d5762a9 m4: Drop needless string checks
523b799d3c m4: Provide default value fore UDEVADM
2944dcb2de lib: Drop UDEVSETTLE
0cabcd98f1 virWaitForDevices: Drop confusing part of comment

v5.3.0-93-g3c8d5762a9

Comment 7 gaojianan 2019-07-09 06:22:52 UTC
Verified atï¼›
libvirt-daemon-driver-storage-rbd-4.5.0-30.virtcov.el8.x86_64                                                              
libvirt-daemon-driver-qemu-debuginfo-4.5.0-30.virtcov.el8.x86_64  

Steps to Reproduce:
1. Create a ramdisk backstore of 50M size, an ISCSI target and a LUN associated with that.

targetcli /backstores/ramdisk create test 50M
targetcli /iscsi create iqn.2019-09.cockpit.lan
targetcli /iscsi/iqn.2019-09.cockpit.lan/tpg1/luns create /backstores/ramdisk/test
targetcli /iscsi/iqn.2019-09.cockpit.lan/tpg1/ set attribute authentication=0 demo_mode_write_protect=0 generate_node_acls=1 cache_dynamic_acls=1


On my system the iscsi setup looks like that 
# targetcli ls
o- / ................................................................................................................ [...]
  o- backstores ..................................................................................................... [...]
  | o- block ......................................................................................... [Storage Objects: 0]
  | o- fileio ........................................................................................ [Storage Objects: 0]
  | o- pscsi ......................................................................................... [Storage Objects: 0]
  | o- ramdisk ....................................................................................... [Storage Objects: 1]
  |   o- test ....................................................................................... [(50.0MiB) activated]
  |     o- alua .......................................................................................... [ALUA Groups: 1]
  |       o- default_tg_pt_gp .............................................................. [ALUA state: Active/optimized]
  o- iscsi ................................................................................................... [Targets: 1]
  | o- iqn.2019-09.cockpit.lan .................................................................................. [TPGs: 1]
  |   o- tpg1 ......................................................................................... [gen-acls, no-auth]
  |     o- acls ................................................................................................. [ACLs: 1]
  |     | o- iqn.1994-05.com.redhat:8dd547fc8758 ......................................................... [Mapped LUNs: 1]
  |     |   o- mapped_lun0 ....................................................................... [lun0 ramdisk/test (rw)]
  |     o- luns ................................................................................................. [LUNs: 1]
  |     | o- lun0 ....................................................................... [ramdisk/test (default_tg_pt_gp)]
  |     o- portals ........................................................................................... [Portals: 1]
  |       o- 0.0.0.0:3260 ............................................................................................ [OK]
  o- loopback ................................................................................................ [Targets: 0]



2. Create a libvirt iscsi storage pool on the same machine with the following XML

# virsh pool-dumpxml my_iscsi_pool
<pool type='iscsi'>
  <name>my_iscsi_pool</name>
  <source>
    <host name='127.0.0.1' port='3260'/>
    <device path='iqn.2019-09.cockpit.lan'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
  </target>
</pool>

3. Confirm that the capacity is 50M
# virsh pool-dumpxml my_iscsi_pool 
<pool type='iscsi'>
  <name>my_iscsi_pool</name>
  <uuid>b585990a-42d3-4db2-9e8c-59655bfb7efa</uuid>
  <capacity unit='bytes'>52428800</capacity>
  <allocation unit='bytes'>52428800</allocation>
  <available unit='bytes'>0</available>
  <source>
    <host name='127.0.0.1' port='3260'/>
    <device path='iqn.2019-09.cockpit.lan'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
  </target>
</pool>


Worked as expected

Comment 9 errata-xmlrpc 2019-11-05 20:49:21 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/RHSA-2019:3345


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