Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
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


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2577 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.