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 1356436 - cannot pool-create iscsi pool because cannot successfully login iscsi target
Summary: cannot pool-create iscsi pool because cannot successfully login iscsi target
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.3
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: John Ferlan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-07-14 06:34 UTC by yisun
Modified: 2016-11-03 18:48 UTC (History)
6 users (show)

Fixed In Version: libvirt-2.0.0-4.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-03 18:48:42 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 0 normal SHIPPED_LIVE Moderate: libvirt security, bug fix, and enhancement update 2016-11-03 12:07:06 UTC

Description yisun 2016-07-14 06:34:23 UTC
Description of problem:
cannot pool-create iscsi pool because cannot successfully login iscsi target

This is a regresssion issue caused by bug 1331552 commit 56057900dc53df490d953d56de1195ebfa025bdd, which use iscsiadm's "--op nonpersistent" during discovery of iSCSI targets. So when pool-creaet a iscsi pool, target record not added into node db, and then a target login will be failed. 



Version-Release number of selected component (if applicable):
libvirt-2.0.0-2.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. # cat iscsi.pool
<pool type='iscsi'>
  <name>iscsi</name>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <host name='iscsi_server_IP'/>
    <device path='iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
  </target>
</pool>

2. clean iscsi node db
# iscsiadm -m node -o delete

3.# virsh pool-create iscsi.pool   // pool-define && pool-build && pool-start will have the same error
error: Failed to create pool from iscsi.pool
error: internal error: Child process (iscsiadm --mode node --portal <iscsi_server_ip>,1 --targetname iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto --login) unexpected exit status 21: iscsiadm: No records found


4. # iscsiadm --mode node --target iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto --portal <iscsi_server_ip>:3260 -o new
New iSCSI node [tcp:[hw=,ip=,net_if=,iscsi_if=default] <iscsi_server_ip>,3260,-1 iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto] added


5. # virsh pool-create iscsi.pool 
Pool iscsi created from iscsi.pool



Actual results:
In step 3, cannot successfully create the iscsi pool, cause "iscsiadm -m discovery" with "--op nonpersistent" didn't add any target record into node db, this made the followup login failed.  

Expected results:
This function worked well in libvirt7.2. So we'd better keep the behavior consistent. Otherwise, we need to update document to clearly tell the user about the failure. 

Additional info:
We may add the cmd in step 4 into libvirt code as a workaround

Comment 2 John Ferlan 2016-07-15 21:20:20 UTC
There's a fine line between declaring this is a bug and testing has taken advantage of the environment knowing about step 2... It's competing requirements with bz 1331552...

The simple solution, don't do step2...  Not something that libvirt does.  Still, I suppose something could be done to do that "-o new" step or determine a way to make things work.

As an aside, doing step 2 on a host with a running pool gets:

# iscsiadm -m node -o delete
iscsiadm: This command will remove the record [iface: default, target: iqn.2013-12.com.example:iscsi-chap-netpool, portal: 192.168.122.1,3260], but a session is using it. Logout session then rerun command to remove record.
iscsiadm: Could not execute operation on all records: session exists
#

Comment 3 yisun 2016-07-18 03:03:51 UTC
(In reply to John Ferlan from comment #2)
> There's a fine line between declaring this is a bug and testing has taken
> advantage of the environment knowing about step 2... It's competing
> requirements with bz 1331552...
> 
> The simple solution, don't do step2...  Not something that libvirt does. 
> Still, I suppose something could be done to do that "-o new" step or
> determine a way to make things work.
> 
> As an aside, doing step 2 on a host with a running pool gets:
> 
> # iscsiadm -m node -o delete
> iscsiadm: This command will remove the record [iface: default, target:
> iqn.2013-12.com.example:iscsi-chap-netpool, portal: 192.168.122.1,3260], but
> a session is using it. Logout session then rerun command to remove record.
> iscsiadm: Could not execute operation on all records: session exists
> #

Hi John,
When a host has never connected to the iscsi server's targets, we can skip step 2 to reproduce this issue. And this is what I met with a clean test env at first. 
I put step 2 here because I already connected to the iscsi targets with this host when I wrote the description.  So step 2 to make sure the env is "clean".

Comment 4 John Ferlan 2016-07-18 11:38:22 UTC
I have posted a couple of patches:

http://www.redhat.com/archives/libvir-list/2016-July/msg00633.html

which use an alternate means to "discover" the targets.

Comment 5 John Ferlan 2016-07-28 12:41:28 UTC
Upstream patches were pushed:

$ git describe 5d8c31c6b202aa5ce4329042225bb40fec16baf9
v2.1.0-rc1-11-g5d8c31c
$ git show 
   iscsi: Establish connection to target via static target login
...
    Commit id '56057900' altered the discovery of iSCSI node targets by
    using the "--op nonpersistent". This caused issues for clean environments
    or if by chance a "-m node -o delete" was executed.
    
    Since each iSCSI Storage Pool has the required iSCSI target path, use
    that and the virISCSINodeNew API in order to generate the iSCSI node record.

Comment 8 yisun 2016-08-05 04:20:46 UTC
Verified on libvirt-2.0.0-4.el7.x86_64
PASSED


===== Scenario 1, pool-create ====

# iscsiadm -m node -o delete

# cat pool.iscsi
<pool type='iscsi'>
  <name>iscsi</name>
  <capacity unit='bytes'>0</capacity>
  <allocation unit='bytes'>0</allocation>
  <available unit='bytes'>0</available>
  <source>
    <host name='iscsi.server.ip'/>
    <device path='iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto'/>
  </source>
  <target>
    <path>/dev/disk/by-path</path>
  </target>
</pool>

# virsh pool-create pool.iscsi 
Pool iscsi created from pool.iscsi

# virsh vol-list iscsi
 Name                 Path                                    
------------------------------------------------------------------------------
 unit:0:0:1           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-1
 unit:0:0:2           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-2
 unit:0:0:3           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-3
 unit:0:0:4           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-4
 unit:0:0:5           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-5


# virsh pool-destroy iscsi
Pool iscsi destroyed


========Scenario 2, pool-define pool-build pool-start=======
# iscsiadm -m node -o delete


# virsh pool-define pool.iscsi 
Pool iscsi defined from pool.iscsi

# virsh pool-build iscsi
Pool iscsi built


# virsh pool-start iscsi
Pool iscsi started

# virsh vol-list iscsi
 Name                 Path                                    
------------------------------------------------------------------------------
 unit:0:0:1           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-1
 unit:0:0:2           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-2
 unit:0:0:3           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-3
 unit:0:0:4           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-4
 unit:0:0:5           /dev/disk/by-path/ip-10.66.5.88:3260-iscsi-iqn.2014-12.com.redhat:libvirt.shyu-qe-consumption-auto-lun-5

Comment 10 errata-xmlrpc 2016-11-03 18:48:42 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://rhn.redhat.com/errata/RHSA-2016-2577.html


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