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

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 7d153ac4 567127cf
......@@ -60,6 +60,11 @@ my %msgs = ();
my $reload_time = 600;
my $last_reload = time;
# For startup and reload: maximum time in the past for which we will schedule
# a timeout. Anything older is assumed to be ancient history and is ignored.
# Note it is a negative value.
my $maxpasttimeout = -(2 * 24 * 60 * 60); # 2 days
# Handling of SECVIOLATIONS, eventually controlled by a sitevar
my $soft_secviolation = 1;
......@@ -260,7 +265,7 @@ sub process_event_queue() {
my $lastcount=-1;
my $wait;
my $now = time();
debug("Polling - mq=$mailqueue bw=$blockwait\n");
debug("Polling at $now - mq=$mailqueue bw=$blockwait ndl=$nextdeadline\n");
if ( $mailqueue == 0) {
# no messages waiting...
if ($blockwait) {
......@@ -334,16 +339,16 @@ while (1) {
}
$nextdeadline = $deadline;
if (qsize()==0) {
$blockwait=1;
debug("---Blocking wait okay---\n");
}
if ($do_reload || ($now - $last_reload > $reload_time)) {
reload();
$do_reload = 0;
}
if (qsize()==0) {
$blockwait=1;
debug("---Blocking wait okay---\n");
}
# Send any messages in the queue if it is time
notify("",1);
......@@ -364,6 +369,7 @@ exit(0);
# Read the current states of nodes from the database
sub readStates(;@) {
my %oldnodes = @_;
my $now = time();
# Guard against undefined variable warnings
if (! %oldnodes) {
......@@ -411,8 +417,14 @@ sub readStates(;@) {
$nodes{$node_id}{timedout} = 0;
$nodes{$node_id}{noretry} = 0;
# Is there a timeout? If so, set it up!
if ($dbtag eq $nodes{$node_id}{"tag"}) {
setTimeout($mode,$state,$node_id,$timestamp);
if (defined($timestamp) && $dbtag eq $nodes{$node_id}{"tag"}) {
my $TO = $timestamp - $now;
if ($TO > $maxpasttimeout) {
setTimeout($mode,$state,$node_id,$timestamp);
} else {
debug("Ignoring ancient timeout $TO for ",
"($node_id,$mode,$state)\n");
}
}
}
}
......@@ -1876,6 +1888,13 @@ sub PollEvents($$)
fatal("unrecognizable line $line from event reader");
}
}
#
# If there is still more immediately available, loop back
# and read again. Otherwise stop.
#
if ($eventpoll->poll(0) <= 0) {
last;
}
}
}
elsif ($pollval < 0) {
......
......@@ -108,6 +108,10 @@ sub Lookup($$)
# Add to cache.
$authorities{$self->{'AUTHORITY'}->{'uuid'}} = $self;
# Get the domain as a convenience.
my ($domain,undef,undef) = GeniHRN::Parse($self->{'AUTHORITY'}->{'urn'});
$self->{'DOMAIN'} = $domain;
return $self;
}
......@@ -177,6 +181,8 @@ sub url($) { return field($_[0], "url"); }
sub hrn($) { return field($_[0], "hrn"); }
sub type($) { return field($_[0], "type"); }
sub disabled($) { return field($_[0], "disabled"); }
# Convenience.
sub domain($) { return $_[0]->{"DOMAIN"}; }
sub _version_info($) { return $_[0]->{"_version_info"}; }
sub version($) { return $_[0]->VersionInfo()->{"version"}; }
sub apilevel($) { return $_[0]->VersionInfo()->{"apilevel"}; }
......
......@@ -1201,6 +1201,8 @@ sub GetTicketAuxAux($$$$$$$$$)
goto bad;
}
my (undef,undef,$network_id) = GeniHRN::Parse($hop_urn);
# We seem to ignore this for now, since the node we want
# to use is inside the network data structure.
my $iface_node_urn =
GeniXML::GetText("component_node_urn", $ifaceref);
my $iface_iface_id =
......@@ -1235,7 +1237,7 @@ sub GetTicketAuxAux($$$$$$$$$)
"$lanname: unknown component_hop");
goto bad;
}
my $network_node = Node->Lookup($iface_node_id);
my $network_node = Node->Lookup($network->node_id());
if (!defined($network_node)) {
$response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef,
......
......@@ -1554,13 +1554,18 @@ sub ReserveVlanTags($)
my $taglist = $argref->{'taglist'};
my $response;
my $actualtag;
my ($myauth,undef,undef) = GeniHRN::Parse($ENV{'MYURN'});
# List of vlans to delete after getting the tags.
my @delete = ();
my %linkmap = ();
require Lan;
my $me = GeniAuthority->Lookup($ENV{'MYURN'});
if (!defined($me)) {
print STDERR
"Could not find local authority object for $ENV{'MYURN'}\n";
return GeniResponse->Create(GENIRESPONSE_ERROR);
}
if (! (defined($credentials) && defined($slice_cert) &&
defined($taglist) &&
defined($linkname) && defined($slice_urn) && defined($rspecstr))) {
......@@ -1699,8 +1704,8 @@ sub ReserveVlanTags($)
foreach my $ref (GeniXML::FindNodes("n:component_hop",
$linkref)->get_nodelist()) {
my $component_urn = GeniXML::GetNodeId($ref);
my ($auth,undef,undef) = GeniHRN::Parse($component_urn);
if (defined($auth) and $auth eq $myauth) {
my ($domain,undef,undef) = GeniHRN::Parse($component_urn);
if (defined($domain) and $domain eq $me->domain()) {
$hopref = $ref;
last;
}
......@@ -1793,8 +1798,8 @@ sub ReserveVlanTags($)
# Get the last two tokens. Not always the right thing to do.
my $dom = join('.', splice(@tmp, -2, 2));
if ($myauth =~ /$dom$/ && $hisauth =~ /$dom$/) {
print STDERR "ElabInElab clause is true: $myauth $hisauth\n";
if ($me->domain() =~ /$dom$/ && $hisauth =~ /$dom$/) {
print STDERR "ElabInElab clause is true\n";
my $tag = pop(@tags);
if ($vlan->ReserveVlanTag($tag)) {
......
......@@ -19,8 +19,6 @@ sub usage()
exit(1);
}
my $optlist = "";
my $mintag = 750;
my $maxtag = 1000;
my $other_manager;
#
# Configure variables
......@@ -139,6 +137,33 @@ if (!defined($other_manager)) {
fatal("Who is the other manager?");
}
#
# Go through the component hops and find the one that refers to us.
# This is our external network point.
#
my $hopref;
foreach my $ref (GeniXML::FindNodes("n:component_hop",
$linkref)->get_nodelist()) {
my $component_urn = GeniXML::GetNodeId($ref);
my ($domain,undef,undef) = GeniHRN::Parse($component_urn);
if (defined($domain) and $domain eq $me->domain()) {
$hopref = $ref;
last;
}
}
if (!defined($hopref)) {
fatal("Could not find hop in link");
}
my $hop_urn = GeniXML::GetNodeId($hopref);
my (undef,undef,$network_id) = GeniHRN::Parse($hop_urn);
my $network = ExternalNetwork->Lookup($network_id);
if (!defined($network)) {
fatal("$hop_urn is not an external network");
}
# The bounds of the vlan tags we can use for this network point.
my $mintag = $network->min_vlan();
my $maxtag = $network->max_vlan();
#
# Need the slice experiment as the context within to allocate the
# the tags.
......@@ -270,7 +295,8 @@ sub ReserveLocalTags(@)
while (@otags) {
my $t = pop(@otags);
push(@try, $t)
if (VLan->VlanTagAvailable($t));
if ($network->VlanTagOkay($t) &&
VLan->VlanTagAvailable($t));
# But do not let the other CM make us reserve too many at once
last
......
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