Commit c09deaff authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add code to create program agents on the internally created nodes,

like shared host nodes. These are removed when the experiment swapped
or modified, just like the rest of the virtual state.
parent 83e40664
......@@ -3527,6 +3527,76 @@ sub SetupNetworkAgents($)
return 0;
}
#
# Add a program agents to address dynamically add nodes, such as a
# sharedhost node.
#
sub AddInternalProgramAgent($$)
{
my ($self, $vhost) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $pid = $self->pid();
my $eid = $self->eid();
my $idx = $self->idx();
DBQueryWarn("replace into virt_agents ".
" (exptidx, pid, eid, vname, vnode, objecttype) ".
" select '$idx', '$pid', '$eid', ".
" '__${vhost}_program-agent', '$vhost', ".
" idx from event_objecttypes where ".
" event_objecttypes.type='PROGRAM'")
or return -1;
DBQueryWarn("replace into event_groups ".
" (exptidx, pid, eid, idx, group_name, agent_name) ".
" values ('$idx', '$pid', '$eid', NULL, ".
" '__all_program-agents', ".
" '__${vhost}_program-agent')")
or return -1;
return 0;
}
sub DeleteInternalProgramAgents($)
{
my ($self, $vhost) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $pid = $self->pid();
my $eid = $self->eid();
my $idx = $self->idx();
my @nodelist = $self->NodeList();
return 0
if (! @nodelist);
foreach my $node (@nodelist) {
next
if ($node->erole() eq TBDB_RSRVROLE_NODE());
my $vhost = $node->vname();
DBQueryWarn("delete from virt_agents ".
"where exptidx='$idx' and ".
" vname='__${vhost}_program-agent' and ".
" vnode='$vhost'")
or return -1;
DBQueryWarn("delete from event_groups ".
"where exptidx='$idx' and ".
" group_name='__all_program-agents' and ".
" agent_name='__${vhost}_program-agent'")
or return -1;
}
return 0;
}
#
# Write the virt program data for the program agent that will run on ops.
# Ops does not speak to tmcd for experiments, so need to get this info
......
......@@ -4401,6 +4401,12 @@ sub InitializePhysNode($$$)
%rsrvsets = ("vname" => $vname,
"erole" => $role);
if (!$self->impotent() &&
$self->experiment()->AddInternalProgramAgent($vname)) {
tberror("Error determining boot command line for $pnode\n");
return -1;
}
}
else {
#
......
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