On 4/23/07, Alastair N. Young <[EMAIL PROTECTED]> wrote:
I'm also wrangling with this issue (getting drbd OCF to work in V2,
logically grouping master mode with the services that are on it)

One thing I've run into so far is that there appear to be some bugs in
the drbd ocf script.

1) In do_cmd() it uses "local cmd_out" immediately before taking the
result code from $?. This always succeeds (on CentOS 4.4 32 bit anyway).
Declaring this local in an earlier line returns the correct return code
from the drbdadm command from the function. As this return code is used
elsewhere, it helps that failure codes are passed back as intended.

2) There needs to be a wait loop after the module is loaded, same as is
in the drbd distributed /etc/init.d/drbd script. I inserted this into
drbd_start() (UDEV_TIMEOUT is set in the script header to 10)

            # make sure udev has time to create the device files
            for RESOURCE in `$DRBDADM sh-resources`; do
                for DEVICE in `$DRBDADM sh-dev $RESOURCE`; do
                    UDEV_TIMEOUT_LOCAL=$UDEV_TIMEOUT
                    while [ ! -e $DEVICE ] && [ $UDEV_TIMEOUT_LOCAL -gt
0 ] ; do
                        sleep 1
                        UDEV_TIMEOUT_LOCAL=$(( $UDEV_TIMEOUT_LOCAL-1 ))
                    done
                done
            done

It takes several seconds after the modload returns for the /dev/drbd0
device to appear - and nothing works until it does.

3) A similar timer is needed in drbd_promote as drbdadm won't let you
"Primary" until the other is not "Primary". I found that hearbeat was
firing off the promote on "b" slightly before the "demote" on "a",
causing a failure.

I added this: (REMOTE_DEMOTE_TIMEOUT is set in the script header to 10)

 drbd_get_status
 DEMOTE_TIMEOUT_LOCAL=$REMOTE_DEMOTE_TIMEOUT
 while [ "x$DRBD_STATE_REMOTE" = "xPrimary" ] && [ $DEMOTE_TIMEOUT_LOCAL
-gt 0 ] ; do
    sleep 1
    DEMOTE_TIMEOUT_LOCAL=$(( $DEMOTE_TIMEOUT_LOCAL-1 ))
    drbd_get_status
 done

With these changes I was able to get drbd to start, stop and migrate
cleanly when I tweaked the location scores.

Getting the services dependent on that disk to do the same is still an
open question :-)

you mean colocating with the version thats in "master" mode?

My modified drbd ocf script is attached, use at your own risk.

If you can resend as a diff I'll make sure lmb sees it and
incorporates any changes
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to