ltsp_nbd: work around some udev/upstart issues?

Alkis Georgopoulos <[email protected]> Wed, 15 Sep 2010 11:34:05 +0300
Newsgroups gmane.linux.terminal-server.devel
Message-ID <1284539645.1617.19.camel@alkis>
I've had reports of fast clients not booting, possibly because of udev
or upstart problems, and with the following patch they were solved.

It just makes nbd-client retry connecting up to 10 times, if it fails.
On the problematic clients, it succeeds on the 2-4 try.

I don't have the experience to fix the udev/upstart problems, so I'm
asking about policy, should I commit this? It shouldn't cause any harm,
nfs too retries mounting if it fails...

Cheers,
Alkis


=== modified file 'client/initramfs/scripts/ltsp_nbd'
--- client/initramfs/scripts/ltsp_nbd	2010-08-23 19:42:59 +0000
+++ client/initramfs/scripts/ltsp_nbd	2010-09-15 07:32:01 +0000
@@ -84,7 +84,19 @@
     fi
 
     # Mount the root device
-    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
+    i=0
+    while [ $i -lt 10 ]; do
+        i=$(($i+1))
+        if nbd-client $NBD_CLIENT_ROOT_SERVER $NBD_ROOT_PORT /dev/nbd0; then
+            i=20
+            break
+        else
+            echo "Warning: failed to connect to NBD server $NBD_ROOT_SERVER:$NBD_ROOT_PORT, retrying..."
+            sleep 2
+        fi
+    done
+    if [ $i -eq 20 ]; then
         eval $(fstype /dev/nbd0)
         if [ -z "$FSTYPE" ]; then
             echo "Warning: unable to detect filesystem, assuming squashfs."



------------------------------------------------------------------------------
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