[DRBD-user] drbdadm robustness :-(

Lars Ellenberg Lars.Ellenberg at linbit.com
Mon Feb 19 14:24:22 CET 2007

Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.

/ 2007-02-19 13:00:42 +0100
\ Lars Marowsky-Bree:
> Hi,
> I've succeeded at making drbd work as a master-slave resource in
> heartbeat v2 now. So far, so good.
> However, drbdadm makes it exceptionally hard and annoying to parse its
> output, which means I end up having to filter and post-process it
> heavily, none of which is going to make it very easy to maintain the
> scripts.
> - The header printed when __DRBD_NODE__ is found in the environment is
>   totally useless.
> - When asking drbdadm about the state of a resource not listed locally,
>   it prints warnings about the other resources. That's very annoying:
>   # drbdadm state r1 ; echo $?
>   /etc/drbd.conf:118: in resource r0, on node_0 { ... } ... on node_1 {
>   ... }:
>           There are multiple host sections for the peer.
> 	  Maybe misspelled local host name 'xen-1'?
>   /etc/drbd.conf:1: in resource r0:
> 	  missing section 'on xen-1 { ... }'.
>   10
>   _Yes_, I know, because __DRBD_NODE__ is not going to be set here,
>   because I'm asking about a different resource!

I want drbdadm to warn you about possible typos.
otherwise we'd get tons of complaints about it not working,
because someone mistyped a hostname.

you should not use drbd.conf for resources that are not relevant for the
node it is on. you should not use one identical drbd.conf for 8 hosts.

did you know that drbdadm even takes a configuration file as argument?

> - Even when this works, I get
> 	xen-1:~ # __DRBD_NODE__=node_0 drbdadm state r1 ; echo $?
> 	   found __DRBD_NODE__ in environment
> 	   PRETENDING that I am >>node_0<<
> 	'r1' not defined in your config.
>   wouldn't it be more consistent if this consisted of a single "Not
>   defined"?

this "feature" is undocumented and intended primarily for being able to
syntax check the drbd.conf attached to support requests on my local work

> - When the drbd module is not loaded, I get back a warning and exit code
>   20, shouldn't this be an "Not loaded"/"Not configured" as well?

I don't know? should it?

> - drbdadm doesn't propagate back error codes. Even when drbdsetup fails
>   (drbdadm primary, for example), it still exits with 0 - success.
>   ioctl(,SET_STATE,) failed: Permission denied
>   Partner is already primary
>   Command '/sbin/drbd setup /dev/drbd0 primary' terminated with exit code 20
>   drbdadm aborting
>   rc=0

this is a valid bug report then.

> - drbdadm disconnect seems to also demote a primary; I'd expect it to
>   just disconnect it from the secondary?

I don't believe this until proven otherwise. (read: works for me)

> I already mailed about some of these to the -dev list on Date: Fri, 26
> Jan 2007 16:24:08 +0100, but didn't receive any replies yet ...
> I'm not clear how to proceed.

write a whishlist / requirements for what do you want to do with it,
and how do you want it to behave when used for this and that,
and how you want it to behave when used against a bad configuration
(one with syntax or logical mistakes).

> Some of these are clear bugs (ie, error propagation), but is drbdadm the
> tool I should be using - in which case it probably needs to be made more
> useful for scripting, maybe with a -q switch -, or do I need to call
> drbdsetup directly, which would complicate my scripts in other ways?

if you want drbdadm to be able to cope with a configuration that
contains resource sections for many different host combinations,
then you have to patch it. it is not intended to do so.

you probably could split this into multiple configuration files,
each describing _one_ host pair.

I still think you are misusing drbd, but you did not exactly describe
what you intend to do, so I may be wrong.

: Lars Ellenberg                            Tel +43-1-8178292-0  :
: LINBIT Information Technologies GmbH      Fax +43-1-8178292-82 :
: Vivenotgasse 48, A-1120 Vienna/Europe    http://www.linbit.com :
please use the "List-Reply" function of your email client.

More information about the drbd-user mailing list