LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   iSCSI on Ubuntu: working around boot order problems (https://www.linuxquestions.org/questions/linux-networking-3/iscsi-on-ubuntu-working-around-boot-order-problems-758684/)

windstrewn 09-30-2009 09:30 AM

iSCSI on Ubuntu: working around boot order problems
 
Hi everyone

I am currently working towards a stable iSCSI connection between Ubuntu server edition (testing with 64bit 8.04.3 LTS and 9.04) and a QNAP TS-291P.

A good basic set of instructions for iSCSI on Ubuntu 9.04 (which also works for 8.04) may be found on HowToForge.com.

During my testing I hit on the following Bug: boot order wrong for iscsi.
The last few postings of this thread claim that the bug was solved. However, my tests indicate the opposite!

The problem is that the open-iscsi daemon and the resulting iSCSI connections are started before the network is started. This setup must fail since iSCSI is a network protocol.

The easy part of the fix is moving the init script for open-iscsi further down in the boot order (as indicated by the valuable posting #15 of the aforementioned bug report):

Code:

mv /etc/rcS.d/S25open-iscsi /etc/rcS.d/S42open-iscsi
After this modification a pre-configured connection to an iSCSI target will be established reliably during startup.

The problem, however, is the shutdown procedure.

This is the relevant excerpt from /etc/init.d/open-iscsi:
Code:

stoptargets() {
        log_daemon_msg "Disconnecting iSCSI targets"
        sync
        # only logout if daemon is running, iscsiadm hangs otherwise
        if [ -s $PIDFILE ] && kill -0 `head -1 $PIDFILE` >/dev/null ; then
                $ADM -m node --logoutall=all
        fi

        log_end_msg 0
}

The crucial line is:

$ADM -m node --logoutall=all

where $ADM is replaced by iscsiadm.
This instruction doesn't seem to work!
I also tried executing the instruction manually at the command prompt. It doesn't work either.

If, however, I explicitely logout from my QNAP iSCSI target like so:
Code:

iscsiadm -m node --targetname "xxxxxxxx" --portal "xxx.xxx.xxx.xxx" --logout
the logout works perfectly.

I also introduced the explicit logout command into /etc/init.d/open-iscsi:

Code:

stoptargets() {
        log_daemon_msg "Disconnecting iSCSI targets"
        sync
        # only logout if daemon is running, iscsiadm hangs otherwise
        if [ -s $PIDFILE ] && kill -0 `head -1 $PIDFILE` >/dev/null ; then
                iscsiadm -m node --targetname "xxxxxxxx" --portal "xxx.xxx.xxx.xxx" --logout
                $ADM -m node --logoutall=all
        fi

        log_end_msg 0
}

This works, too.

Does anyone know, what the problem with the --logoutall=all command might be?
Why doesn't it work?

I'm grateful for your contributions. Thanks in advance. :hattip:

tapke 10-02-2009 12:33 AM

When you tried:
Code:

iscsiadm -m node --logout--all
Did it give any message?

tapke 10-02-2009 12:37 AM

Quote:

-U, --logoutall==[all,manual,automatic]
logout all sessions with the node or conn startup values passed in or all running sesssion, except ones marked onboot, if all is passed in.
This option is only valid for node mode (it is valid but not functional for session mode).
I believe *except ones marked onboot* should be the problem.

windstrewn 10-05-2009 12:49 AM

> Did it give any message?

No, that's one of the strange things. I couldn't find any special messages in the logs, nor did I get a message on the command line when typing the command directly.

> I believe *except ones marked onboot* should be the problem.

I did see this line in the manpage. However, the command was introduced into the init scripts by the Debian people... Do I know more about init scripts than them? - No, definitely not.
Yes, it is possible that this is the problem. I consider it unlikely, though.


Thank you for your replies.


All times are GMT -5. The time now is 07:03 PM.