On 12/23/2009 at 12:42 AM, Jiaju Zhang <jjzhang.li...@gmail.com> wrote: 
> On Tue, Dec 22, 2009 at 8:56 PM, Dejan Muhamedagic <deja...@fastmail.fm> 
> wrote: 
> > 
> >> Thank you for stepping forward! 
> > 
> > Jiaju, many thanks for the contribution. Any chance to also 
> > implement the suggested improvements? 
>  
> Sure :) 
> Thanks for all the suggestions. I'll improve it and update it soon. 

Another suggestion:

# diff -u IPaddr2 IPaddr2.new 
--- IPaddr2     2009-12-23 20:10:33.089860727 +1100
+++ IPaddr2.new 2009-12-23 20:17:31.656957776 +1100
@@ -532,13 +532,14 @@
 }
 
 save_tcp_connections() {
+       [ -z "$OCF_RESKEY_tickle_dir" ] && return
        mydir=$OCF_RESKEY_tickle_dir/`hostname`
        rm -f $mydir/*
        netstat -tn |egrep 
'^tcp[[:space:]]+[0-9]+[[:space:]]+[0-9]+[[:space:]]+[0-9\.]+:[0-9]+.*ESTABLISHED'
 |
                awk '{print $4" "$5}' |
                while read server client; do
                        ip=${server%:*}
-                       echo $client $server >> $mydir/$ip
+                       [ "$ip" == "$OCF_RESKEY_ip" ] && echo $client $server 
>> $mydir/$ip
                done
 }
 

My change might not be optimal (not sure what it'd do with IPv6),
but the idea is:

1) Do nothing if tickle_dir isn't specified.
2) Only save open connections to $OCF_RESKEY_ip (currently it saves
   open connections to all IPs active on the host)

Also, I suppose it's kind of obvious, but might be worth mentioning
in the tickle_dir metadata that the directory needs to be on shared
storage.

Thanks again,

Tim


-- 
Tim Serong <tser...@novell.com>
Senior Clustering Engineer, Novell Inc.



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

Reply via email to