From owner-freebsd-questions@FreeBSD.ORG Wed Feb 15 17:25:14 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B6C2106566C for ; Wed, 15 Feb 2012 17:25:14 +0000 (UTC) (envelope-from ml@my.gd) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id E96748FC16 for ; Wed, 15 Feb 2012 17:25:12 +0000 (UTC) Received: by bkcjg1 with SMTP id jg1so1515019bkc.13 for ; Wed, 15 Feb 2012 09:25:11 -0800 (PST) Received: by 10.204.130.129 with SMTP id t1mr12002784bks.42.1329326711399; Wed, 15 Feb 2012 09:25:11 -0800 (PST) Received: from dfleuriot-at-hi-media.com ([83.167.62.196]) by mx.google.com with ESMTPS id o7sm7860619bkw.16.2012.02.15.09.25.08 (version=SSLv3 cipher=OTHER); Wed, 15 Feb 2012 09:25:10 -0800 (PST) Message-ID: <4F3BEA73.9060005@my.gd> Date: Wed, 15 Feb 2012 18:25:07 +0100 From: Damien Fleuriot User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.1) Gecko/20120208 Thunderbird/10.0.1 MIME-Version: 1.0 To: peter knezel References: <4F314AFB.8080901@my.gd> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQkjHzhMhzfe01j2WPB+4ckF8DyWKSSyNGG5hbhYNGMNreYVMqNGeXG2q5oxhu6NIkkrC292 Cc: freebsd-questions@freebsd.org Subject: Re: From analysis of a simple ifstated.conf to more compex example X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Feb 2012 17:25:14 -0000 Sorry about the late reply, didn't see yours. What about enabling CARP preemption to ensure that when a carp interface goes down, the whole set does ? On 2/7/12 9:13 PM, peter knezel wrote: > Hello Damien, > > I did read your example but cannot get idea from it. > For three interfaces you have much more possibilities. > > Imagine you start the server from uuu state which is equal to > net = '( "ifconfig -a -u |grep carp0 > /dev/null" every 3 && "ifconfig -a -u > |grep carp1 > /dev/null" every 3 && "ifconfig -a -u |grep carp2 > /dev/null" > every 3)' > > Now you put down one carp interface - so system is in state : > *state one:* > (duu) || (udu) || (uud) <----which is same as !$net > run script1.sh > go to twoff > > now imagine, you put down any other carp interface: > *state twoff: * > (dud) || (ddu) || (udd) > run script2.sh > go to two > > *state two: * > put all interfaces up > run script3.sh > go to state one > > it means, this is one of the possibilities system can behave (this > situation does not describe all possible states - I have taken this > special example.) > > Now if you want to put up after putting down one carp interface, you > fail since it is in state twoff. > Only of you put down second carp interface it goes to state two and if > you put both up, it will go to state one. > > This is where my ifstated.conf fails to work. > > Kind regards, > > Peter Knezel > > > On 7 February 2012 17:02, Damien Fleuriot > > wrote: > > On 2/7/12 3:36 PM, peter knezel wrote: > > Hello all, > > > > I would like to ask somebody to explain me how the ifstated works > according to > > the following configuration file. > > I have three virtual carp interfaces carp0,carp1 and carp2. > > > > I try to understand the following setting: > > The server is in state one (all carp interfaces are up) and if there > > is carp down of any: > > one (carp0 or carp1 or carp2), > > two ([carp0 and carp1] or [carp0 and carp2] or [carp1 and carp2]), > > three interfaces (carp 0 and carp1 and carp2), server > > runs the script testdown.sh and put the server into state two. > > If all carp interfaces are up, the server runs the testup.sh and set > > the state to one. > > > > That is my understanding. > > > > Is it the way the system works? > > Or am I wrong? > > > > === > > init-state one > > > > net = '( "ifconfig -a -u |grep carp0 > /dev/null" every 3 && > "ifconfig -a -u > > |grep carp1 > /dev/null" every 3 && "ifconfig -a -u |grep carp2 > > /dev/null" > > every 3)' > > > > state one { > > if ( ! $net ) { > > run "/usr/local/testdown.sh" > > set-state two > > } > > } > > > > state two { > > if ( $net ) { > > run "/usr/local/testup.sh" > > set-state one > > } > > } > > === > > > > Is there any possibility to define and set ifstated.conf that > reacts when: > > > > any one of the carp interfaces is down - followed by another any > > other carp interface down > > > > > > I tried to define states: > > > > duu ="!carp0.link.up && carp1.link.up && carp2.link.up" > > udu ="carp0.link.up && !carp1.link.up && carp2.link.up" > > uud ="carp0.link.up && carp1.link.up && !carp2.link.up" > > ddu ="!carp0.link.up && !carp1.link.up" > > dud ="!carp0.link.up && !carp2.link.up" > > udd ="!carp1.link.up && !carp2.link.up" > > > > and used them but somehow I cannot incorporate all state changes and > > include it in ifstated.conf. > > > > > Works fine here, did you not have any luck with the file I posted > earlier ? > _______________________________________________ > freebsd-questions@freebsd.org > mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org > " > >