Commit 748240a9 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Small set of changes to make the SPP nodes work from

the protogeni interface.
parent 286f9099
...@@ -588,6 +588,7 @@ sub GetTicketAuxAux($$$$$$$$) ...@@ -588,6 +588,7 @@ sub GetTicketAuxAux($$$$$$$$)
} }
# Turn off fixnode; we will control this on the commandline. # Turn off fixnode; we will control this on the commandline.
$virtexperiment->allowfixnode(0); $virtexperiment->allowfixnode(0);
$virtexperiment->multiplex_factor(3);
# This is where nodes are parked until a ticket is redeemed. # This is where nodes are parked until a ticket is redeemed.
# This experiment no longer has to exist. # This experiment no longer has to exist.
...@@ -722,13 +723,22 @@ sub GetTicketAuxAux($$$$$$$$) ...@@ -722,13 +723,22 @@ sub GetTicketAuxAux($$$$$$$$)
if (defined($virtualization_type)) { if (defined($virtualization_type)) {
if ($virtualization_type eq "emulab-vnode") { if ($virtualization_type eq "emulab-vnode") {
if (defined($virtualization_subtype)) { if (defined($virtualization_subtype)) {
$pctype = "pcvm";
if ($virtualization_subtype eq "emulab-jail") { if ($virtualization_subtype eq "emulab-jail") {
$osname = "FBSD-JAIL"; $osname = "FBSD-JAIL";
} }
elsif ($virtualization_subtype eq "emulab-openvz") { elsif ($virtualization_subtype eq "emulab-openvz") {
$osname = "OPENVZ-STD"; $osname = "OPENVZ-STD";
} }
$pctype = "pcvm"; elsif ($virtualization_subtype eq "emulab-spp") {
$osname = "SPPVM-FAKE";
$pctype = "sppvm";
# Lets force to shared node.
$ref->{'exclusive'} = $exclusive = 0;
# Kludge for libvtop.
$virtexperiment->multiplex_factor(1);
}
} }
else { else {
goto raw; goto raw;
...@@ -894,6 +904,7 @@ sub GetTicketAuxAux($$$$$$$$) ...@@ -894,6 +904,7 @@ sub GetTicketAuxAux($$$$$$$$)
my $interfaces = $linkref->{'linkendpoints'} || my $interfaces = $linkref->{'linkendpoints'} ||
$linkref->{'interface_ref'}; $linkref->{'interface_ref'};
my $ifacenum = 1; my $ifacenum = 1;
my $trivial_ok = 0;
if (!defined($lanname)) { if (!defined($lanname)) {
$response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef, $response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
...@@ -1000,7 +1011,7 @@ sub GetTicketAuxAux($$$$$$$$) ...@@ -1000,7 +1011,7 @@ sub GetTicketAuxAux($$$$$$$$)
{"vname" => $lanname, {"vname" => $lanname,
"vnode" => $node_nickname, "vnode" => $node_nickname,
"vport" => $iface_vport, "vport" => $iface_vport,
"trivial_ok" => 1, "trivial_ok" => $trivial_ok,
"ip" => $ip, "ip" => $ip,
"delay" => 0.0, "delay" => 0.0,
"bandwidth" => $bandwidth, # kbps "bandwidth" => $bandwidth, # kbps
...@@ -1047,7 +1058,7 @@ sub GetTicketAuxAux($$$$$$$$) ...@@ -1047,7 +1058,7 @@ sub GetTicketAuxAux($$$$$$$$)
"Could not verify topo"); "Could not verify topo");
goto bad; goto bad;
} }
system("$MAPPER -n -d -v -m 3 -u -o $tmpfile $pid $eid"); system("$MAPPER -n -d -v -u -o $tmpfile $pid $eid");
if ($?) { if ($?) {
$response = $response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef, GeniResponse->Create(GENIRESPONSE_ERROR, undef,
...@@ -1757,7 +1768,7 @@ sub SliverWorkAux($$$$$$$) ...@@ -1757,7 +1768,7 @@ sub SliverWorkAux($$$$$$$)
goto bad; goto bad;
} }
# Add -u for update mode, but not -f (fixnode). # Add -u for update mode, but not -f (fixnode).
system("$MAPPER -d -v -u -m 3 $pid $eid"); system("$MAPPER -d -v -u $pid $eid");
if ($?) { if ($?) {
print STDERR "Mapper failed!\n"; print STDERR "Mapper failed!\n";
# Dump the vtop. # Dump the vtop.
......
...@@ -32,6 +32,9 @@ use GeniHRN; ...@@ -32,6 +32,9 @@ use GeniHRN;
use English; use English;
use XML::Simple; use XML::Simple;
use Data::Dumper; use Data::Dumper;
use Date::Parse;
use POSIX qw(strftime);
use Time::Local;
# Configure variables # Configure variables
my $TB = "@prefix@"; my $TB = "@prefix@";
...@@ -866,6 +869,76 @@ sub Shutdown($) ...@@ -866,6 +869,76 @@ sub Shutdown($)
return GeniResponse->Create(GENIRESPONSE_SUCCESS); return GeniResponse->Create(GENIRESPONSE_SUCCESS);
} }
#
# Extend a slice expiration time.
#
sub RenewSlice($)
{
my ($argref) = @_;
my $credstr = $argref->{'credential'};
my $expires = $argref->{'valid_until'};
my $message = "Error renewing slice";
if (! (defined($credstr) && defined($expires))) {
return GeniResponse->Create(GENIRESPONSE_BADARGS);
}
my $credential = GeniCredential->CreateFromSigned($credstr);
if (!defined($credential)) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Could not create GeniCredential object");
}
#
# Make sure the credential was issued to the caller.
#
if ($credential->owner_uuid() ne $ENV{'GENIUUID'}) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"This is not your credential!");
}
my $slice = GeniSlice->Lookup($credential->target_uuid());
if (!defined($slice)) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Unknown slice for this credential");
}
$credential->HasPrivilege( "pi" ) or
$credential->HasPrivilege( "bind" ) or
return GeniResponse->Create( GENIRESPONSE_FORBIDDEN, undef,
"Insufficient privilege" );
#
# Figure out new expiration time; this is the time at which we can
# idleswap the slice out.
#
if (! ($expires =~ /^[-\w:.\/]+/)) {
$message = "Illegal valid_until in rspec";
goto bad;
}
# Convert to a localtime.
my $when = timegm(strptime($expires));
if (!defined($when)) {
$message = "Could not parse valid_until";
goto bad;
}
#
# Do we need a policy limit?
#
my $diff = $when - time();
if ($diff < (60 * 5) || $diff > (3600 * 24 * 100)) {
$message = "valid_until out of range";
goto bad;
}
if ($slice->SetExpiration($when) != 0) {
$message = "Could not set expiration time";
goto bad;
}
return GeniResponse->Create(GENIRESPONSE_SUCCESS);
bad:
return GeniResponse->Create(GENIRESPONSE_ERROR, undef, $message);
}
# #
# Register a sliver. # Register a sliver.
# #
......
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