Discussion:
[Linux-ha-dev] Patch/rfc: Add multiple IP support for eDir88 RA
Sami Kähkönen
2013-06-28 12:40:02 UTC
Permalink
Hi,

Here is a small patch to enable multiple IP support for eDir88 RA. To
summarize, eDirectory supports multiple IP numbers in config file separated
by comma.
Example line in nds.conf:
n4u.server.interfaces=***@524,***@524

Current resource agent is unable to cope with such configurations.

This patch creates an array of IP:port configurations and checks them
individually. Tested in SLES 11 SP2 HA environment with one and multiple
IP's. All comments and additional testing are welcome.

Patch also in github: https://github.com/skahkonen/resource-agents

Regards,
Sami Kähkönen

--
@@ -238,14 +238,34 @@ eDir_status() { ** ocf_log err "Cannot
retrieve interfaces from $NDSCONF. eDirectory may not be correctly
configured."
** exit $OCF_ERR_GENERIC ** fi **-
NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd")
** ** - if [ "$NDSD_SOCKS" -eq 1 ] ; then **+ # In case of
multiple IP's split into an array
** + # and check all of them **+ IFS=', ' read -a IFACE2 <<< "$IFACE"
** + ocf_log debug "Found ${#IFACE2[@]} interfaces from $NDSCONF." **+
** + counter=${#IFACE2[@]} ** + ** + for IFACE in ${IFACE2[@]} *
* + do ** + ocf_log debug "Checking ndsd instance for $IFACE"
** + NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd") ** + *
* + if [ "$NDSD_SOCKS" -eq 1 ] ; then ** +
let counter=counter-1 ** +
ocf_log debug "Found ndsd instance for $IFACE" ** +
elif [ "$NDSD_SOCKS" -gt 1 ] ; then ** +
ocf_log err "More than 1 ndsd listening socket matched. Likely
misconfiguration of eDirectory."
** + exit $OCF_ERR_GENERIC ** + fi ** + done **+
** + if [ $counter -eq 0 ] ; then ** # Correct ndsd
instance is definitely running
** - # Further checks are superfluous (I think...) **-
return 0
** - elif [ "$NDSD_SOCKS" -gt 1 ] ; then **- ocf_log err
"More than 1 ndsd listening socket matched. Likely misconfiguration of
eDirectory."
** + ocf_log debug "All ndsd instances found." **+
return 0;
** + elif [ $counter -lt ${#IFACE2[@]} ]; then **+ ocf_log
err "Only some ndsd listening sockets matched, something is very
wrong."
** exit $OCF_ERR_GENERIC ** fi ** @@ -270,7
+290,7 @@ eDir_status() {
** exit $OCF_ERR_GENERIC ** fi ** ** -
# Instance is not running, but no other error detected. ** +
ocf_log debug "ndsd instance is not running, but no other error detected."
** return 1 ** }
Dejan Muhamedagic
2013-07-15 11:40:47 UTC
Permalink
Hi Sami,
Post by Sami Kähkönen
Hi,
Here is a small patch to enable multiple IP support for eDir88 RA. To
summarize, eDirectory supports multiple IP numbers in config file separated
by comma.
Current resource agent is unable to cope with such configurations.
This patch creates an array of IP:port configurations and checks them
individually. Tested in SLES 11 SP2 HA environment with one and multiple
IP's. All comments and additional testing are welcome.
Patch also in github: https://github.com/skahkonen/resource-agents
Sorry for the delay and many thanks for the patch. It looks good
to me. If you can, it would be good to make a pull request at
github.

Cheers,

Dejan
Post by Sami Kähkönen
Regards,
Sami Kähkönen
--
@@ -238,14 +238,34 @@ eDir_status() { ** ocf_log err "Cannot
retrieve interfaces from $NDSCONF. eDirectory may not be correctly
configured."
** exit $OCF_ERR_GENERIC ** fi **-
NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd")
** ** - if [ "$NDSD_SOCKS" -eq 1 ] ; then **+ # In case of
multiple IP's split into an array
** + # and check all of them **+ IFS=', ' read -a IFACE2 <<< "$IFACE"
* + do ** + ocf_log debug "Checking ndsd instance for $IFACE"
** + NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd") ** + *
* + if [ "$NDSD_SOCKS" -eq 1 ] ; then ** +
let counter=counter-1 ** +
ocf_log debug "Found ndsd instance for $IFACE" ** +
elif [ "$NDSD_SOCKS" -gt 1 ] ; then ** +
ocf_log err "More than 1 ndsd listening socket matched. Likely
misconfiguration of eDirectory."
** + exit $OCF_ERR_GENERIC ** + fi ** + done **+
** + if [ $counter -eq 0 ] ; then ** # Correct ndsd
instance is definitely running
** - # Further checks are superfluous (I think...) **-
return 0
** - elif [ "$NDSD_SOCKS" -gt 1 ] ; then **- ocf_log err
"More than 1 ndsd listening socket matched. Likely misconfiguration of
eDirectory."
** + ocf_log debug "All ndsd instances found." **+
return 0;
err "Only some ndsd listening sockets matched, something is very
wrong."
** exit $OCF_ERR_GENERIC ** fi ** ** -
# Instance is not running, but no other error detected. ** +
ocf_log debug "ndsd instance is not running, but no other error detected."
** return 1 ** }
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Dejan Muhamedagic
2013-07-15 14:32:11 UTC
Permalink
Post by Dejan Muhamedagic
Hi Sami,
Post by Sami Kähkönen
Hi,
Here is a small patch to enable multiple IP support for eDir88 RA. To
summarize, eDirectory supports multiple IP numbers in config file separated
by comma.
Current resource agent is unable to cope with such configurations.
This patch creates an array of IP:port configurations and checks them
individually. Tested in SLES 11 SP2 HA environment with one and multiple
IP's. All comments and additional testing are welcome.
Patch also in github: https://github.com/skahkonen/resource-agents
Sorry for the delay and many thanks for the patch. It looks good
to me. If you can, it would be good to make a pull request at
github.
I did that myself and put together the indentation patch. See

https://github.com/ClusterLabs/resource-agents/pull/283

Cheers,

Dejan
Post by Dejan Muhamedagic
Cheers,
Dejan
Post by Sami Kähkönen
Regards,
Sami Kähkönen
--
@@ -238,14 +238,34 @@ eDir_status() { ** ocf_log err "Cannot
retrieve interfaces from $NDSCONF. eDirectory may not be correctly
configured."
** exit $OCF_ERR_GENERIC ** fi **-
NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd")
** ** - if [ "$NDSD_SOCKS" -eq 1 ] ; then **+ # In case of
multiple IP's split into an array
** + # and check all of them **+ IFS=', ' read -a IFACE2 <<< "$IFACE"
* + do ** + ocf_log debug "Checking ndsd instance for $IFACE"
** + NDSD_SOCKS=$(netstat -ntlp | grep -ce "$IFACE.*ndsd") ** + *
* + if [ "$NDSD_SOCKS" -eq 1 ] ; then ** +
let counter=counter-1 ** +
ocf_log debug "Found ndsd instance for $IFACE" ** +
elif [ "$NDSD_SOCKS" -gt 1 ] ; then ** +
ocf_log err "More than 1 ndsd listening socket matched. Likely
misconfiguration of eDirectory."
** + exit $OCF_ERR_GENERIC ** + fi ** + done **+
** + if [ $counter -eq 0 ] ; then ** # Correct ndsd
instance is definitely running
** - # Further checks are superfluous (I think...) **-
return 0
** - elif [ "$NDSD_SOCKS" -gt 1 ] ; then **- ocf_log err
"More than 1 ndsd listening socket matched. Likely misconfiguration of
eDirectory."
** + ocf_log debug "All ndsd instances found." **+
return 0;
err "Only some ndsd listening sockets matched, something is very
wrong."
** exit $OCF_ERR_GENERIC ** fi ** ** -
# Instance is not running, but no other error detected. ** +
ocf_log debug "ndsd instance is not running, but no other error detected."
** return 1 ** }
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Sami Kähkönen
2013-07-15 15:19:19 UTC
Permalink
Hi Dejan,
Post by Dejan Muhamedagic
Post by Dejan Muhamedagic
Hi Sami,
Post by Sami Kähkönen
Hi,
Here is a small patch to enable multiple IP support for eDir88 RA. To
summarize, eDirectory supports multiple IP numbers in config file separated
by comma.
Current resource agent is unable to cope with such configurations.
This patch creates an array of IP:port configurations and checks them
individually. Tested in SLES 11 SP2 HA environment with one and multiple
IP's. All comments and additional testing are welcome.
Patch also in github: https://github.com/skahkonen/resource-agents
Sorry for the delay and many thanks for the patch. It looks good
to me. If you can, it would be good to make a pull request at
github.
I did that myself and put together the indentation patch. See
https://github.com/ClusterLabs/resource-agents/pull/283
You beat me to it by few minutes, as I was about to make the pull
request myself after checking all ocf_log -statements.

Thanks,

- Sami
Post by Dejan Muhamedagic
Cheers,
Dejan
Loading...