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

PreReserve vlan tags when the experiment has virtnodes, so

that we can return the tags from tmcd even if snmpit has
not created the vlan yet.
parent 5a1bb1ad
......@@ -1404,6 +1404,19 @@ sub doSwapin($) {
" savedisk=1 where pid='$pid' and eid='$eid'");
}
#
# If the experiment is using virt nodes, reserve the tags
# now so that the VMs can boot without having to worry about
# the tags not being assigned yet. We can do this for all swap
# modes since it is harmless; snmpit does the correct thing.
#
if ($experiment->HasVirtNodes()) {
system("$SNMPIT --redirect-err -A $pid $eid");
if ($?) {
tberror("Failed to reserve VLAN tags.");
return 1;
}
}
#
# Since it'll take a while for the nodes to reboot, we'll start now, and
......
......@@ -2082,7 +2082,7 @@ COMMAND_PROTOTYPE(doifconfig)
*/
res = mydb_query("select v.unit,v.IP,v.mac,i.mac,v.mask,v.rtabid, "
" v.type,vll.vname,v.virtlanidx,vlans.tag, "
" l.lanid "
" l.lanid,rvt.tag "
" from vinterfaces as v "
"left join interfaces as i on "
" i.node_id=v.node_id and i.iface=v.iface "
......@@ -2092,13 +2092,15 @@ COMMAND_PROTOTYPE(doifconfig)
" l.exptidx=vll.exptidx and l.vname=vll.vname "
"left join vlans on "
" vlans.id=v.vlanid "
"left join reserved_vlantags as rvt on "
" rvt.lanid=v.vlanid "
"left join lan_attributes as la2 on "
" la2.lanid=v.vlanid and la2.attrkey='stack' "
"where v.exptidx='%d' and v.node_id='%s' and "
" (la2.attrvalue='Experimental' or "
" la2.attrvalue is null) "
" and %s",
11, reqp->exptidx, reqp->pnodeid, buf);
12, reqp->exptidx, reqp->pnodeid, buf);
if (!res) {
error("%s: IFCONFIG: DB Error getting veth interfaces!\n",
reqp->nodeid);
......@@ -2192,7 +2194,8 @@ COMMAND_PROTOTYPE(doifconfig)
else if (strcmp(ifacetype, "loop") == 0)
tag = row[10];
else if (strcmp(ifacetype, "vlan") == 0)
tag = row[9] ? row[9] : "0";
tag = row[9] ? row[9] :
row[11] ? row[11] : "0";
/* sanity check the tag */
if (!isdigit(tag[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