On Tue, Jan 24, 2012 at 07:34:10PM +0100, Dejan Muhamedagic wrote:
> Hi Hideo-san,
> 
> On Tue, Jan 24, 2012 at 10:34:34AM +0900, [email protected] wrote:
> > Hi Dejan,
> > 
> > > > Now the ocft test fails:
> > > > 
> > > > 2012/01/23_21:39:40 ERROR: IP address [127.0.0.3] is a loopback
> > > > address, thus can not be preferred source address
> > > > 
> > > > Any idea how to update the ocft test case?
> > > 
> > > I try this problem, too.
> > 
> > I carried out ocf-tester with three cases.
> > 
> > Case1) I carry it out after improving an address by ifconfig command.
> > 
> > [root@rh57-3 ClusterLabs-resource-agents-7edbe1d]# ifconfig eth0:1 
> > 192.168.40.7 up
> > [root@rh57-3 ClusterLabs-resource-agents-7edbe1d]# ocf-tester -v -n 
> > IPsrcaddr -o ipaddress=192.168.40.7 
> > /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr
> > Beginning tests for /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr...
> > Testing permissions with uid nobody
> > Testing: meta-data
> [...] [Note to myself: drop the meta-data output]
> > ERROR: Setup problem: couldn't find command: gawk
> 
> Install gawk perhaps?
> 
> [...]
> > INFO: The ip route has been already set.(192.168.40.0/24, eth0, default via 
> > 192.168.40.1 dev eth0 )
> 
> Hmm, I saw different stuff:
> 
> ERROR: command 'ip route replace 10.2.13.0/24 169.254.0.0/16 dev eth0 src 
> 10.2.13.154' failed
> 
> Debugging:
> 
> + ip route replace 10.2.13.0/24 169.254.0.0/16 dev eth0 src 10.2.13.154
> Error: either "to" is duplicate, or "169.254.0.0/16" is a garbage.
> 
> The route list:
> 
> xen-d:~ # ip route list
> default via 10.2.13.1 dev eth0 
> 10.2.13.0/24 dev eth0  proto kernel  scope link  src 10.2.13.54 
> 127.0.0.0/8 dev lo  scope link 
> 169.254.0.0/16 dev eth0  scope link 
> 
> It seems like the last entry confuses the new calculation code.

It turns out that the problem is here (nothing to do with your
patch):

NETWORK=`ip route list dev $INTERFACE scope link|grep -o '^[^ ]*'`

Perhaps we should do:

NETWORK=`ip route list dev $INTERFACE match $ipaddress scope link|grep -o '^[^ 
]*'`

Opinions?

Thanks,

Dejan


