Bug 643092 - Never forgets iscsi sessions & silently logs back in upon network activation
Summary: Never forgets iscsi sessions & silently logs back in upon network activation
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: libvirt
Version: 14
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-10-14 15:43 UTC by Daniel Berrangé
Modified: 2011-01-24 04:25 UTC (History)
9 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 652730 (view as bug list)
Environment:
Last Closed: 2011-01-24 04:25:10 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Clearer log of the command sequence to demonstrate problem (1.94 KB, text/plain)
2010-10-14 15:45 UTC, Daniel Berrangé
no flags Details

Description Daniel Berrangé 2010-10-14 15:43:22 UTC
Description of problem:
Every time i resume from suspend, previous iscsi session I've logged out off, get re-activated.

AFAICT, the iscsi initiator saves details of the iSCSI target in /var/lib/iscsi/nodes. Whenever network manager activates an interface (eg resuming from suspend), /etc/init.d/iscsi will login to any targets listed in /var/lib/iscsi/nodes, even if they were *not* logged into previously.

eg, 

[root@t500wlan ~]# iscsiadm -m session
iscsiadm: No active sessions.
[root@t500wlan ~]# find /var/lib/iscsi/nodes/
/var/lib/iscsi/nodes/
[root@t500wlan ~]# /sbin/iscsiadm --mode discovery --type sendtargets --portal 192.168.254.185:3260,1
192.168.254.185:3260,1 iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84
[root@t500wlan ~]# /sbin/iscsiadm --mode node --portal 192.168.254.185:3260,1 --targetname iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84 --loginLogging in to [iface: default, target: iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84, portal: 192.168.254.185,3260]
Login to [iface: default, target: iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84, portal: 192.168.254.185,3260] successful.
[root@t500wlan ~]# find /var/lib/iscsi/nodes/
/var/lib/iscsi/nodes/
/var/lib/iscsi/nodes/iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84
/var/lib/iscsi/nodes/iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84/192.168.254.185,3260,1
/var/lib/iscsi/nodes/iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84/192.168.254.185,3260,1/default
[root@t500wlan ~]# iscsiadm -m session
tcp: [10] 192.168.254.185:3260,1 iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84
[root@t500wlan ~]# /sbin/iscsiadm --mode node --portal 192.168.254.185:3260,1 --targetname iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84 --logout
Logging out of session [sid: 10, target: iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84, portal: 192.168.254.185,3260]
Logout of [sid: 10, target: iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84, portal: 192.168.254.185,3260] successful.
[root@t500wlan ~]# iscsiadm -m session
iscsiadm: No active sessions.
[root@t500wlan ~]# /etc/init.d/iscsi start
Starting iscsi:                                            [  OK  ]
[root@t500wlan ~]# iscsiadm -m session
tcp: [11] 192.168.254.185:3260,1 iqn.2004-04.com.qnap:ts-439proii:iscsi.berrangehome.bf6d84

It absolutely should *NOT* have activated the session in that last step, since I had explicitly logged out of the iscsi session.


Version-Release number of selected component (if applicable):
iscsi-initiator-utils-6.2.0.872-7.fc13.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Login to an iscsi session
2. Logout of the iscsi session
3. /etc/init.d/iscsi start
  
Actual results:
It activates sessions that were logged out of

Expected results:
Logged out sessions, remain logged out.

Additional info:

Comment 1 Daniel Berrangé 2010-10-14 15:45:42 UTC
Created attachment 453499 [details]
Clearer log of the command sequence to demonstrate problem

Bugzilla munged the line endings in the initial description. Attached a clearer copy of the command sequence.

Comment 2 Mike Christie 2010-10-14 20:25:00 UTC
/etc/init.d/iscsi start logs into all portals with the node.startup = automatic. If instead of that script controlling startup, you should mark the startup = manual.

If that does not help or what you were looking for, then we need something completely different, because this is just how the tools/daemon/script work. The iscsiadm login/logout command just tells the kernel to login/logout a sessions it does not control the /etc/init.d/iscsi script's startup behavior. And normally if you were to logout a session with iscsiadm then ran /etc/init.d/iscsi start, users expect the node.startup setting to indicate that the session should be logged in (users use the script to log into the sessions instead of running iscsiadm).

Comment 3 Mike Christie 2010-10-14 20:26:49 UTC
Oh yeah, to set the startup you can edit /etc/iscsi/iscsid.conf's node.startup, then rediscover the iscsi portals (when you discover the portals the new iscsid.conf setttings get picked up).

Or run iscsiadm to set the node.startup for existing records

iscsiadm -m node -o update -n node.startup -v manual

Comment 4 Daniel Berrangé 2010-10-15 10:04:10 UTC
IMHO startup = manual should be the default here. Merely running iSCSI sendtargets should not be causing the host to automatically login to the targets forever after, unless the admin explicitly asked for that behaviour.

Comment 5 Mike Christie 2010-10-16 22:53:15 UTC
(In reply to comment #4)
> IMHO startup = manual should be the default here. Merely running iSCSI
> sendtargets should not be causing the host to automatically login to the
> targets forever after, unless the admin explicitly asked for that behaviour.

They do try to login forever though. They login for whatever your initial login retries and timeouts are set at.

Also normally users set things up on the target so only the targets that are accessible to the initiator are returned in sendtargets discovery. So every target returned during discovery is one they want to log into (this is why the default for startup is automatic).

Comment 6 Mike Christie 2010-10-16 22:58:11 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > IMHO startup = manual should be the default here. Merely running iSCSI
> > sendtargets should not be causing the host to automatically login to the
> > targets forever after, unless the admin explicitly asked for that behaviour.
> 
> They do try to login forever though. They login for whatever your initial login
> retries and timeouts are set at.
> 

Ignore that part of the comment above. I thought you meant something different.

Comment 7 Daniel Berrangé 2010-11-12 16:28:39 UTC
In a SOHO environment where people are using something like a Netgear/QNap NAS to provide iSCSI, it is far less likely that the target list will be zoned per client machine. In any case, I've added code to libvirt to force node.startup=manual everytime 'sendtargets' is run to work about this debatable behaviour.

Comment 8 Daniel Berrangé 2010-11-12 16:29:09 UTC
Patch series upstream

http://www.redhat.com/archives/libvir-list/2010-November/msg00545.html

Comment 9 Daniel Veillard 2011-01-24 04:25:10 UTC
Should be available in F15, since we are not backporting to F14

Daniel


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