Commit 2c32ce9f authored by Leigh Stoller's avatar Leigh Stoller

Minor sql change to work around mysterious breakage after mysql 5.0

upgrade.
parent fe98aecf
......@@ -3456,10 +3456,14 @@ COMMAND_PROTOTYPE(doloadinfo)
*/
disktype = DISKTYPE;
disknum = DISKNUM;
res = mydb_query("select disktype,bootdisk_unit from nodes as n "
"left join node_types as nt on n.type = nt.type "
"where n.node_id='%s'",
2, reqp->nodeid);
res = mydb_query("select attrkey,attrvalue from nodes as n "
"left join node_type_attributes as a on "
" n.type=a.type "
"where (a.attrkey='bootdisk_unit' or "
" a.attrkey='disktype') and "
" n.node_id='%s'", 2, reqp->nodeid);
if (!res) {
error("doloadinfo: %s: DB Error getting disktype!\n",
reqp->nodeid);
......@@ -3467,11 +3471,21 @@ COMMAND_PROTOTYPE(doloadinfo)
}
if ((int)mysql_num_rows(res) > 0) {
row = mysql_fetch_row(res);
if (row[0] && row[0][0])
disktype = row[0];
if (row[1] && row[1][0])
disknum = atoi(row[1]);
int nrows = (int)mysql_num_rows(res);
while (nrows) {
row = mysql_fetch_row(res);
if (row[1] && row[1][0]) {
if (strcmp(row[0], "bootdisk_unit") == 0) {
disknum = atoi(row[1]);
}
else if (strcmp(row[0], "disktype") == 0) {
disktype = row[1];
}
}
nrows--;
}
}
OUTPUT(bufp, ebufp - bufp, " DISK=%s%d ZFILL=%d\n",
disktype, disknum, zfill);
......@@ -3971,10 +3985,10 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
" ps.admin, "
" e.elab_in_elab "
"from nodes as nv "
"left join interfaces as i on "
" i.node_id=nv.phys_nodeid "
"left join nodes as np on "
" np.node_id=nv.phys_nodeid "
"left join interfaces as i on "
" i.node_id=np.node_id "
"left join reserved as r on "
" r.node_id=nv.node_id "
"left join experiments as e on "
......@@ -4783,9 +4797,8 @@ COMMAND_PROTOTYPE(doixpconfig)
*/
res = mydb_query("select i1.IP,i1.iface,i2.iface,i2.mask,i2.IP "
" from nodes as n "
"left join node_types as nt on n.type=nt.type "
"left join interfaces as i1 on i1.node_id=n.node_id "
" and i1.iface=nt.control_iface "
" and i1.role='ctrl' "
"left join interfaces as i2 on i2.node_id='%s' "
" and i2.card=i1.card "
"where n.node_id='%s'",
......
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