> Cheers,
> 
> Dejan
> 
> > Testing: monitor
> > OK
> > Stopping resource
> > Testing: monitor
> > No preferred source address defined
> > Testing: stopping a stopped resource
> > INFO: No preferred source address defined, nothing to stop
> > Testing: monitor
> > No preferred source address defined
> > Checking for migrate_to action
> > usage: /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr 
> > {start|stop|status|monitor|validate-all|meta-data}
> > Checking for reload action
> > usage: /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr 
> > {start|stop|status|monitor|validate-all|meta-data}
> > * Your agent does not support the reload action (optional)
> > /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr passed all tests
> > 
> > 
> > Case2) I carry it out after improving an address by ip command.
> > [root@rh57-3 ClusterLabs-resource-agents-7edbe1d]# ip addr add 
> > 192.168.40.7/24 brd 192.168.40.255 dev eth0
> > [root@rh57-3 ClusterLabs-resource-agents-7edbe1d]# ocf-tester -v -n 
> > IPsrcaddr -o ipaddress=192.168.40.7 
> > /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr
> > Beginning tests for /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr...
> > Testing permissions with uid nobody
> > Testing: meta-data
> > Testing: meta-data
> > <?xml version="1.0"?>
> > <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
> > <resource-agent name="IPsrcaddr">
> > <version>1.0</version>
> > 
> > <longdesc lang="en">
> > Resource script for IPsrcaddr. It manages the preferred source address
> > modification. 
> > </longdesc>
> > <shortdesc lang="en">Manages the preferred source address for outgoing IP 
> > packets</shortdesc>
> > 
> > <parameters>
> > <parameter name="ipaddress" unique="0" required="1">
> > <longdesc lang="en">
> > The IP address. 
> > </longdesc>
> > <shortdesc lang="en">IP address</shortdesc>
> > <content type="string" default="" />
> > </parameter>
> > 
> > <parameter name="cidr_netmask">
> > <longdesc lang="en">
> > The netmask for the interface in CIDR format. (ie, 24), or in
> > dotted quad notation  255.255.255.0).
> > </longdesc>
> > <shortdesc lang="en">Netmask</shortdesc>
> > <content type="string" default=""/>
> > </parameter>
> > </parameters>
> > 
> > <actions>
> > <action name="start" timeout="20s" />
> > <action name="stop" timeout="20s" />
> > <action name="monitor" depth="0" timeout="20s" interval="10" />
> > <action name="validate-all" timeout="5" />
> > <action name="meta-data" timeout="5" />
> > </actions>
> > </resource-agent>
> > Testing: validate-all
> > Checking current state
> > No preferred source address defined
> > Testing: monitor
> > No preferred source address defined
> > Testing: monitor
> > ERROR: Setup problem: couldn't find command: gawk
> > Testing: start
> > Testing: monitor
> > OK
> > Testing: monitor
> > OK
> > Testing: notify
> > usage: /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr 
> > {start|stop|status|monitor|validate-all|meta-data}
> > * Your agent does not support the notify action (optional)
> > Checking for demote action
> > usage: /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr 
> > {start|stop|status|monitor|validate-all|meta-data}
> > * Your agent does not support the demote action (optional)
> > Checking for promote action
> > usage: /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr 
> > {start|stop|status|monitor|validate-all|meta-data}
> > * Your agent does not support the promote action (optional)
> > * Your agent does not support master/slave (optional)
> > Testing: stop
> > Testing: monitor
> > No preferred source address defined
> > Restarting resource...
> > Testing: monitor
> > OK
> > Testing: starting a started resource
> > INFO: The ip route has been already set.(192.168.40.0/24, eth0, default via 
> > 192.168.40.1 dev eth0 )
> > Testing: monitor
> > OK
> > Stopping resource
> > Testing: monitor
> > No preferred source address defined
> > Testing: stopping a stopped resource
> > INFO: No preferred source address defined, nothing to stop
> > Testing: monitor
> > No preferred source address defined
> > Checking for migrate_to action
> > usage: /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr 
> > {start|stop|status|monitor|validate-all|meta-data}
> > Checking for reload action
> > usage: /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr 
> > {start|stop|status|monitor|validate-all|meta-data}
> > * Your agent does not support the reload action (optional)
> > /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr passed all tests
> > 
> > Case3) I carry it out without improving an address.
> > [root@rh57-3 ClusterLabs-resource-agents-7edbe1d]# ocf-tester -v -n 
> > IPsrcaddr -o ipaddress=192.168.40.7 
> > /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr
> > Beginning tests for /usr/lib/ocf/resource.d/heartbeat/IPsrcaddr...
> > Testing permissions with uid nobody
> > Testing: meta-data
> > Testing: meta-data
> > <?xml version="1.0"?>
> > <!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
> > <resource-agent name="IPsrcaddr">
> > <version>1.0</version>
> > 
> > <longdesc lang="en">
> > Resource script for IPsrcaddr. It manages the preferred source address
> > modification. 
> > </longdesc>
> > <shortdesc lang="en">Manages the preferred source address for outgoing IP 
> > packets</shortdesc>
> > 
> > <parameters>
> > <parameter name="ipaddress" unique="0" required="1">
> > <longdesc lang="en">
> > The IP address. 
> > </longdesc>
> > <shortdesc lang="en">IP address</shortdesc>
> > <content type="string" default="" />
> > </parameter>
> > 
> > <parameter name="cidr_netmask">
> > <longdesc lang="en">
> > The netmask for the interface in CIDR format. (ie, 24), or in
> > dotted quad notation  255.255.255.0).
> > </longdesc>
> > <shortdesc lang="en">Netmask</shortdesc>
> > <content type="string" default=""/>
> > </parameter>
> > </parameters>
> > 
> > <actions>
> > <action name="start" timeout="20s" />
> > <action name="stop" timeout="20s" />
> > <action name="monitor" depth="0" timeout="20s" interval="10" />
> > <action name="validate-all" timeout="5" />
> > <action name="meta-data" timeout="5" />
> > </actions>
> > </resource-agent>
> > Testing: validate-all
> > Checking current state
> > No preferred source address defined
> > Testing: monitor
> > No preferred source address defined
> > Testing: monitor
> > ERROR: Setup problem: couldn't find command: gawk
> > Testing: start
> > RTNETLINK answers: Invalid argument
> > ERROR: command 'ip route replace 192.168.40.0/24 dev eth0 src 192.168.40.7' 
> > failed
> > * rc=1: Start failed.  Did you supply enough options with -o ?
> > Aborting tests
> > 
> > The third case thinks that it is right to become the error.
> > 
> > > > 2012/01/23_21:39:40 ERROR: IP address [127.0.0.3] is a loopback
> > > > address, thus can not be preferred source address
> > 
> > Which case is the test that you carried out?
> > 
> > Because the processing that the loopback address is not usable enters in 
> > IPsrcaddr, the error seems to be displayed.
> > 
> > (snip)
> >             if [ $1 -eq 127 ]; then
> >                 ocf_log err "IP address [$ip] is a loopback address, thus 
> > can not be preferred source address"
> >                 exit $OCF_ERR_CONFIGURED
> >             fi
> > (snip)
> > 
> > Processing to improve an address in ocf-tester is necessary to 
> > automatically carry it out.
> > 
> > Best Regards,
> > Hideo Yamauchi.
> > 
> > 
> > --- On Tue, 2012/1/24, [email protected] 
> > <[email protected]> wrote:
> > 
> > > Hi Dejan,
> > > 
> > > > > How about the patch of this place?
> > > > 
> > > > Applied. Thanks for the patch.
> > > 
> > > Many Thanks!!
> > > 
> > > > Now the ocft test fails:
> > > > 
> > > > 2012/01/23_21:39:40 ERROR: IP address [127.0.0.3] is a loopback
> > > > address, thus can not be preferred source address
> > > > 
> > > > Any idea how to update the ocft test case?
> > > 
> > > I try this problem, too.
> > > 
> > > Best Regards,
> > > Hideo Yamauchi.
> > > 
> > > 
> > > --- On Tue, 2012/1/24, Dejan Muhamedagic <[email protected]> wrote:
> > > 
> > > > Hi Hideo-san,
> > > > 
> > > > On Mon, Jan 23, 2012 at 09:09:57AM +0900, [email protected] 
> > > > wrote:
> > > > > Hi Dejan,
> > > > > 
> > > > > How about the patch of this place?
> > > > 
> > > > Applied. Thanks for the patch.
> > > > 
> > > > Now the ocft test fails:
> > > > 
> > > > 2012/01/23_21:39:40 ERROR: IP address [127.0.0.3] is a loopback
> > > > address, thus can not be preferred source address
> > > > 
> > > > Any idea how to update the ocft test case?
> > > > 
> > > > Cheers,
> > > > 
> > > > Dejan
> > > > 
> > > > 
> > > > 
> > > > > Best Regards,
> > > > > Hideo Yamauchi.
> > > > > 
> > > > > 
> > > > > --- On Mon, 2012/1/16, [email protected] 
> > > > > <[email protected]> wrote:
> > > > > 
> > > > > > Hi Dejan,
> > > > > > 
> > > > > > Thank you for comments.
> > > > > > 
> > > > > > > On Tue, Nov 29, 2011 at 02:49:24PM +0900, 
> > > > > > > [email protected] wrote:
> > > > > > > > Hi All,
> > > > > > > > 
> > > > > > > > We made a patch to IPsrcaddr.
> > > > > > > > 
> > > > > > > > This patch revises the next point.
> > > > > > > > 
> > > > > > > >  * Made modifications to carry out validate_all processing.
> > > > > > > 
> > > > > > > I'm not necessarily against it, but I wonder why. This would make
> > > > > > > monitor validate the environment every time. Is that really
> > > > > > > necessary? What was your motivation for this change?
> > > > > > 
> > > > > > I think that the handling of validate-all should be carried out in 
> > > > > > the same way as other RA.
> > > > > > Therefore we suggested this correction.
> > > > > >  * All RA is not same, but give readability and conservatism if it 
> > > > > >is similar constitution.
> > > > > > > 
> > > > > > > >  * Undefined and deleted the unused IPROUTE variable
> > > > > > > 
> > > > > > > OK.
> > > > > > > 
> > > > > > > >  * The find_interface_generic processing revised it to search 
> > > > > > > >it by ip command.
> > > > > > > 
> > > > > > > Good.
> > > > > > > 
> > > > > > > > However, we cannot test environment except Linux.
> > > > > > > > Therefore, we limited a condition to carry out processing to 
> > > > > > > > environment of Linux.
> > > > > > > 
> > > > > > > That's fine too.
> > > > > > 
> > > > > > Many Thanks!
> > > > > > Hideo Yamauchi.
> > > > > > 
> > > > > > 
> > > > > > > 
> > > > > > > Cheers,
> > > > > > > 
> > > > > > > Dejan
> > > > > > > 
> > > > > > > > (snip)
> > > > > > > > @@ -458,6 +440,10 @@
> > > > > > > >  
> > > > > > > >  ipaddress="$OCF_RESKEY_ipaddress"
> > > > > > > >  
> > > > > > > > +if [ "x$SYSTYPE" = "xLinux" ]; then
> > > > > > > > +    srca_validate_all
> > > > > > > > +fi
> > > > > > > > +
> > > > > > > > (snip)
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Please please confirm my correction. 
> > > > > > > > And please commit a correction. 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > 
> > > > > > > > Best Regards,
> > > > > > > > Hideo Yamauchi
> > > > > > > 
> > > > > > > > diff -r e4d9d86a9577 IPsrcaddr
> > > > > > > > --- a/IPsrcaddr    Mon Nov 28 20:02:26 2011 +0900
> > > > > > > > +++ b/IPsrcaddr    Mon Nov 28 20:03:07 2011 +0900
> > > > > > > > @@ -307,35 +307,14 @@
> > > > > > > >  #
> > > > > > > >  find_interface_generic() {
> > > > > > > >  
> > > > > > > > -  $IFCONFIG $IFCONFIG_A_OPT  |
> > > > > > > > -  while read ifname linkstuff
> > > > > > > > -  do
> > > > > > > > -    : Read gave us ifname = $ifname
> > > > > > > > -
> > > > > > > > -    read inet addr junk
> > > > > > > > -    : Read gave us inet = $inet addr = $addr
> > > > > > > > -
> > > > > > > > -    while
> > > > > > > > -      read line && [ "X$line" != "X" ]
> > > > > > > > -    do
> > > > > > > > -      : Nothing
> > > > > > > > -    done
> > > > > > > > -
> > > > > > > > -    case "$SYSTYPE" in
> > > > > > > > -      *BSD)
> > > > > > > > -        $IFCONFIG | grep "$BASEIP" -B`$IFCONFIG | grep -c 
> > > > > > > > inet` | grep "UP," | cut -d ":" -f 1
> > > > > > > > -        return 0;;
> > > > > > > > -      *)
> > > > > > > > -            : "comparing $BASEIP to $addr (from ifconfig)"
> > > > > > > > -        case $addr in
> > > > > > > > -          addr:$BASEIP)    echo $ifname; return $OCF_SUCCESS;;
> > > > > > > > -          $BASEIP)    echo $ifname; return $OCF_SUCCESS;;
> > > > > > > > -            esac
> > > > > > > > -        continue;;
> > > > > > > > -    esac
> > > > > > > > -
> > > > > > > > -  done
> > > > > > > > -  return $OCF_ERR_GENERIC 
> > > > > > > > +    local iface=`$IP2UTIL -o -f inet addr show | grep "\ 
> > > > > > > > $BASEIP" \
> > > > > > > > +            | cut -d ' ' -f2 | grep -v '^ipsec[0-9][0-9]*$'`
> > > > > > > > +        if [ -z "$iface" ]; then
> > > > > > > > +            return $OCF_ERR_GENERIC
> > > > > > > > +        else 
> > > > > > > > +            echo $iface
> > > > > > > > +            return $OCF_SUCCESS
> > > > > > > > +        fi
> > > > > > > >  }
> > > > > > > >  
> > > > > > > >  
> > > > > > > > @@ -409,7 +388,6 @@
> > > > > > > >  srca_validate_all() {
> > > > > > > >  
> > > > > > > >      check_binary $AWK
> > > > > > > > -    check_binary $IPROUTE
> > > > > > > >      check_binary $IFCONFIG
> > > > > > > >  
> > > > > > > >  #    The IP address should be in good shape
> > > > > > > > @@ -420,6 +398,10 @@
> > > > > > > >        exit $OCF_ERR_CONFIGURED
> > > > > > > >      fi
> > > > > > > >  
> > > > > > > > +    if ocf_is_probe; then
> > > > > > > > +      return $OCF_SUCCESS
> > > > > > > > +    fi
> > > > > > > > +
> > > > > > > >  #    We should serve this IP address of course
> > > > > > > >      if ip_status "$ipaddress"; then
> > > > > > > >        :
> > > > > > > > @@ -458,6 +440,10 @@
> > > > > > > >  
> > > > > > > >  ipaddress="$OCF_RESKEY_ipaddress"
> > > > > > > >  
> > > > > > > > +if [ "x$SYSTYPE" = "xLinux" ]; then
> > > > > > > > +    srca_validate_all
> > > > > > > > +fi
> > > > > > > > +
> > > > > > > >  findif_out=`$FINDIF -C`
> > > > > > > >  rc=$?
> > > > > > > >  [ $rc -ne 0 ] && {
> > > > > > > 
> > > > > > > > _______________________________________________________
> > > > > > > > Linux-HA-Dev: [email protected]
> > > > > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > > > > > > Home Page: http://linux-ha.org/
> > > > > > > 
> > > > > > >
> > > > > > 
> > > > > _______________________________________________________
> > > > > Linux-HA-Dev: [email protected]
> > > > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > > > Home Page: http://linux-ha.org/
> > > > 
> > > _______________________________________________________
> > > Linux-HA-Dev: [email protected]
> > > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > > Home Page: http://linux-ha.org/
> > > 
> > _______________________________________________________
> > Linux-HA-Dev: [email protected]
> > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> > Home Page: http://linux-ha.org/
> _______________________________________________________
> Linux-HA-Dev: [email protected]
> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
> Home Page: http://linux-ha.org/
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to