Re: [Linux-ha-dev] [resource-agents] `findif` could be rewritten in shell (#53)

2012-02-07 Thread nozawat
Hi Lars,

Thank you for your comment.

An allotment of the same IP is not made now when IP is assigned to a
loopback device in IPv6addr; have a problem.

Which of IPaddr2 and IPv6addr do you think to revise it to solve this problem?

Mori-san asks it about this in the following ML.
http://www.gossamer-threads.com/lists/linuxha/dev/76429

Regards,
Tomo

2012年2月7日20:06 Lars Ellenberg :
> On Mon, Feb 06, 2012 at 09:51:46PM +0900, nozawat wrote:
>> Hi Lars
>>
>> I added IPv6 correspondence to a script of Lars.
>
> Which is nice, thank you ;-)
> but useless :(
> unless we also want to rewrite the currently written in C
> IPv6addr resource agent ...
>
> Which would also be nice, from my point of view.
> But I'm not sure if that is feasable.
>
>Cheers,
>
> --
> : Lars Ellenberg
> : LINBIT | Your Way to High Availability
> : DRBD/HA support and consulting http://www.linbit.com
> ___
> 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/
___
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/


Re: [Linux-ha-dev] PATCH: lxc RA to work with LXC-0.7.5

2012-02-07 Thread Dejan Muhamedagic
Hi Kazuyoshi-san,

On Mon, Feb 06, 2012 at 01:19:37PM +0900, Kazuyoshi Mii wrote:
> Hi,
> 
> I found lxc RA does not work with LXC-0.7.5 because the output of the
> command lxc-info used in RA has changed since LXC-0.7.5.
> 
> So I wrote two patches.
> 
> One patch fixes the above problem.
> 
> The other patch makes ocf_version_cmp in ocf-shellfuncs work for
> different version scheme, such as 0.7.4.2 and 0.7.5.
> 
> Patch attached.
> 
> Corresponding Github pull requests are #51 and #55.

Both patches pulled through github.

Many thanks!

Cheers,

Dejan

> Regards,
> Kazuyoshi
> 
> --
> Kazuyoshi MII
> 
> NTT Open Source Software Center
> NIPPON TELEGRAPH AND TELEPHONE CORPORATION

> diff --git a/heartbeat/lxc b/heartbeat/lxc
> index f534757..43e505a 100755
> --- a/heartbeat/lxc
> +++ b/heartbeat/lxc
> @@ -239,7 +239,10 @@ LXC_stop() {
>  }
>  
>  LXC_status() {
> - S=`lxc-info -n ${OCF_RESKEY_container}`
> + # run lxc-info with -s option for LXC-0.7.5 or later
> + local lxc_info_opt="-s"
> + ocf_version_cmp "`lxc-version | cut -d' ' -f 3`" 0.7.5 && 
> lxc_info_opt=""
> + S=`lxc-info $lxc_info_opt -n ${OCF_RESKEY_container}`
>   ocf_log debug "State of ${OCF_RESKEY_container}: $S"
>   if [[ "${S##* }" = "RUNNING" ]] ; then 
>   return $OCF_SUCCESS

> diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in
> index 811c536..e1cd33f 100644
> --- a/heartbeat/ocf-shellfuncs.in
> +++ b/heartbeat/ocf-shellfuncs.in
> @@ -462,6 +462,19 @@ ocf_ver2num() {
>   {for(i=1; i<=NF; i++) s=s*1000+$i; print s}
>   '
>  }
> +ocf_ver_level(){
> + echo $1 | awk -F'[.-]' '{print NF}'
> +}
> +ocf_ver_complete_level(){
> + local ver="$1"
> + local level="$2"
> + local i=0
> + while [ $i -lt $level ]; do
> + ver=${ver}.0
> + i=`expr $i + 1`
> + done
> + echo $ver
> +}
>  
>  # usage: ocf_version_cmp VER1 VER2
>  # version strings can contain digits, dots, and dashes
> @@ -474,8 +487,20 @@ ocf_ver2num() {
>  ocf_version_cmp() {
>   ocf_is_ver "$1" || return 3
>   ocf_is_ver "$2" || return 3
> - local v1=`ocf_ver2num $1`
> - local v2=`ocf_ver2num $2`
> + local v1=$1
> + local v2=$2
> + local v1_level=`ocf_ver_level $v1`
> + local v2_level=`ocf_ver_level $v2`
> + local level_diff
> + if [ $v1_level -lt $v2_level ]; then
> + level_diff=`expr $v2_level - $v1_level`
> + v1=`ocf_ver_complete_level $v1 $level_diff`
> + elif [ $v1_level -gt $v2_level ]; then
> + level_diff=`expr $v1_level - $v2_level`
> + v2=`ocf_ver_complete_level $v2 $level_diff`
> + fi
> + v1=`ocf_ver2num $v1`
> + v2=`ocf_ver2num $v2`
>   if [ $v1 -eq $v2 ]; then
>   return 1
>   elif [ $v1 -lt $v2 ]; then

> ___
> 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/

___
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/


Re: [Linux-ha-dev] [resource-agents] `findif` could be rewritten in shell (#53)

2012-02-07 Thread Lars Ellenberg
On Mon, Feb 06, 2012 at 09:51:46PM +0900, nozawat wrote:
> Hi Lars
> 
> I added IPv6 correspondence to a script of Lars.

Which is nice, thank you ;-)
but useless :(
unless we also want to rewrite the currently written in C
IPv6addr resource agent ...

Which would also be nice, from my point of view.
But I'm not sure if that is feasable.

Cheers,

-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
___
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/