Seeing recent activity on the STONITH IPMILAN implementation of 2.x, I
thought I would take this opportunity to repost some patches I developed
for the 1.2.5 release of heartbeat. I did not see any comments on my
earlier posts, so I don't know if they got incorporated into the
heartbeat code repository.
These patches fix similar compile problems with the 1.x code and allow
IPMI to be used as a STONITH device on 1.x releases with Red Hat 4
distributions.
The wrong structure was being used in the interface to the IPMI
library. The rsp_handler function should take an ipmi_msgi_t type not
ipmi_msg_t. Further, the wrong argument to the IPMI power control
commands were being used. This caused STONITH to send ON when it should
have sent OFF and vice versa.
The interface used by STONITH is also available in the 1.4.4 branch of
IPMILAN. One function did change names, but the functionality is
equivalent for our purposes, so allowing STONITH to compile against
1.4.4 allows a straight up compile against the libraries shipped with
Red Hat 4.
Phil P.
--
Philip Pokorny, RHCE, Chief Arch. & Sr. Dir. HW & Field Eng.
Tel: 415-954-2823 Cell: 415-370-0835
Fax: 415-954-2899 Toll Free: 888-PENGUIN
PENGUIN COMPUTING, INC.
www.penguincomputing.com
--- heartbeat-1.2.5/configure.in.orig 2006-08-03 04:12:16.000000000 -0700
+++ heartbeat-1.2.5/configure.in 2007-09-18 22:45:20.000000000 -0700
@@ -625,9 +625,9 @@
AC_CHECK_HEADERS(vacm_client_api.h)
AC_CHECK_HEADERS(curl/curl.h)
-AC_MSG_CHECKING(For libOpenIPMI version 2 or greater)
+AC_MSG_CHECKING(For libOpenIPMI version 1.4.4 or greater)
AC_TRY_COMPILE([#include <OpenIPMI/ipmiif.h>],
-[ #if (OPENIPMI_VERSION_MAJOR < 2 )
+[ #if (OPENIPMI_VERSION_MAJOR < 1 ) || (OPENIPMI_VERSION_MINOR < 4) || (OPENIPMI_VERSION_RELEASE < 4)
#error "Too Old"
#endif ],
AC_MSG_RESULT("yes")
--- heartbeat-1.2.5/configure.orig 2006-08-13 22:00:14.000000000 -0700
+++ heartbeat-1.2.5/configure 2007-09-18 22:54:15.000000000 -0700
@@ -28927,8 +28927,8 @@
done
-echo "$as_me:$LINENO: checking For libOpenIPMI version 2 or greater" >&5
-echo $ECHO_N "checking For libOpenIPMI version 2 or greater... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking For libOpenIPMI version 1.4.4 or greater" >&5
+echo $ECHO_N "checking For libOpenIPMI version 1.4.4 or greater... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
@@ -28939,7 +28939,7 @@
int
main ()
{
- #if (OPENIPMI_VERSION_MAJOR < 2 )
+ #if (OPENIPMI_VERSION_MAJOR < 1 ) || (OPENIPMI_VERSION_MINOR < 4) || (OPENIPMI_VERSION_RELEASE < 4)
#error "Too Old"
#endif
;
--- heartbeat-1.2.5/lib/plugins/stonith/ipmilan.c.orig 2004-12-01 18:02:42.000000000 -0800
+++ heartbeat-1.2.5/lib/plugins/stonith/ipmilan.c 2007-09-19 22:04:23.000000000 -0700
@@ -206,10 +206,11 @@
nd = (struct ipmilanDevice *)s->pinfo;
node = nd->hostlist;
-#if 0
+#if 0
do {
- ret = send_ipmi_msg(node, ST_IPMI_STATUS);
- if (ret) {
+ int rv ;
+ rv = do_ipmi_cmd(node, ST_IPMI_STATUS);
+ if (rv) {
syslog(LOG_INFO, _("Host %s ipmilan status failure."), node->hostname);
ret = S_ACCESS;
} else {
@@ -218,7 +219,7 @@
node = node->next;
} while (node);
-#endif
+#endif
return ret;
}
--- heartbeat-1.2.5/lib/plugins/stonith/ipmilan_command.c.orig 2007-09-19 21:23:34.000000000 -0700
+++ heartbeat-1.2.5/lib/plugins/stonith/ipmilan_command.c 2007-09-19 22:33:16.000000000 -0700
@@ -58,7 +58,7 @@
} chassis_control_request_t;
void dump_msg_data(ipmi_msg_t *msg, ipmi_addr_t *addr, char *type);
-void rsp_handler(ipmi_con_t *ipmi, ipmi_msg_t *rsp);
+int rsp_handler(ipmi_con_t *ipmi, ipmi_msgi_t *rsp);
void send_ipmi_cmd(ipmi_con_t *con, int request);
@@ -126,29 +126,28 @@
*
*/
-void
-rsp_handler(ipmi_con_t *ipmi, ipmi_msg_t *rsp)
+int
+rsp_handler(ipmi_con_t *ipmi, ipmi_msgi_t *rsp)
{
int rv;
- int * request;
+ int request;
- request = (void *) rsp->data;
+ request = (long) rsp->data1;
#if 0
dump_msg_data(rsp, addr, NULL);
#endif
- rv = rsp->data[0];
+ rv = rsp->msg.data[0];
/* some IPMI device might not issue 0x00, success, for reset command.
instead, a 0xc3, timeout, is returned. */
if (rv == 0x00 ||
- (rv == 0xc3 && *request <= ST_POWEROFF && *request >= ST_GENERIC_RESET ) ) {
+ ((rv == 0xc3 || rv == 0xff) && request == ST_GENERIC_RESET) ) {
gstatus = S_OK;
} else {
gstatus = S_RESETFAIL;
}
- free(request);
- return;
+ return 0;
}
void
@@ -159,7 +158,7 @@
ipmi_msg_t msg;
struct ipmi_system_interface_addr *si;
int rv;
- ipmi_msg_t msgi;
+ ipmi_msgi_t *rspi;
// chassis control command request is only 1 byte long
unsigned char cc_data = POWER_CYCLE;
@@ -176,11 +175,11 @@
switch (request) {
case ST_POWERON:
- cc_data = POWER_DOWN;
+ cc_data = POWER_UP;
break;
case ST_POWEROFF:
- cc_data = POWER_UP;
+ cc_data = POWER_DOWN;
break;
case ST_GENERIC_RESET:
@@ -199,12 +198,17 @@
return;
}
- msgi.data = (void *) malloc(sizeof(int));
- *((unsigned char *)msgi.data) = request;
- rv = con->send_command(con, &addr, addr_len, &msg, (ipmi_ll_rsp_handler_t) rsp_handler, (void *) &msgi);
- if (rv == -1) {
- syslog(LOG_ERR, "Error sending IPMI command: %x\n", rv);
+ rspi = calloc(1, sizeof(ipmi_msgi_t));
+ if (NULL == rspi) {
+ syslog(LOG_ERR, "Error sending IPMI command: Out of memory\n");
gstatus = S_ACCESS;
+ } else {
+ rspi->data1 = (void *) (long) request;
+ rv = con->send_command(con, &addr, addr_len, &msg, rsp_handler, rspi);
+ if (rv == -1) {
+ syslog(LOG_ERR, "Error sending IPMI command: %x\n", rv);
+ gstatus = S_ACCESS;
+ }
}
return;
@@ -295,7 +299,7 @@
return S_ACCESS;
}
- /* in the OpenIPMI 1.3.x implementation the callback function was
+ /* In the OpenIPMI 1.3.x implementation the callback function was
* called set_con_change_handler(), now with the OpenIPMI 2.0.x
* implementation it has changed to add_con_change_handler(). Check out:
*
--- heartbeat-1.2.5/lib/plugins/stonith/ipmilan_command.c.orig 2007-09-19 03:42:34.000000000 -0700
+++ heartbeat-1.2.5/lib/plugins/stonith/ipmilan_command.c 2007-09-19 03:43:23.000000000 -0700
@@ -134,9 +134,8 @@
request = (long) rsp->data1;
-#if 0
- dump_msg_data(rsp, addr, NULL);
-#endif
+ dump_msg_data(&(rsp->msg), &(rsp->addr), NULL);
+
rv = rsp->msg.data[0];
/* some IPMI device might not issue 0x00, success, for reset command.
instead, a 0xc3, timeout, is returned. */
--- heartbeat-1.2.5/lib/plugins/stonith/ipmilan_command.c.orig 2007-09-18 23:02:12.000000000 -0700
+++ heartbeat-1.2.5/lib/plugins/stonith/ipmilan_command.c 2007-09-18 23:00:08.000000000 -0700
@@ -301,7 +301,11 @@
*
* http://cvs.sourceforge.net/viewcvs.py/openipmi/OpenIPMI/include/OpenIPMI/ipmi_conn.h?r1=1.27&r2=1.28
*/
+#if OPENIPMI_VERSION_MAJOR < 2
+ con->set_con_change_handler(con, con_changed_handler, &request);
+#else
con->add_con_change_handler(con, con_changed_handler, &request);
+#endif
gstatus = IPMI_RUNNING;
--- a/lib/plugins/HBcomm/ping_group.c Wed Aug 10 04:08:17 2005 +0000
+++ b/lib/plugins/HBcomm/ping_group.c Wed Nov 15 12:40:12 2006 +0900
@@ -477,7 +477,7 @@ ReRead: /* We recv lots of packet
for(node = ei->node; node; node = node->next) {
if(!memcmp(&(their_addr.sin_addr), &(node->addr.sin_addr),
sizeof(struct in_addr))) {
- goto ReRead; /* Not ours */
+ break;
}
}
if(!node) {
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems