Red Hat Bugzilla – Bug 1356436
cannot pool-create iscsi pool because cannot successfully login iscsi target
Last modified: 2016-11-03 14:48:42 EDT
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
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 #
(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".
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.
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.
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
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