Commit 94ad4480 authored by Mike Hibler's avatar Mike Hibler

An event-related bug Leigh fixed yesterday was masking another bug.

Two wrongs do make a right! Now that both bugs are fixed, let's see if
bootinfo will send the right events at the right times...
parent e4671992
......@@ -86,14 +86,16 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
int err;
#ifdef EVENTSYS
int needevent = 0, eventfailed = 0;
int doevents = 0;
int doevents = 0, no_boot_event_send = no_event_send;
/*
* We are not going to send events for nodes we don't know about
* or that are "pxelinux" nodes.
* We are not going to send any events for nodes we don't know about,
* or PXEBOOTING/BOOTING events for "pxelinux" nodes.
*/
if (!findnode_bootinfo_db(ipaddr, &doevents) || doevents == 0)
no_event_send = 1;
if (!findnode_bootinfo_db(ipaddr, &doevents))
no_boot_event_send = no_event_send = 1;
else if (!no_event_send)
no_boot_event_send = doevents ? 0 : 1;
#endif
switch (boot_info->opcode) {
......@@ -101,15 +103,18 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
info("%s: KEYED REQUEST (key=[%s], vers %d)\n",
inet_ntoa(ipaddr), boot_info->data, boot_info->version);
#ifdef EVENTSYS
needevent = bicache_needevent(ipaddr);
if (!no_event_send) {
needevent = bicache_needevent(ipaddr);
#if defined(BOOTINFO_PXEEVENTS)
if (!no_event_send && needevent &&
bievent_send(ipaddr, opaque, TBDB_NODESTATE_PXEBOOTING)) {
/* send failed, clear the cache entry */
bicache_clearevent(ipaddr);
eventfailed = 1;
}
if (!no_boot_event_send && needevent &&
bievent_send(ipaddr, opaque,
TBDB_NODESTATE_PXEBOOTING)) {
/* send failed, clear the cache entry */
bicache_clearevent(ipaddr);
eventfailed = 1;
}
#endif
}
#endif
err = query_bootinfo_db(ipaddr, node_id, boot_info->version,
boot_whatp, boot_info->data);
......@@ -119,15 +124,18 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
info("%s: REQUEST (vers %d)\n",
inet_ntoa(ipaddr), boot_info->version);
#ifdef EVENTSYS
needevent = bicache_needevent(ipaddr);
if (!no_event_send) {
needevent = bicache_needevent(ipaddr);
#if defined(BOOTINFO_PXEEVENTS)
if (!no_event_send && needevent &&
bievent_send(ipaddr, opaque, TBDB_NODESTATE_PXEBOOTING)) {
/* send failed, clear the cache entry */
bicache_clearevent(ipaddr);
eventfailed = 1;
}
if (!no_boot_event_send && needevent &&
bievent_send(ipaddr, opaque,
TBDB_NODESTATE_PXEBOOTING)) {
/* send failed, clear the cache entry */
bicache_clearevent(ipaddr);
eventfailed = 1;
}
#endif
}
#endif
err = query_bootinfo_db(ipaddr, node_id,
boot_info->version, boot_whatp, NULL);
......@@ -147,7 +155,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
else {
boot_info->status = BISTAT_SUCCESS;
#ifdef EVENTSYS
if (!no_event_send && needevent) {
if (needevent) {
/*
* Retry a failed PXEBOOTING event.
*
......@@ -155,7 +163,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
* the road as stated gets out of sync. So pause
* here and try to stay on track.
*/
if (eventfailed) {
if (!no_boot_event_send && eventfailed) {
sleep(1);
info("%s: retry failed PXEBOOTING event\n",
inet_ntoa(ipaddr));
......@@ -173,9 +181,13 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
case BIBOOTWHAT_TYPE_MB:
case BIBOOTWHAT_TYPE_MFS:
#if defined(BOOTINFO_PXEEVENTS)
bievent_send(ipaddr, opaque,
TBDB_NODESTATE_BOOTING);
if (!no_boot_event_send) {
bievent_send(ipaddr, opaque,
TBDB_NODESTATE_BOOTING);
break;
}
#endif
needevent = 0;
break;
case BIBOOTWHAT_TYPE_WAIT:
......@@ -191,6 +203,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
default:
error("%s: invalid boot directive: %d\n",
inet_ntoa(ipaddr), boot_whatp->type);
needevent = 0;
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment