Commit c8559df8 authored by Mike Hibler's avatar Mike Hibler
Browse files

Merge remote branch 'central/master' into frisbee-mserver

parents f1016e75 9c7182fa
......@@ -82,11 +82,8 @@ if (@ARGV) {
# Add all users to the Trac DB.
#
$query_result =
DBQueryFatal("select distinct uid from group_membership where pid=gid ".
"and (pid='testbed' or pid='tbres' or ".
" pid='utahstud')" .
"");
DBQueryFatal("select uid from users where status!='archived'");
while (my ($uid) = $query_result->fetchrow_array()) {
system("$ADDTRACUSER $uid") == 0
or fatal("Could not add Trac account for $uid");
......
......@@ -2741,7 +2741,7 @@ sub CleanLogFiles($)
if ($file =~ /^.*\.ns$/);
push(@delete, "${workdir}/$1")
if ($file =~ /^(.*\.(log|ptop|top|assign|soln|xml|limits))$/);
if ($file =~ /^(.*\.(log|ptop|top|vtop|assign|soln|xml|limits))$/);
push(@delete, "${workdir}/$1")
if ($file =~ /^((swap|start|cancel|newrun).*\..*)$/);
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2007-2010 University of Utah and the Flux Group.
# Copyright (c) 2007-2011 University of Utah and the Flux Group.
# All rights reserved.
#
package Lan;
......@@ -2990,6 +2990,16 @@ sub AddMember($$)
return $member;
}
#
# Return a list of members for a vlan.
#
sub MemberList($$)
{
my ($self, $plist) = @_;
return $self->GetLan()->MemberList($plist);
}
#
# Get value of an attribute.
#
......
#!/usr/bin/perl -wT
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
......@@ -91,6 +91,9 @@ if (! ($query_result = DBQueryWarn("show tables"))) {
}
while (my ($table) = $query_result->fetchrow()) {
next
if ($table eq "log");
print "Checking $table ...\n";
# virt_routes is too big for this.
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2005, 2006 University of Utah and the Flux Group.
# Copyright (c) 2005-2011 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -20,8 +20,8 @@ my $debug = 0;
my $force = 0;
my $tempfile = "/var/tmp/testbed_dumperrorlog_tempfile";
my $keep_important = 7 * 24 * 60 * 60;
my $keep_any = 4 * 24 * 60 * 60;
my $keep_important = 4 * 24 * 60 * 60;
my $keep_any = 2 * 24 * 60 * 60;
my $max_rows = 300000;
#
......
This diff is collapsed.
......@@ -23,6 +23,33 @@ sub InstallUpdate($$)
my $DESCRIPTORS = "$TOP_SRCDIR/install/descriptors-pgeni.xml";
Phase "cooked-mode", "Setting up cooked mode support", sub {
Phase "generic", "Creating generic interface type", sub {
my $query_result =
DBQueryFatal("select type from interface_types ".
"where type='generic'");
if (! $query_result->numrows) {
if (IMPOTENT_MODE()) {
PhaseWouldHave("Created generic interface type");
}
else {
if (DBQueryWarn("REPLACE INTO interface_capabilities VALUES ".
"('generic','protocols','ethernet')") &&
DBQueryWarn("REPLACE INTO interface_capabilities VALUES ".
"('generic','ethernet_defspeed','100000')") &&
DBQueryWarn("REPLACE INTO interface_types VALUES ".
"('generic',100000,1,'Generic', ".
" 'Generic',1,'RJ45')")) {
PhaseSucceed();
}
else {
PhaseFail("Could not create generic interface type");
}
}
}
else {
PhaseSkip("generic interface type already exists");
}
};
Phase "pcfedphys", "Creating pcfedphys node type", sub {
my $nodetype = NodeType->Lookup("pcfedphys");
if (!defined($nodetype)) {
......
#!/usr/bin/perl -wT
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# Copyright (c) 2008-2011 University of Utah and the Flux Group.
# All rights reserved.
#
package GeniAggregate;
......@@ -767,8 +767,14 @@ sub Start($$$)
my %reloads = ();
foreach my $sliver (@slivers) {
next
if (ref($sliver) ne "GeniSliver::Node");
if (ref($sliver) ne "GeniSliver::Node") {
next
if ($sliver->state() eq "started" && !$restart);
$sliver->Start($version) == 0
or return -1;
next;
}
my $node = Node->Lookup($sliver->resource_id());
if (!defined($node)) {
......@@ -1391,11 +1397,12 @@ sub UnProvision($)
#
sub Start($$)
{
my ($self) = @_;
my ($self, $version) = @_;
return -1
if (! ref($self));
$self->SetState("started");
return 0;
}
......@@ -1475,10 +1482,15 @@ sub Create($$$$$$)
# These are the ips of the tunnel.
my $ip1 = GeniXML::GetText("tunnel_ip", $iface1ref);
my $ip2 = GeniXML::GetText("tunnel_ip", $iface2ref);
my $virtid1 = GeniXML::GetInterfaceNodeId($iface1ref);
my $virtid2 = GeniXML::GetInterfaceNodeId($iface2ref);
my $ctrlip1;
my $ctrlip2;
my $iface1;
my $iface2;
my $manager1;
my $manager2;
my $testing = 1;
# We need the control network addresses, but it is possible that
# one of the nodes is not on this testbed.
......@@ -1488,6 +1500,16 @@ sub Create($$$$$$)
print STDERR "Tunnel: Could not lookup node for $node1sliver\n";
goto bad;
}
if ($testing) {
# Testing
my $manager_id = GeniXML::GetManagerId($node1rspec);
if (!defined($manager_id)) {
print STDERR "No manager id for $linkname\n";
goto bad;
}
$manager1 = $manager_id;
}
my $interface = Interface->LookupControl($node1);
goto bad
if (!defined($interface));
......@@ -1500,22 +1522,34 @@ sub Create($$$$$$)
}
else {
my $component_id = GeniXML::GetNodeId($node1rspec);
my $component = GeniComponent->CreateFromRegistry($component_id);
my $manager_id = GeniXML::GetManagerId($node1rspec);
if (!defined($component)) {
print STDERR "Could not create component for $component_id\n";
goto bad;
}
my $blob = $component->Resolve();
if (!defined($blob)) {
print STDERR "Could not Resolve $component\n";
goto bad;
if (!defined($component_id)) {
if (!defined($manager_id)) {
print STDERR "No manager id for $linkname\n";
goto bad;
}
$manager1 = $manager_id;
$ctrlip1 = "";
}
if (!exists($blob->{'physctrl'}) || !defined($blob->{'physctrl'})) {
print STDERR "Could not get control IP for $component\n";
goto bad;
else {
my $component = GeniComponent->CreateFromRegistry($component_id);
if (!defined($component)) {
print STDERR "Could not create component for $component_id\n";
goto bad;
}
my $blob = $component->Resolve();
if (!defined($blob)) {
print STDERR "Could not Resolve $component\n";
goto bad;
}
if (!exists($blob->{'physctrl'}) || !defined($blob->{'physctrl'})) {
print STDERR "Could not get control IP for $component\n";
goto bad;
}
$ctrlip1 = $blob->{'physctrl'};
}
$ctrlip1 = $blob->{'physctrl'};
}
if (defined($node2sliver)) {
my $node2 = Node->Lookup($node2sliver->resource_id());
......@@ -1523,6 +1557,16 @@ sub Create($$$$$$)
print STDERR "Tunnel: Could not lookup node for $node2sliver\n";
goto bad;
}
if ($testing) {
# Testing
my $manager_id = GeniXML::GetManagerId($node2rspec);
if (!defined($manager_id)) {
print STDERR "No manager id for $linkname\n";
goto bad;
}
$manager2 = $manager_id;
}
my $interface = Interface->LookupControl($node2);
goto bad
if (!defined($interface));
......@@ -1534,23 +1578,35 @@ sub Create($$$$$$)
}
}
else {
my $component_id = GeniXML::GetNodeId($node2rspec);
my $component = GeniComponent->CreateFromRegistry($component_id);
my $component_id = GeniXML::GetNodeId($node2rspec);
my $manager_id = GeniXML::GetManagerId($node2rspec);
if (!defined($component)) {
print STDERR "Could not create component for $component_id\n";
goto bad;
}
my $blob = $component->Resolve();
if (!defined($blob)) {
print STDERR "Could not Resolve $component\n";
goto bad;
if (!defined($component_id)) {
if (!defined($manager_id)) {
print STDERR "No manager id for $linkname\n";
goto bad;
}
$manager2 = $manager_id;
$ctrlip2 = "";
}
if (!exists($blob->{'physctrl'}) || !defined($blob->{'physctrl'})) {
print STDERR "Could not get control IP for $component\n";
goto bad;
else {
my $component = GeniComponent->CreateFromRegistry($component_id);
if (!defined($component)) {
print STDERR "Could not create component for $component_id\n";
goto bad;
}
my $blob = $component->Resolve();
if (!defined($blob)) {
print STDERR "Could not Resolve $component\n";
goto bad;
}
if (!exists($blob->{'physctrl'}) || !defined($blob->{'physctrl'})) {
print STDERR "Could not get control IP for $component\n";
goto bad;
}
$ctrlip2 = $blob->{'physctrl'};
}
$ctrlip2 = $blob->{'physctrl'};
}
# print STDERR "$ip1, $ip2, $ctrlip1, $ctrlip2\n";
......@@ -1558,21 +1614,27 @@ sub Create($$$$$$)
$iface1->SetAttribute("tunnel_ip", $ip1);
$iface1->SetAttribute("tunnel_peerip", $ip2);
$iface1->SetAttribute("tunnel_srcip", $ctrlip1);
$iface1->SetAttribute("tunnel_dstip", $ctrlip2);
$iface1->SetAttribute("tunnel_dstip", ($testing ? "" : $ctrlip2));
$iface1->SetAttribute("tunnel_dsturn", $manager2)
if (defined($manager2));
$iface1->SetAttribute("tunnel_ipmask", "255.255.255.0");
$iface1->SetAttribute("tunnel_lan", $linkname);
$iface1->SetAttribute("tunnel_unit", $iface1->memberid() + 1);
$iface1->SetAttribute("tunnel_style", "gre");
$iface1->SetAttribute("tunnel_peerid", $virtid2);
}
if (defined($iface2)) {
$iface2->SetAttribute("tunnel_ip", $ip2);
$iface2->SetAttribute("tunnel_peerip", $ip1);
$iface2->SetAttribute("tunnel_srcip", $ctrlip2);
$iface2->SetAttribute("tunnel_dstip", $ctrlip1);
$iface2->SetAttribute("tunnel_dstip", ($testing ? "" : $ctrlip1));
$iface2->SetAttribute("tunnel_dsturn", $manager1)
if (defined($manager1));
$iface2->SetAttribute("tunnel_ipmask", "255.255.255.0");
$iface2->SetAttribute("tunnel_lan", $linkname);
$iface2->SetAttribute("tunnel_unit", $iface2->memberid() + 1);
$iface2->SetAttribute("tunnel_style", "gre");
$iface2->SetAttribute("tunnel_peerid", $virtid1);
}
return $aggregate;
......@@ -1631,11 +1693,99 @@ sub UnProvision($)
#
sub Start($$)
{
my ($self) = @_;
my ($self, $version) = @_;
return -1
if (! ref($self));
my $slice = $self->GetSlice();
if (!defined($slice)) {
print STDERR "Could not map $self to its slice\n";
return -1;
}
my $experiment = Experiment->Lookup($self->slice_uuid());
if (!defined($experiment)) {
print STDERR "Could not map $self to its experiment\n";
return -1;
}
my $tunnel = Tunnel->Lookup($experiment, $self->uuid());
if (!defined($tunnel)) {
print STDERR "Could not lookup tunnel entry for $self.\n";
return -1;
}
print STDERR "Starting tunnel $tunnel for $self\n";
my @members = ();
if ($tunnel->MemberList(\@members) != 0) {
print STDERR "Could not get members for $tunnel ($self)\n";
return -1;
}
foreach my $member (@members) {
my $dstip;
if ($member->GetAttribute("tunnel_dstip", \$dstip) != 0) {
print STDERR "Could not dstip for $member in $tunnel ($self)\n";
return -1;
}
if ($dstip eq "") {
#
# Need to contact the other CM to get the info we need, which
# will be in the manifest.
#
my $dsturn;
if ($member->GetAttribute("tunnel_dsturn", \$dsturn) != 0) {
print STDERR "Could not urn for $member in $tunnel ($self)\n";
return -1;
}
my $peerid;
if ($member->GetAttribute("tunnel_peerid", \$peerid) != 0) {
print STDERR "Could not peer for $member in $tunnel ($self)\n";
return -1;
}
my $authority = GeniAuthority->CreateFromRegistry("CM", $dsturn);
if (!defined($authority)) {
print STDERR "Could not lookup authority $dsturn\n";
return -1;
}
my $blob = $authority->Resolve($slice->urn());
if (!defined($blob)) {
print STDERR "Could not resolve $slice at $authority\n";
return -1;
}
if (!exists($blob->{'manifest'})) {
print STDERR "No manifest returned for $dsturn from $self\n";
return -1;
}
my $manifest = GeniXML::Parse($blob->{'manifest'});
#
# Need to find the peer node in the nodes section.
#
foreach my $ref (GeniXML::FindNodes("n:node",
$manifest)->get_nodelist()) {
my $nodeid = GeniXML::GetVirtualId($ref);
next
if ($nodeid ne $peerid);
#
# Okay, got the node. Now we need to resolve it at the CM.
#
my $component_id = GeniXML::GetNodeId($ref);
my $nodeblob = $authority->Resolve($component_id);
if (!defined($nodeblob)) {
print STDERR
"Could not resolve $component_id at $authority\n";
return -1;
}
if (!exists($nodeblob->{'physctrl'}) ||
!defined($nodeblob->{'physctrl'})) {
print STDERR "Could not get control IP for $component_id\n";
return -1;
}
$member->SetAttribute("tunnel_dstip", $nodeblob->{'physctrl'});
}
}
}
$self->SetState("started");
return 0;
}
......@@ -1644,7 +1794,7 @@ sub Start($$)
#
sub Stop($$)
{
my ($self) = @_;
my ($self, $version) = @_;
return -1
if (! ref($self));
......
......@@ -66,9 +66,8 @@ sub Lookup($$)
$uuid = $token;
}
elsif ($token =~ /^P([\w]+)$/) {
# Only SAs are looked up this way.
# This will be flushed after URNs are fully pushed out.
return GeniAuthority->LookupByPrefix($1);
print STDERR "Deprecated authority lookup by prefix\n";
return undef;
}
elsif ($token =~ /^[\w\.]*$/) {
$query_result =
......@@ -94,9 +93,7 @@ sub Lookup($$)
my $self = {};
$self->{'AUTHORITY'} = $query_result->fetchrow_hashref();
$self->{'version'} = undef;
$self->{'apilevel'} = undef;
$self->{'api'} = undef;
$self->{'_version_info'} = undef;
bless($self, $class);
#
......@@ -180,9 +177,12 @@ sub url($) { return field($_[0], "url"); }
sub hrn($) { return field($_[0], "hrn"); }
sub type($) { return field($_[0], "type"); }
sub disabled($) { return field($_[0], "disabled"); }
sub version($) { return $_[0]->{"version"}; }
sub apilevel($) { return $_[0]->{"apilevel"}; }
sub api($) { return $_[0]->{"api"}; }
sub _version_info($) { return $_[0]->{"_version_info"}; }
sub version($) { return $_[0]->VersionInfo()->{"version"}; }
sub apilevel($) { return $_[0]->VersionInfo()->{"apilevel"}; }
sub api($) { return $_[0]->VersionInfo()->{"api"}; }
sub issfa($) { return $_[0]->VersionInfo()->{"issfa"}; }
sub versiondata($) { return $_[0]->VersionInfo()->{"versiondata"}; }
sub cert($) { return $_[0]->{'CERT'}->cert(); }
sub GetCertificate($) { return $_[0]->{'CERT'}; }
......@@ -266,6 +266,8 @@ sub CheckExisting($$)
#
# Create authority from the ClearingHouse, by looking up the info.
# All authorities are currently stored in the Utah Emulab ClearingHouse,
# at least until we can deal with multiple clearinghouses/registries.
#
sub CreateFromRegistry($$$)
{
......@@ -310,12 +312,12 @@ sub CreateFromRegistry($$$)
#
# Get Version. Ask the Authority what version it is running.
#
sub Version($)
sub VersionInfo($)
{
my ($self) = @_;
return $self->version()
if (defined($self->version()));
return $self->_version_info()
if (defined($self->_version_info()));
#
# The caller had to set up the xmlrpc context.
......@@ -332,38 +334,49 @@ sub Version($)
print STDERR " " . $response->output() . "\n";
return undef;
}
my $ref = {"versiondata" => $response->value() };
if (ref($response->value())) {
# Look for the AM interface.
if (exists($response->value()->{'geni_api'})) {
$self->{'version'} = $response->value()->{'geni_api'};
$ref->{'version'} = $response->value()->{'geni_api'};
# This was wrong; it should be 2.0 not 1.0
$self->{'version'} = 2.0 if ($self->{'version'} == 1.0);
$self->{'apilevel'} = 0;
$self->{'api'} = "AM";
$ref->{'version'} = 2.0 if ($ref->{'version'} == 1.0);
$ref->{'apilevel'} = 0;
$ref->{'api'} = "AM";
$ref->{'issfa'} = exists($response->value()->{'sfa'});
}
else {
$self->{'version'} = $response->value()->{'api'};
$self->{'apilevel'} = $response->value()->{'level'};
$self->{'api'} = "CM";
$ref->{'version'} = $response->value()->{'api'};
$ref->{'apilevel'} = $response->value()->{'level'};
$ref->{'api'} = "CM";
$ref->{'issfa'} = 0;
}
}
else {
$self->{'version'} = $response->value();
$self->{'apilevel'} = 1;
$self->{'api'} = "CM";
$ref->{'version'} = $response->value();
$ref->{'apilevel'} = 1;
$ref->{'api'} = "CM";
$ref->{'issfa'} = 0;
}
return $self->{'version'};
$self->{'_version_info'} = $ref;
return $ref;
}
# Ditto for the API level
sub ApiLevel($)
sub Version($)
{
my ($self) = @_;
return $self->apilevel()
if (defined($self->apilevel()));
return undef
if (!defined($self->VersionInfo()));
return $self->version();
}
sub ApiLevel($)
{
my ($self) = @_;
return undef
if (!defined($self->Version()));
if (!defined($self->VersionInfo()));
return $self->apilevel();
}
......@@ -371,14 +384,20 @@ sub Api($)
{
my ($self) = @_;
return $self->api()
if (defined($self->api()));
return undef
if (!defined($self->Version()));
if (!defined($self->VersionInfo()));
return $self->api();
}
sub IsSFA($)
{
my ($self) = @_;
return undef
if (!defined($self->VersionInfo()));
return $self->issfa();
}
#
# Check that the authority is the issuer of the given certificate.
......@@ -460,6 +479,69 @@ sub LookupByPrefix($$)
return GeniAuthority->Lookup($uuid);
}
#
# Set the disabled bit.
#
sub Disable($)
{
my ($self) = @_;
my $urn = $self->urn();
DBQueryWarn("update geni_authorities set disabled=1 ".
"where urn='$urn'")
or return -1;
return 0;
}
#
# Resolve something at an authority
#
sub Resolve($$)
{
my ($self, $urn) = @_;
my $manager_version = $self->Version();
<