Control: merge 809320 809334 Control: tags 809320 + confirmed Hi Ritesh,
On 12/29/2015 11:47 AM, Ritesh Raj Sarraf wrote: > Hope you are doing good. And wish you belated Christman and a coming > Happy New Year. :-) Thanks, you as well. :) Unfortunately, I'm a bit busy right now until the 16th of January, so I won't be able to do much in the open-iscsi department until then. > I have been trying to play around with my VM setup, to build an iSCSI > SAN Boot Setup. In doing that, I noticed something odd. Perhaps you may > have some pointers. > > root@debian-sanboot:~# /etc/init.d/open-iscsi stop > [ ok ] Stopping open-iscsi (via systemctl): open-iscsi.service. So this calls systemctl stop open-iscsi - but that is always successful if systemd thinks the service didn't start up, so it assumes it doesn't have to stop anything. You did report this, so I'm merging both bug reports. As for the root cause: On 12/29/2015 01:48 PM, Ritesh Raj Sarraf wrote: > root@debian-sanboot:~# systemctl status -l open-iscsi > ● open-iscsi.service - Login to default iSCSI targets > Loaded: loaded (/lib/systemd/system/open-iscsi.service; enabled; vendor > preset: enabled) > Active: failed (Result: exit-code) since Tue 2015-12-29 17:52:34 IST; > 17min ago > Docs: man:iscsiadm(8) > man:iscsid(8) > Process: 558 ExecStart=/sbin/iscsiadm -m node --loginall=automatic > (code=exited, status=15) > Process: 554 ExecStartPre=/bin/systemctl --quiet is-active iscsid.service > (code=exited, status=0/SUCCESS) > Main PID: 558 (code=exited, status=15) > > Dec 29 17:52:35 debian-sanboot iscsiadm[558]: iscsiadm: Could not log into > all portals So what's going on is that iscsiadm -m node --loginall=automatic exits with exit code 15, which makes systemd think that the login to the iSCSI sessions didn't succeed. This is problematic in two ways: - the second ExecStart= line in the native service will not be called, so the compatibility-style auto-activation of LVM LVs won't work as expected (if you use lvmetad or don't use LVM you don't need it, so in that case it doesn't matter - and mounting is done by systemd itself anyway, so in modern setups the second ExecStart= script is completely unnecessary) - systemd will think the service is stopped, which is the root problem of your other bug that session logout doesn't occur According to the manpage, iscsiadm returns code 15 when a session is already logged in, so my guess is that you have a setup where one of the portals is activated in initramfs at boot - but is still configured to be logged into at boot. So one solution could be to use SuccessExitStatus=0 15 in the unit to say that 'already logged in' is not an error condition (and possibly others, I'd have to check the manpage) - but I think that is short-sighted, as this will prevent systemd from thinking the service is active and thus not terminate any active sessions (including manually activated ones) on shutdown. Therefore, I think the correct solution is to simply ignore errors from the iscsiadm call in the open-iscsi.service file, ExecStart=-/sbin/iscsiadm -m node --loginall=automatic (note the "=-" instead of "=") in order to make sure that systemd thinks the service is always active. This will only log errors to syslog/journal when they occur if iSCSI login fails - but not set the status of the service to failed - but it will make sure that shutdown works properly in all cases - and if there really is an error with iSCSI login, usually there will be followup errors anyway, because block devices don't appear, so the user will have feedback in any case. I would therefore suggest you try adding the minus sign to the ExecStart= line as described above - and unless you find any other issues, just upload -13 with that change to unstable. (Sorry, during the next 3 weeks I won't have time to test this myself.) Best regards, Christian
signature.asc
Description: OpenPGP digital signature