Re: ltsp_nbd: work around some udev/upstart issues?

Jigish Gohil <[email protected]> Wed, 15 Sep 2010 17:29:19 +0530
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
On Wed, Sep 15, 2010 at 5:27 PM, Jigish Gohil <[email protected]> wrote:
>
> This is what kiwi's linuxrc does, pasting relevant parts here:
>

Missed this one:

function udevPending {
        local timeout=30
        if [ -x /sbin/udevadm ];then
                /sbin/udevadm trigger
                /sbin/udevadm settle --timeout=$timeout
        else
                /sbin/udevtrigger
                /sbin/udevsettle --timeout=$timeout
        fi
}

> #======================================
> # waitForBlockDevice
> #--------------------------------------
> function waitForBlockDevice {
>        # /.../
>        # function to check if the given block device
>        # exists. If not the function will wait until the
>        # device appears or the check counter equals 4
>        # ----
>        local device=$1
>        local check=0
>        udevPending
>        while true;do
>                if [ -b $device ] || [ $check -eq 4 ];then
>                        break
>                fi
>                Echo "Waiting for device $device to settle..."
>                check=`expr $check + 1`
>                sleep 2
>        done
> }
>
>  if [ -z "$nbdDevice" ];then
>                        nbdDevice="/dev/nbd0"
>  fi
>
> waitForBlockDevice $nbdDevice
>
>  Echo "Mounting NBD root system: $nbdServer $nbdPort [$nbdDevice]..."
>  if ! nbd-client $nbdServer $nbdPort $nbdDevice -persist;then
>                 systemException "Failed to setup $nbdDevice device" "reboot"
>  fi
>
> Full code here: http://git.berlios.de/cgi-bin/gitweb.cgi?p=kiwi;a=summary
>
> Cheers
>
> -J
>
>>
>>> -    if nbd-client $NBD_CLIENT_ROOT_SERVER $NBD_ROOT_PORT /dev/nbd0 ; then
>>> +    # Try up to 10 times with 2 sec interval because of udev/upstart bugs

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net