Commit b1a64f50 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Return VDSIZE in jailconfig, which is taken from the virtnode_disksize

attribute in the node_type_attributes or node_attributes table. This
value will override whatever libvnode_openvz calculates.
parent ed5f61b8
......@@ -6827,20 +6827,35 @@ COMMAND_PROTOTYPE(dojailconfig)
mysql_free_result(res);
/*
* See if a per-node-type vnode disk size is specified
*/
res = mydb_query("select na.attrvalue from nodes as n "
"left join node_type_attributes as na on "
" n.type=na.type "
"where n.node_id='%s' and "
"na.attrkey='virtnode_disksize'", 1, reqp->pnodeid);
* See if a per-node-type vnode disk size is specified, which
* can be overridden by a per-node disk size.
*/
res = mydb_query("select nta.attrvalue,na.attrvalue from nodes as n "
"left join node_type_attributes as nta on "
" nta.type=n.type and "
" nta.attrkey='virtnode_disksize' "
"left join node_attributes as na on "
" na.node_id=n.node_id and "
" na.attrkey='virtnode_disksize' "
"where n.node_id='%s'",
2, reqp->pnodeid);
if (res) {
if ((int)mysql_num_rows(res) != 0) {
char *attrvalue = NULL;
row = mysql_fetch_row(res);
if (row[0]) {
if (row[0] && row[0][0])
attrvalue = row[0];
else if (row[1] && row[1][0]) {
attrvalue = row[1];
}
if (attrvalue) {
bufp = buf;
bufp += OUTPUT(bufp, ebufp - bufp,
"VDSIZE=%d\n", atoi(row[0]));
"VDSIZE=%s\n", attrvalue);
}
client_writeback(sock, buf, strlen(buf), tcp);
}
......
Supports Markdown
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