Comments (4)
Taking this to the mailing list as well, to give it a wider audience ...
On Tue, Jan 31, 2012 at 07:56:56AM -0800, b-a-t wrote:
Referring to the #52 I got the idea that shell script for finding
interface by IP address could be better solution than parsing routing
table in C.For (most) Linux distributions 'ip' command is a part of the standard installation and:
# ip route get 10.0.0.220 10.0.0.220 dev eth1 src 10.0.0.106gives better and more portable results.
For FreeBSD(and Solaris I guess):
We can ignore non-Linux for IPaddr2, that is already linux specific.
Even parsing of '/proc/net/route' is easier in shell, so I see no good
reason for quite complex and not flexible C binary for these
purpose(except the speed, possibly).If this idea gets support I can try to write such a replacement.
"once upon a time" I started something like that already,
just for fun. But then left it alone for quite some time,
because, well, if it ain't broken, don't fix it...
I'm not sure why we would care to specify an explicit broadcast address,
so we probably should not try to guess it (the kernel knows better, anyways)
and only put it into the command line if it really was passed in via
configuration parameters, in case there actually is a use case for that.
findif seems to have a few heuristics, which seem to override the input?
Not sure here.
There is also the hack-ish "LVS support" stuff in the script,
we need to make sure that does not break.
Nor any other aspect of "unusual" usage.
Anyways, it may be a starting point:
findif()
{
local match
# FIXME: if all is specified, why would we try to second guess?
# just use the input, and if it fails, it fails?
# non-local, "return" values
NIC= NETMASK=
BRDCAST="$OCF_RESKEY_broadcast"
# FIXME just make sure you drop the "brd $BRDCAST"
# from the ip addr add command if $BRDCAST is empty,
# and the kernel will do the right thing. Or so me thinks...
# Also see below, where we try to second guess BRDCAST.
match="$OCF_RESKEY_ip"
# ip actually does not care if the mask is cidr or dotted quad,
# as long as it is a mask.
# No mask implies "/32" (for the match, only).
# The "match" in "ip route list match ..." will find the best (longest prefix) route.
[ -n "$OCF_RESKEY_cidr_netmask" ] && match=$match/$OCF_RESKEY_cidr_netmask
# FIXME: what if the guessed nic,
# and the requested nic, do not match?
# Would tools/findif.c have ignored the input in that case?
# Should the RA return $OCF_ERR_CONFIGURED in that case?
### FIXME ### [ -n "$OCF_RESKEY_nic" ] && match="$match dev $OCF_RESKEY_nic"
# Only routes with scope link.
set -- `ip -o -f inet route list match $match scope link`
if [ $# = 0 ] ; then
# possibly need to add special case for 127.x.y.z
# at least tools/findif.c has one
case $OCF_RESKEY_ip in
127.*)
set -- `ip -o -f inet route list match $match table local scope host`
# prints "local" as first word
shift
esac
fi
# Still nothing? Too bad.
[ $# = 0 ] && return 1
# paranoia
case $1 in
*/*) : OK ;;
*)
# No slash should only happen for table local, no mask
# (or /32), and address already present, and even then
# it should not show up as first line of output...
# If we cannot guess the netmask, you need to specify it.
return 1 ;;
esac
NIC=$3
NETMASK=${1#*/}
: == DEBUG == $NIC / $NETMASK ==
# Do we really need to guess the broadcast? Why?
# We could try to guess it from the primary address on the nic
# but actually that seems pointless?
set -- `ip -o -f inet addr show dev $NIC primary`
# this really should have worked, always!?
# for 127.x.y.z, there usually won't be a broadcast address
[ "$5" = brd ] && BRDCAST=$6
: == DEBUG == brd $BRDCAST ==
return 0
}
try it:
set -vx
OCF_RESKEY_ip=10.9.9.99 findif
OCF_RESKEY_ip=127.1.2.3/27 findif
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
from resource-agents.
Thanks, Lars, for participation and inspiration! Where I can join (what?) mailing list to take a part in the discussion?
I'm not regular user of pacemaker/corosync/ra, so not really familiar with the surrounding community.
Thanks,
Timur.
from resource-agents.
On Thu, Feb 02, 2012 at 02:48:14AM -0800, Timur Bakeyev wrote:
Thanks, Lars, for participation and inspiration! Where I can join
(what?) mailing list to take a part in the discussion?
I'm not regular user of pacemaker/corosync/ra, so not really familiar
with the surrounding community.
Discussion of patches,
resource agents, "cluster glue", heartbeat etc:
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
User list, slightly skewed to pacemaker on heartbeat stack
http://lists.linux-ha.org/mailman/listinfo/linux-ha
Pacemaker list, all issues pacemaker:
http://oss.clusterlabs.org/mailman/listinfo/pacemaker
There are more
(e.g. corosync specific, drbd specific,
or specific for certain use cases).
Most people on linux-ha-dev are also subscribed on both other lists.
I guess most people on linux-ha are also on pacemaker,
not sure if that is true the other way around.
We also hang out on freenode,
#linux-ha (started as heartbeat/pacemaker channel)
#linux-cluster (started as cman/rhcs channel),
Today, I guess regulars are on both.
We probably should update the README...
Lars
from resource-agents.
I'm closing this as pull request #152 and #156 have been merged.
from resource-agents.
Related Issues (20)
- mysql: variable master_host empty on slave reboot
- Are awsvip and awseip still supported resources agents for RHEL HA? HOT 2
- awsvip versus AWS Policy HOT 3
- nothing provides /bin/ps needed by resource-agents-4.11.0 HOT 1
- WARNING: Can't get <node-name> xlog location. HOT 6
- ZFS promotion not working HOT 10
- Occasional false positive "down" reports from IPv6addr "monitor" action
- ZFS can't migrate to other node (cannot open pool: no such pool) HOT 2
- ERROR: LXC container name not set! HOT 23
- How to use the parameter of monitor_script?
- Unable to get metadata for resource agent 'stonith:fence_watchdog' (SyntaxError:JSON.parse:unexpected character at line 1) HOT 2
- master-pgsql attribute disappear HOT 1
- AWS Pacemaker awsvip failing with different errors HOT 4
- Resource agent - AWS Lambda support HOT 2
- Postfix RA continuously fails validate check HOT 1
- iSCSITarget - don't create default portal HOT 4
- resource-agents/heartbeat/ZFS - '-f' to option HOT 1
- "ocf : heartbeat : docker" does not exists in resource-agent v4.10 HOT 1
- How can I create a galera resource with two nodes?
- Filesystem in RHEL9.3 takes considerably longer to complete its stop operation compared to RHEL9.2. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from resource-agents.