Subject: Re: [vserver] HA vserver in an active/active configuration
From: Christian Balzer <chibi@gol.com>
Date: Fri, 7 Mar 2008 17:49:16 +0900


Hello,

and just to give back something to community, here is a what I wound up
using to avoid the namespace mountpoint contention with DRBD, based on
solution 4 of: http://oldwiki.linux-vserver.org/advanced+DRBD+mount+issues

The modified stop section of the heartbeat drbddisk script:
---
    stop)
        # Kill off any vserver mounts that might hog this
        VNSPACE=/usr/sbin/vnamespace
        for CTX in `/usr/sbin/vserver-stat | tail -n +2 | awk '{print $1}'`
        do
            MPOINT="`$VNSPACE -e $CTX cat /proc/mounts | grep $RES | awk '{print $2}'`"
            echo Unmounting mount point $MPOINT from within context $CTX
            ### MOUNT POINT IS COMPULSORY. DEVICE NAME DOES NOT WORK!!!
            $VNSPACE -e $CTX /bin/umount $MPOINT || continue;
        done
        # exec, so the exit code of drbdadm propagates
        exec $DRBDADM secondary $RES
        ;;
---

Difference to the URL one is the "-n +2" bit for tail. 
The "-n" avoids a warning from tail about just "+N" going out of style. 
And the "+2" instead of +3 from the original was needed as my vserver-stat
(util-vserver 0.30.214-5) does not list either the 0 or 1 contexts. Which
also raises the question what would have happened on a machine with the old
script that DID run vtop or the likes at the time. ;)
Guess it could use some more sanity checks. ^^

Regards,

Christian
-- 
Christian Balzer        Network/Systems Engineer                NOC
chibi@gol.com   	Global OnLine Japan/Fusion Network Services
http://www.gol.com/