[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    Re: [Linux-ha-dev] patch for the drbd resource agent
From:       Lars Marowsky-Bree <lmb () suse ! de>
Date:       2006-04-27 19:53:59
Message-ID: 20060427195359.GA5498 () marowsky-bree ! de
[Download RAW message or body]

On 2006-04-27T16:06:47, Florian Knauf <f.knauf@mmkf.de> wrote:

> 
> I attached a small patch to the OCF resource agent to make it work with
> the last CVS. It's not particularily well tested, but it's simple enough
> and I haven't come across problems with it yet, so I don't expect any
> trouble with it.

Hey Florian, thanks a lot for bringing this uptodate with the recent
changes in the CRM m/s model!

(Ok, so they weren't that recent, but I just didn't find the time
myself. I really appreciate you doing this. It is somewhat satisfying
that they aren't all _that_ big though, that makes me feel less of a
dork myself ;-)

>  drbd_init() {
>  	DRBDADM=$(which drbdadm 2>/dev/null)
> -	CRM_MASTER=/usr/lib/heartbeat/crm_master
> +	CRM_MASTER=/usr/sbin/crm_master

Yep, this moved. Probably should be a @SBINDIR@ in the drbd.in, then
it'll be replaced correctly automatically (until crm_master moves again
to somewhere else ;-)

> @@ -309,24 +309,18 @@
>  
>  	drbd_get_status
>  
> -	if [ "$DRBD_STATE_LOCAL" = "Not configured" ]; then
> -		ocf_log debug "$RESOURCE monitor: resource not configured"
> -		return $OCF_NOT_RUNNING
> +	if [ "$DRBD_STATE_LOCAL" == "Not configured" ]; then
> +	    ocf_log debug "$RESOURCE monitor: resource not configured"
> +	    return $OCF_NOT_RUNNING
> +	elif [ "$DRBD_STATE_LOCAL" == "Primary" ]; then
> +	    return $OCF_RUNNING_MASTER
> +	elif [ "$DRBD_STATE_LOCAL" == "Secondary" ]; then
> +	    return $OCF_SUCCESS
> +	else
> +	    ocf_log err "$RESOURCE monitor: unexpected local state: $DRBD_STATE_LOCAL"
>  	fi
>  	
> -	if [ "$DRBD_STATE_LOCAL" != "Secondary" ] \
> -	&& [ "$DRBD_STATE_LOCAL" != "Primary" ]; then
> -		ocf_log err "$RESOURCE monitor: unexpected local state: $DRBD_STATE_LOCAL"
> -		return $OCF_ERR_GENERIC
> -	fi
> -
> -	ROLE="$OCF_RESKEY_role"
> -	if [ -n "$ROLE" ] && [ "$DRBD_STATE_LOCAL" != "$ROLE" ]; then
> -		ocf_log err "$RESOURCE monitor: wrong state: expected $ROLE != $DRBD_STATE_LOCAL"
> -		return $OCF_ERR_GENERIC
> -	fi
> -
> -	return $OCF_SUCCESS
> +	return $OCF_ERR_GENERIC
>  }
>  

Yes, this simplification clearly shows that introducing the two
additional exit codes for the master states (OCF_RUNNING_MASTER /
OCF_FAILED_MASTER) was clearly the right choice.


>  drbd_promote() {
> @@ -411,7 +405,7 @@
>  	post)
>  		case $n_op in
>  		start)
> -			if [ "$n_active_count" -eq 2 ]; then
> +			if [ "$n_active" -eq 2 ]; then

Ouch. Dumb typo on my part. Thanks for finding this.

Good job!


The one thing this doesn't deal with yet is handling the scenario where
both sides are up but disconnected (ie, not replicating). We're still
trying to handle this case well - we've had a discussion about this on
this list ("internal split-brain"), if you're interested, please look it
up and comment!


Sincerely,
    Lars Marowsky-Brée

-- 
High Availability & Clustering
SUSE Labs, Research and Development
SUSE LINUX Products GmbH - A Novell Business	 -- Charles Darwin
"Ignorance more frequently begets confidence than does knowledge"

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic