Commit c630346d authored by Leigh Stoller's avatar Leigh Stoller

Oops, left this file out of commit 95ada2d1

(plumbing for disk agents).
parent 9e58c964
...@@ -309,6 +309,7 @@ COMMAND_PROTOTYPE(dosecurestate); ...@@ -309,6 +309,7 @@ COMMAND_PROTOTYPE(dosecurestate);
COMMAND_PROTOTYPE(doquoteprep); COMMAND_PROTOTYPE(doquoteprep);
COMMAND_PROTOTYPE(doimagekey); COMMAND_PROTOTYPE(doimagekey);
COMMAND_PROTOTYPE(donodeattributes); COMMAND_PROTOTYPE(donodeattributes);
COMMAND_PROTOTYPE(dodisks);
/* /*
* The fullconfig slot determines what routines get called when pushing * The fullconfig slot determines what routines get called when pushing
...@@ -418,6 +419,7 @@ struct command { ...@@ -418,6 +419,7 @@ struct command {
{ "quoteprep", FULLCONFIG_NONE, F_REMREQSSL, doquoteprep}, { "quoteprep", FULLCONFIG_NONE, F_REMREQSSL, doquoteprep},
{ "imagekey", FULLCONFIG_NONE, F_REQTPM, doimagekey}, { "imagekey", FULLCONFIG_NONE, F_REQTPM, doimagekey},
{ "nodeattributes", FULLCONFIG_ALL, 0, donodeattributes}, { "nodeattributes", FULLCONFIG_ALL, 0, donodeattributes},
{ "disks", FULLCONFIG_ALL, 0, dodisks},
}; };
static int numcommands = sizeof(command_array)/sizeof(struct command); static int numcommands = sizeof(command_array)/sizeof(struct command);
...@@ -9846,4 +9848,48 @@ COMMAND_PROTOTYPE(donodeattributes) ...@@ -9846,4 +9848,48 @@ COMMAND_PROTOTYPE(donodeattributes)
return 0; return 0;
} }
/*
* Return the virt_node_disks for a node.
*/
COMMAND_PROTOTYPE(dodisks)
{
MYSQL_RES *res;
MYSQL_ROW row;
char buf[MYBUFSIZE];
char *bufp = buf, *ebufp = &buf[sizeof(buf)];
int nrows;
if (! reqp->allocated) {
return 0;
}
bzero(buf, sizeof(buf));
/*
* Get all the *virt* disks for the node.
*/
res = mydb_query("select diskname,disktype,mountpoint,parameters,command "
" from virt_node_disks "
"where exptidx=%d and vname='%s'",
5, reqp->exptidx, reqp->nickname);
if (res) {
nrows = (int)mysql_num_rows(res);
while (bufp < ebufp && nrows--) {
row = mysql_fetch_row(res);
bufp += OUTPUT(bufp, ebufp - bufp,
"DISK DISKNAME=%s DISKTYPE='%s' "
"MOUNTPOINT='%s' MOUNTPOINT='%s' "
"PARAMETERS='%s'\n",
row[0],
(row[1] ? row[1] : ""),
(row[2] ? row[2] : ""),
(row[3] ? row[3] : ""),
(row[4] ? row[4] : ""));
}
mysql_free_result(res);
client_writeback(sock, buf, strlen(buf), tcp);
}
return 0;
}
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