Commit 87b9776d authored by Mac Newbold's avatar Mac Newbold

Remove the bootinfo_ack functionality. Nothing uses it and it couldn't...

Remove the bootinfo_ack functionality. Nothing uses it and it couldn't properly do the db changes it needed to.
parent b238a965
......@@ -60,8 +60,6 @@ main()
signal(SIGHUP, onhup);
while (1) {
int ack = 0;
if ((mlen = recvfrom(sock, &boot_info, sizeof(boot_info),
0, (struct sockaddr *)&client, &length))
< 0) {
......@@ -76,12 +74,6 @@ main()
err = query_bootinfo_db(client.sin_addr, boot_whatp);
break;
case BIOPCODE_BOOTWHAT_ACK:
syslog(LOG_INFO, "%s: ACK",
inet_ntoa(client.sin_addr));
ack_bootinfo_db(client.sin_addr, boot_whatp);
continue;
default:
syslog(LOG_INFO, "%s: invalid packet",
inet_ntoa(client.sin_addr));
......
......@@ -64,12 +64,6 @@ query_bootinfo_db(struct in_addr ipaddr, boot_what_t *info)
return 0;
}
int
ack_bootinfo_db(struct in_addr ipaddr, boot_what_t *info)
{
return 0;
}
int
close_bootinfo_db(void)
{
......
......@@ -188,101 +188,6 @@ query_bootinfo_db(struct in_addr ipaddr, boot_what_t *info)
#undef NEXT_BOOT_OSID_PATH
}
int
ack_bootinfo_db(struct in_addr ipaddr, boot_what_t *info)
{
char querybuf[1024];
int n, nrows, ncols, part;
MYSQL db;
MYSQL_RES *res;
MYSQL_ROW row;
n = snprintf(querybuf, sizeof querybuf,
"select i.node_id,"
"n.next_boot_osid,n.next_boot_path,n.next_boot_cmd_line "
"from nodes as n left join interfaces as i on "
"i.node_id=n.node_id where i.IP = '%s'",
inet_ntoa(ipaddr));
if (n > sizeof querybuf) {
syslog(LOG_ERR, "query too long for buffer");
return 1;
}
mysql_init(&db);
if (mysql_real_connect(&db, 0, 0, 0, dbname, 0, 0, 0) == 0) {
syslog(LOG_ERR, "%s: connect failed: %s",
dbname, mysql_error(&db));
return 1;
}
if (mysql_real_query(&db, querybuf, n) != 0) {
syslog(LOG_ERR, "%s: query failed: %s",
dbname, mysql_error(&db));
mysql_close(&db);
return 1;
}
res = mysql_store_result(&db);
if (res == 0) {
syslog(LOG_ERR, "%s: store_result failed: %s",
dbname, mysql_error(&db));
mysql_close(&db);
return 1;
}
nrows = (int)mysql_num_rows(res);
switch (nrows) {
case 0:
syslog(LOG_ERR, "%s: no entry for host %s",
dbname, inet_ntoa(ipaddr));
mysql_free_result(res);
return 1;
case 1:
break;
default:
syslog(LOG_ERR, "%s: %d entries for IP %s, using first",
dbname, nrows, inet_ntoa(ipaddr));
break;
}
row = mysql_fetch_row(res);
if ((row[1] == 0 || row[1][0] == '\0') &&
(row[2] == 0 || row[2][0] == '\0')) {
/* Nothing to do */
mysql_free_result(res);
mysql_close(&db);
return 1;
}
/*
* Update the database to reflect that the boot has been done.
*/
n = snprintf(querybuf, sizeof querybuf,
"update nodes set next_boot_osid='',next_boot_path='',"
"next_boot_cmd_line='' where node_id='%s'",
row[0]);
mysql_free_result(res);
if (n > sizeof querybuf) {
syslog(LOG_ERR, "query too long for buffer");
mysql_close(&db);
return 1;
}
if (mysql_real_query(&db, querybuf, n) != 0) {
syslog(LOG_ERR, "%s: query failed: %s",
dbname, mysql_error(&db));
mysql_close(&db);
return 1;
}
syslog(LOG_INFO, "%s: next_boot_path cleared", inet_ntoa(ipaddr));
mysql_close(&db);
return 0;
}
int
close_bootinfo_db(void)
{
......
......@@ -27,7 +27,6 @@ typedef struct {
/* Opcode */
#define BIOPCODE_BOOTWHAT_REQUEST 1 /* What to boot request */
#define BIOPCODE_BOOTWHAT_REPLY 2 /* What to boot reply */
#define BIOPCODE_BOOTWHAT_ACK 3 /* Ack to Reply */
/* BOOTWHAT Reply */
typedef struct {
......
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