If you have a long interface name, such as "vlan1000", ifconfig cuts off
alias names so that it shows "vlan1000:" instead of "vlan1000:0". This is
on probably pretty much all Linux, but specifically we were using Debian
Etch. I presume that there would be a similar problem for >9 aliases on an
interface named something like "vlan999" or >99 aliases on an interface
named "vlan99".
The behavior is that "start" works, but stop tries to remove the alias from
"vlan1000:", which fails, leaving the IP up on the passive machine if you
have gracefully failed over (and STONITH doesn't kill the previously-active
node).
I tracked this down via the logs, and Scott Kleihege used his awk-fu to work
up the following patch. I'm not sure if you'll want to include this as it
relies on the "iproute2" program "ip" to be installed, as "ip addr ls"
doesn't seem to truncate the interface name. So it uses that to get the
interface name.
Sean
--
After I'm dead I'd rather have people ask why I have no monument than why
I have one. -- Cato the Elder
Sean Reifschneider, Member of Technical Staff <[EMAIL PROTECTED]>
tummy.com, ltd. - Linux Consulting since 1995: Ask me about High Availability
--- /usr/lib/ocf/resource.d/heartbeat/IPaddr 2006-11-29 21:45:38.000000000
-0600
+++ IPaddr 2007-10-12 01:00:48.000000000 -0500
@@ -348,25 +348,11 @@
#
find_interface_generic() {
ipaddr="$1"
- $IFCONFIG $IFCONFIG_A_OPT |
- while read ifname linkstuff
+ /bin/ip addr ls | $AWK "\$1 ~ /^inet/ && \$2 ~ /^$ipaddr(\/[0-9][0-9]*)?$/ \
+ { split(\$2, a, \"/\"); printf(\"%s %s\n\", a[1], \$NF) }" |
+ while read addr ifname
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 $ifname in
- *:*) ;;
- *) continue;;
- esac
-
+ : Read gave us addr = $addr ifname = $ifname
case "$SYSTYPE" in
*BSD)
@@ -429,8 +415,8 @@
grep "^$NIC:[0-9]" | sed 's%: .*%%'`
;;
*)
- IFLIST=`$IFCONFIG $IFCONFIG_A_OPT | \
- grep "^$NIC:[0-9]" | sed 's% .*%%'`
+ IFLIST=`/bin/ip addr ls | \
+ $AWK "\\$NF ~ /^$NIC:[0-9]/ { print \\$NF }"`
;;
esac
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems