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

Implement geni part of issue #302.

parent 6dae3d5c
......@@ -94,6 +94,7 @@ my $ARPLOCKDOWN = "$TB/sbin/arplockdown";
my $TARFILES_SETUP = "$TB/bin/tarfiles_setup";
my $ELAB_SETUP = "$TB/sbin/elabinelab";
my $TBADB = "$TB/bin/tbadb";
my $PUSHROOTKEY = "$TB/sbin/pushrootkey";
# Cache of instances to avoid regenerating them.
my %aggregates = ();
......@@ -1770,6 +1771,23 @@ sub Action($$$;$)
return -1
if ($self->WaitForNodes(\@failed, $osload_object, \@reload_children,
@waitpnodes, @waitvnodes));
#
# Before we fire off any async activity, push out any experiment
# specific root private key.
#
if ($action eq "start") {
my $privkey = $experiment->GetPrivkey();
if ($privkey) {
print STDERR "Pushing per-experiment root private key.\n";
system("$PUSHROOTKEY -e $pid/$eid");
if ($?) {
print STDERR "*** Could not push private key, ".
"this may cause problems!\n";
}
}
}
# Waiting is done.
if ($experiment->elab_in_elab()) {
......@@ -1792,7 +1810,7 @@ sub Action($$$;$)
elsif (($action eq "start" || $action eq "restart") &&
($flags & $ACTION_FLAGS_NOEVENTSTART) == 0) {
$self->ComputeState();
if ($self->status() eq "ready") {
#
# Start the event scheduler. Note that the experiment is already
......
......@@ -1603,6 +1603,21 @@ sub GetTicketAuxAux($$$$$$$$$$$)
}
}
}
# Root keys.
my ($pubkey,$privkey) = GeniXML::GetRootKey($ref);
if (defined($pubkey)) {
$nodeblob->{"rootkey_public"} = $pubkey;
}
else {
$nodeblob->{"rootkey_public"} = -1; # means did not specify.
}
if (defined($privkey)) {
$nodeblob->{"rootkey_private"} = $privkey;
}
else {
$nodeblob->{"rootkey_private"} = -1; # means did not specify.
}
# Program agents.
if (my @progagents = GeniXML::GetProgramAgents($ref)) {
foreach my $agent (@progagents) {
......@@ -5023,6 +5038,7 @@ sub SliverWorkAux($$$$$$$$)
# Update this info now that we are done.
$experiment->SaveExperimentState();
$experiment->SaveLogFiles();
$experiment->InitKeyDist();
return GeniResponse->Create(GENIRESPONSE_SUCCESS,
[$sliver_credential->asString(),
......@@ -5051,6 +5067,7 @@ sub SliverWorkAux($$$$$$$$)
# Update this info now that we are done.
$experiment->SaveExperimentState();
$experiment->SaveLogFiles();
$experiment->InitKeyDist();
if ($v2) {
return GeniResponse->Create(GENIRESPONSE_SUCCESS,
......
......@@ -751,6 +751,28 @@ sub GetStartupCommand($)
return $result;
}
#
# Get root ssh key directive. Returns a list (pub,priv) booleans.
#
sub GetRootKey($)
{
my ($node) = @_;
my $keyref = GeniXML::FindNodesNS("n:rootkey", $node,
$EMULAB_NS)->pop();
return (undef,undef)
if (!defined($keyref));
my $priv = GetText("private", $keyref);
if (defined($priv)) {
$priv = (lc("$priv") eq "true" ? 1 : 0);
}
my $pub = GetText("public", $keyref);
if (defined($pub)) {
$pub = (lc("$pub") eq "true" ? 1 : 0);
}
return ($pub,$priv);
}
sub GetTarball($)
{
my ($node) = @_;
......
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