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, ...@@ -86,14 +86,16 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
int err; int err;
#ifdef EVENTSYS #ifdef EVENTSYS
int needevent = 0, eventfailed = 0; 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 * We are not going to send any events for nodes we don't know about,
* or that are "pxelinux" nodes. * or PXEBOOTING/BOOTING events for "pxelinux" nodes.
*/ */
if (!findnode_bootinfo_db(ipaddr, &doevents) || doevents == 0) if (!findnode_bootinfo_db(ipaddr, &doevents))
no_event_send = 1; no_boot_event_send = no_event_send = 1;
else if (!no_event_send)
no_boot_event_send = doevents ? 0 : 1;
#endif #endif
switch (boot_info->opcode) { switch (boot_info->opcode) {
...@@ -101,15 +103,18 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info, ...@@ -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", info("%s: KEYED REQUEST (key=[%s], vers %d)\n",
inet_ntoa(ipaddr), boot_info->data, boot_info->version); inet_ntoa(ipaddr), boot_info->data, boot_info->version);
#ifdef EVENTSYS #ifdef EVENTSYS
needevent = bicache_needevent(ipaddr); if (!no_event_send) {
needevent = bicache_needevent(ipaddr);
#if defined(BOOTINFO_PXEEVENTS) #if defined(BOOTINFO_PXEEVENTS)
if (!no_event_send && needevent && if (!no_boot_event_send && needevent &&
bievent_send(ipaddr, opaque, TBDB_NODESTATE_PXEBOOTING)) { bievent_send(ipaddr, opaque,
/* send failed, clear the cache entry */ TBDB_NODESTATE_PXEBOOTING)) {
bicache_clearevent(ipaddr); /* send failed, clear the cache entry */
eventfailed = 1; bicache_clearevent(ipaddr);
} eventfailed = 1;
}
#endif #endif
}
#endif #endif
err = query_bootinfo_db(ipaddr, node_id, boot_info->version, err = query_bootinfo_db(ipaddr, node_id, boot_info->version,
boot_whatp, boot_info->data); boot_whatp, boot_info->data);
...@@ -119,15 +124,18 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info, ...@@ -119,15 +124,18 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
info("%s: REQUEST (vers %d)\n", info("%s: REQUEST (vers %d)\n",
inet_ntoa(ipaddr), boot_info->version); inet_ntoa(ipaddr), boot_info->version);
#ifdef EVENTSYS #ifdef EVENTSYS
needevent = bicache_needevent(ipaddr); if (!no_event_send) {
needevent = bicache_needevent(ipaddr);
#if defined(BOOTINFO_PXEEVENTS) #if defined(BOOTINFO_PXEEVENTS)
if (!no_event_send && needevent && if (!no_boot_event_send && needevent &&
bievent_send(ipaddr, opaque, TBDB_NODESTATE_PXEBOOTING)) { bievent_send(ipaddr, opaque,
/* send failed, clear the cache entry */ TBDB_NODESTATE_PXEBOOTING)) {
bicache_clearevent(ipaddr); /* send failed, clear the cache entry */
eventfailed = 1; bicache_clearevent(ipaddr);
} eventfailed = 1;
}
#endif #endif
}
#endif #endif
err = query_bootinfo_db(ipaddr, node_id, err = query_bootinfo_db(ipaddr, node_id,
boot_info->version, boot_whatp, NULL); boot_info->version, boot_whatp, NULL);
...@@ -147,7 +155,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info, ...@@ -147,7 +155,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
else { else {
boot_info->status = BISTAT_SUCCESS; boot_info->status = BISTAT_SUCCESS;
#ifdef EVENTSYS #ifdef EVENTSYS
if (!no_event_send && needevent) { if (needevent) {
/* /*
* Retry a failed PXEBOOTING event. * Retry a failed PXEBOOTING event.
* *
...@@ -155,7 +163,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info, ...@@ -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 * the road as stated gets out of sync. So pause
* here and try to stay on track. * here and try to stay on track.
*/ */
if (eventfailed) { if (!no_boot_event_send && eventfailed) {
sleep(1); sleep(1);
info("%s: retry failed PXEBOOTING event\n", info("%s: retry failed PXEBOOTING event\n",
inet_ntoa(ipaddr)); inet_ntoa(ipaddr));
...@@ -173,9 +181,13 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info, ...@@ -173,9 +181,13 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
case BIBOOTWHAT_TYPE_MB: case BIBOOTWHAT_TYPE_MB:
case BIBOOTWHAT_TYPE_MFS: case BIBOOTWHAT_TYPE_MFS:
#if defined(BOOTINFO_PXEEVENTS) #if defined(BOOTINFO_PXEEVENTS)
bievent_send(ipaddr, opaque, if (!no_boot_event_send) {
TBDB_NODESTATE_BOOTING); bievent_send(ipaddr, opaque,
TBDB_NODESTATE_BOOTING);
break;
}
#endif #endif
needevent = 0;
break; break;
case BIBOOTWHAT_TYPE_WAIT: case BIBOOTWHAT_TYPE_WAIT:
...@@ -191,6 +203,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info, ...@@ -191,6 +203,7 @@ bootinfo(struct in_addr ipaddr, char *node_id, struct boot_info *boot_info,
default: default:
error("%s: invalid boot directive: %d\n", error("%s: invalid boot directive: %d\n",
inet_ntoa(ipaddr), boot_whatp->type); inet_ntoa(ipaddr), boot_whatp->type);
needevent = 0;
break; 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