Allow ipmitool/ipmievd to target specific device nodes on multi-BMC systems

This commit is contained in:
Carol Hebert 2007-02-22 22:32:06 +00:00
parent c4a368edfb
commit edb0ba9c6d
6 changed files with 48 additions and 15 deletions

View File

@ -2,7 +2,7 @@
.SH "NAME"
ipmievd \- IPMI event daemon for sending events to syslog
.SH "SYNOPSIS"
ipmievd [\fB\-c\fR|\fB\-h\fR|\fB\-v\fR|\fB\-V\fR]
ipmievd [\fB\-c\fR|\fB\-h\fR|\fB\-d \fIN\fP\fR|\fB\-v\fR|\fB\-V\fR]
\fB\-I\fR \fIopen\fP <\fIopen\fR | \fIsel\fR> [<\fIoption\fP>]
ipmievd [\fB\-c\fR|\fB\-h\fR|\fB\-v\fR|\fB\-V\fR]
@ -116,6 +116,13 @@ Bridge IPMI requests to the remote target address.
\fB\-U\fR <\fIusername\fP>
Remote server username, default is NULL user.
.TP
\fB\-d \fIN\fP\fR
Use device number N to specify the /dev/ipmiN (or
/dev/ipmi/N or /dev/ipmidev/N) device to use for in-band
BMC communication. Used to target a specific BMC on a
multi-node, multi-BMC system through the ipmi device
driver interface. Default is 0.
.TP
\fB\-v\fR
Increase verbose output level. This option may be specified
multiple times to increase the level of debug output. If given
@ -167,7 +174,8 @@ Do NOT become a daemon, instead log all messages to stderr.
.TP
\fIpidfile\fP=<\fBfilename\fR>
Save process ID to this file when in daemon mode. Defaults to
/var/run/ipmievd.pid.
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
number -- defaults to 0).
.RE
.TP
@ -189,7 +197,8 @@ Do NOT become a daemon, instead log all messages to stderr.
.TP
\fIpidfile\fP=<\fBfilename\fR>
Save process ID to this file when in daemon mode. Defaults to
/var/run/ipmievd.pid.
/var/run/ipmievd.pid\fIN\fP (where \fIN\fP is the ipmi device
number -- defaults to 0).
.TP
\fItimeout\fP=<\fBseconds\fR>
Time between checks for SEL polling method. Default is 10 seconds.

View File

@ -2,7 +2,7 @@
.SH "NAME"
ipmitool \- utility for controlling IPMI\-enabled devices
.SH "SYNOPSIS"
ipmitool [\fB\-c\fR|\fB\-h\fR|\fB\-v\fR|\fB\-V\fR]
ipmitool [\fB\-c\fR|\fB\-h\fR|\fB\-d \fIN\fP\fR|\fB\-v\fR|\fB\-V\fR]
\fB\-I\fR \fIopen\fP <\fIcommand\fP>
ipmitool [\fB\-c\fR|\fB\-h\fR|\fB\-v\fR|\fB\-V\fR]
@ -130,6 +130,13 @@ Bridge IPMI requests to the remote target address.
.TP
\fB\-U\fR <\fIusername\fP>
Remote server username, default is NULL user.
.TP
\fB\-d \fIN\fP\fR
Use device number N to specify the /dev/ipmiN (or
/dev/ipmi/N or /dev/ipmidev/N) device to use for in-band
BMC communication. Used to target a specific BMC on a
multi-node, multi-BMC system through the ipmi device
driver interface. Default is 0.
.TP
\fB\-v\fR
Increase verbose output level. This option may be specified

View File

