Older Newer
Tue, 21 Feb 2006 19:18:23 . . . . 202-74-214-198.ue.woosh.co.nz
Mon, 28 Nov 2005 14:28:00 . . . . (oliwel)?
Sun, 27 Nov 2005 13:58:50 . . . . host-62-245-151-178.customer.m-online.net
Sun, 27 Nov 2005 13:44:11 . . . . host-62-245-151-178.customer.m-online.net
Sun, 27 Nov 2005 13:23:27 . . . . host-62-245-151-178.customer.m-online.net


Changes by last author:

Changed:
</code>
</code>

== Solution 4: Modifying Heartbeat's Drbddisk Script ==

This solution/principle is valid for the combination of Vserver + DRBD + Heartbeat, where the latter is used to transfer virtual servers between the nodes of a HA cluster. "Out of the box", Heartbeat will reboot the cluster node if it cannot unmount the vserver mount point when it tries to shut down a virtual server. Unfortunately, this happens rather often if there is more than one virtual server on a cluster. Every time a vserver is about to be shut down, the vserver itself is getting stopped, then its file system is unmounted, and the underlaying DRBD device is set into "secondary" state (to allow the other node of the cluster to take over the DRBD block device). Now, if there are any references to the vserver moint point remaining in the namespaces of any other running virtual server (copies from the master namespace when a vserver is started), switching the DRBD device into "secondary" mode will fail, and, alas, unmounting the mount point consequentially also. There goes your cluster node...

To cirumvent this problem I wrote a little script, which should be hooked into the Heartbeat DRBD control script "/usr/etc/ha.d/resource.d/drbddisk", right before the line "exec $DRBDADM secondary $RES" in the "stop" branch.

It removes the mount point of the virtual server that is about to be shut down from all running virtual server contextes:

<code>

VNSPACE=/usr/local/sbin/vnamespace

for CTX in `/usr/local/sbin/vserver-stat | tail +3 | 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

# here shall be the original line then (uncommented, of course ;-))

# exec $DRBDADM secondary $RES

</code>