Commit 7d388c15 authored by David Johnson's avatar David Johnson
Browse files

Changes to handle "dedicated" remote nodes in roughly the same way we

handle local nodes -- to assign_wrapper and ptopgen, they're pretty
much the same.  If the "dedicated_widearea" node_type_attribute is
set for nodes of class pcRemote, we treat remote nodes like locals.
I stuck with using a node_type_attribute for this, but it makes fast
queries ugly.  I believe node_type_attributes are better than adding
yet another bit to the node_types table, but others may feel
differently.
parent bab96378
...@@ -401,6 +401,13 @@ sub nodetypeissub($) { return $node_types{$_[0]}->issubnode(); } ...@@ -401,6 +401,13 @@ sub nodetypeissub($) { return $node_types{$_[0]}->issubnode(); }
sub nodetypeisplab($) { return $node_types{$_[0]}->isplabdslice(); } sub nodetypeisplab($) { return $node_types{$_[0]}->isplabdslice(); }
sub nodetypeissim($) { return $node_types{$_[0]}->issimnode(); } sub nodetypeissim($) { return $node_types{$_[0]}->issimnode(); }
sub nodetypesimcap($) { return $node_types{$_[0]}->simnode_capacity(); } sub nodetypesimcap($) { return $node_types{$_[0]}->simnode_capacity(); }
sub nodetypeisdedicatedremote($) {
my $ded = $node_types{$_[0]}->GetAttribute("dedicated_widearea");
if (defined($ded) && "$ded" eq "1") {
return 1;
}
return 0;
}
# #
# osids: Information from the os_info table from the DB, indexed by osid # osids: Information from the os_info table from the DB, indexed by osid
...@@ -1163,8 +1170,10 @@ sub RunAssign () ...@@ -1163,8 +1170,10 @@ sub RunAssign ()
# we do not reserve a widearea physnode when a virtual node # we do not reserve a widearea physnode when a virtual node
# is mapped to it; they are special. # is mapped to it; they are special.
# #
my $node_type = virtnodetype($virtual);
$toreserve{$physical} = 1 $toreserve{$physical} = 1
if (!virtnodeisremote($virtual)); if (!(virtnodeisremote($virtual)
&& !nodetypeisdedicatedremote($node_type)));
} }
if (virtnodeisvirt($virtual)) { if (virtnodeisvirt($virtual)) {
...@@ -2980,6 +2989,7 @@ sub InitPnode($$) ...@@ -2980,6 +2989,7 @@ sub InitPnode($$)
my $simhost_violation; my $simhost_violation;
my $inner_elab_role; my $inner_elab_role;
my $plab_role; my $plab_role;
my $node_type = virtnodetype($vnode);
# XXX NSE hack: # XXX NSE hack:
if (virtnodeisvnode($vnode) && virtnodeissim($vnode)) { if (virtnodeisvnode($vnode) && virtnodeissim($vnode)) {
...@@ -3013,7 +3023,8 @@ sub InitPnode($$) ...@@ -3013,7 +3023,8 @@ sub InitPnode($$)
$role = TBDB_RSRVROLE_SIMHOST; $role = TBDB_RSRVROLE_SIMHOST;
$simhost_violation = 0; $simhost_violation = 0;
} }
elsif (virtnodeisremote($vnode) && $v2vmap{$vnode} ne $pnode) { elsif (virtnodeisremote($vnode) && !nodetypeisdedicatedremote($node_type)
&& $v2vmap{$vnode} ne $pnode) {
# #
# We never allocate remote pnodes (always allocated), so skip. # We never allocate remote pnodes (always allocated), so skip.
# #
...@@ -5607,19 +5618,20 @@ sub LoadCurrent() ...@@ -5607,19 +5618,20 @@ sub LoadCurrent()
my $query_result = my $query_result =
DBQueryFatal("select r.vname,r.node_id,n.phys_nodeid, ". DBQueryFatal("select r.vname,r.node_id,n.phys_nodeid, ".
" nt.isvirtnode,nt.isremotenode,nt.isplabdslice,r.erole,". " nt.isvirtnode,nt.isremotenode,nt.isplabdslice,r.erole,".
"r.simhost_violation from reserved as r ". "r.simhost_violation,nt.type from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ". "left join nodes as n on n.node_id=r.node_id ".
"left join node_types as nt on nt.type=n.type ". "left join node_types as nt on nt.type=n.type ".
"where r.pid='$pid' and r.eid='$eid'"); "where r.pid='$pid' and r.eid='$eid'");
while (my ($vname,$reserved,$physnode,$isvirt,$isremote,$isplab,$erole,$simhost_violation) = while (my ($vname,$reserved,$physnode,$isvirt,$isremote,$isplab,$erole,$simhost_violation,$node_type) =
$query_result->fetchrow_array) { $query_result->fetchrow_array) {
# #
# WIDEAREA nodes are going to break. Hmm, so are "sim" nodes. # WIDEAREA nodes are going to break. Hmm, so are "sim" nodes.
# #
fatal("Cannot update widearea nodes yet!") fatal("Cannot update widearea nodes yet!")
if ($isremote && !$isplab); if ($isremote && !nodetypeisdedicatedremote($node_type)
&& !$isplab);
LoadPhysNode($reserved); LoadPhysNode($reserved);
......
...@@ -362,8 +362,15 @@ $result = ...@@ -362,8 +362,15 @@ $result =
"left join reserved as m on a.phys_nodeid=m.node_id ". "left join reserved as m on a.phys_nodeid=m.node_id ".
"left join nodes as np on a.phys_nodeid=np.node_id ". "left join nodes as np on a.phys_nodeid=np.node_id ".
"left join node_types as t on t.type=a.type ". "left join node_types as t on t.type=a.type ".
"left outer join ".
" (select type,attrvalue ".
" from node_type_attributes ".
" where attrkey='dedicated_widearea' ".
" group by type) as dedicated_wa_types ".
" on t.type=dedicated_wa_types.type ".
"where $free_condition and ". "where $free_condition and ".
" (a.role='testnode' and t.isremotenode=0)"); " (a.role='testnode' and (t.isremotenode=0 or ".
" dedicated_wa_types.attrvalue=1))");
# #
# Scan the results, checking permissions and adding to the list # Scan the results, checking permissions and adding to the list
...@@ -661,9 +668,16 @@ if ($widearea) { ...@@ -661,9 +668,16 @@ if ($widearea) {
" wn.node_id=n.node_id ". " wn.node_id=n.node_id ".
"left join interfaces as i on ". "left join interfaces as i on ".
" n.node_id=i.node_id and ". " n.node_id=i.node_id and ".
" i.role='" . TBDB_IFACEROLE_CONTROL() . "'". " i.role='" . TBDB_IFACEROLE_CONTROL() . "' ".
"left outer join ".
" (select type,attrvalue ".
" from node_type_attributes ".
" where attrkey='dedicated_widearea' ".
" group by type) as dedicated_wa_types ".
" on nt.type=dedicated_wa_types.type ".
"where (n.role='testnode' and nt.isremotenode=1 and ". "where (n.role='testnode' and nt.isremotenode=1 and ".
" nt.isvirtnode=0)"); " nt.isvirtnode=0 and ".
" dedicated_wa_types.attrvalue is NULL)");
while (($physnode,$ptype,$status,$mpid,$meid,$site,$iface,$bwlimit) while (($physnode,$ptype,$status,$mpid,$meid,$site,$iface,$bwlimit)
= $result->fetchrow_array) { = $result->fetchrow_array) {
......
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