@ -174,6 +174,8 @@ struct ipmi_intf {
uint8_t target_lun;
uint8_t target_channel;
uint8_t devnum;
int (*setup)(struct ipmi_intf * intf);
int (*open)(struct ipmi_intf * intf);
void (*close)(struct ipmi_intf * intf);

View File

@ -71,9 +71,9 @@
#endif
#ifdef ENABLE_ALL_OPTIONS
# define OPTION_STRING "I:hVvcgsEao:H:P:f:U:p:C:L:A:t:m:S:l:b:e:k:O:"
# define OPTION_STRING "I:hVvcgsEao:H:d:P:f:U:p:C:L:A:t:m:S:l:b:e:k:O:"
#else
# define OPTION_STRING "I:hVvcH:f:U:p:S:"
# define OPTION_STRING "I:hVvcH:f:U:p:d:S:"
#endif
extern int verbose;
@ -216,6 +216,7 @@ ipmi_option_usage(const char * progname, struct ipmi_cmd * cmdlist, struct ipmi_
lprintf(LOG_NOTICE, " -V Show version information");
lprintf(LOG_NOTICE, " -v Verbose (can use multiple times)");
lprintf(LOG_NOTICE, " -c Display output in comma separated format");
lprintf(LOG_NOTICE, " -d N Specify a /dev/ipmiN device to use (default=0)");
lprintf(LOG_NOTICE, " -I intf Interface to use");
lprintf(LOG_NOTICE, " -H hostname Remote host name for LAN interface");
lprintf(LOG_NOTICE, " -p port Remote RMCP port [default=623]");
@ -283,6 +284,7 @@ ipmi_main(int argc, char ** argv,
char * kgkey = NULL;
char * seloem = NULL;
int port = 0;
int devnum = 0;
int cipher_suite_id = 3; /* See table 22-19 of the IPMIv2 spec */
int argflag, i, found;
int rc = -1;
@ -325,6 +327,9 @@ ipmi_main(int argc, char ** argv,
rc = 0;
goto out_free;
break;
case 'd':
devnum = atoi(optarg);
break;
case 'p':
port = atoi(optarg);
break;
@ -582,6 +587,8 @@ ipmi_main(int argc, char ** argv,
/* setup destination channel if given */
intf->target_channel = target_channel ;
intf->devnum = devnum;
/* setup IPMB local and target address if given */
intf->my_addr = my_addr ? : IPMI_BMC_SLAVE_ADDR;
if (target_addr > 0) {

View File

@ -624,7 +624,8 @@ ipmievd_main(struct ipmi_event_intf * eintf, int argc, char ** argv)
struct sigaction act;
memset(pidfile, 0, 64);
strncpy(pidfile, DEFAULT_PIDFILE, strlen(DEFAULT_PIDFILE));
sprintf(pidfile, "%s%d", DEFAULT_PIDFILE, eintf->intf->devnum);
lprintf(LOG_NOTICE, "ipmievd: using pidfile %s", pidfile);
for (i = 0; i < argc; i++) {
if (strncasecmp(argv[i], "help", 4) == 0) {

View File

@ -63,10 +63,6 @@
extern int verbose;
#define IPMI_OPENIPMI_DEV "/dev/ipmi0"
#define IPMI_OPENIPMI_DEVFS "/dev/ipmi/0"
#define IPMI_OPENIPMI_DEVFS2 "/dev/ipmidev/0"
static int
ipmi_openipmi_open(struct ipmi_intf * intf)
{
@ -76,17 +72,28 @@ ipmi_openipmi_open(struct ipmi_intf * intf)
struct ipmi_rs *rsp;
char msg_data;
#endif
char ipmi_dev[16];
char ipmi_devfs[16];
char ipmi_devfs2[16];
int devnum = 0;
intf->fd = open(IPMI_OPENIPMI_DEV, O_RDWR);
devnum = intf->devnum;
sprintf(ipmi_dev, "/dev/ipmi%d", devnum);
sprintf(ipmi_devfs, "/dev/ipmi/%d", devnum);
sprintf(ipmi_devfs2, "/dev/ipmidev/%d", devnum);
lprintf(LOG_DEBUG, "Using ipmi device %d", devnum);
intf->fd = open(ipmi_dev, O_RDWR);
if (intf->fd < 0) {
intf->fd = open(IPMI_OPENIPMI_DEVFS, O_RDWR);
intf->fd = open(ipmi_devfs, O_RDWR);
if (intf->fd < 0) {
intf->fd = open(IPMI_OPENIPMI_DEVFS2, O_RDWR);
intf->fd = open(ipmi_devfs2, O_RDWR);
}
if (intf->fd < 0) {
lperror(LOG_ERR, "Could not open device at %s or %s or %s",
IPMI_OPENIPMI_DEV, IPMI_OPENIPMI_DEVFS , IPMI_OPENIPMI_DEVFS2);
ipmi_dev, ipmi_devfs , ipmi_devfs2);
return -1;
}
}