Commit 1ce85191 authored by Leigh Stoller's avatar Leigh Stoller

When allocating widearea virtual nodes, look for a global capacity

attribute in the types table to cap the number of allowed virtual
nodes on each physnode (by type). We have to look in the reserved
table to see how many already allocated on each physnode, and adjust
the counts accordingly. Doing it here (via assign_wrapper) is not
atomic and so it could fail to catch an over subscription, but on a
lightly used testbed this will not be a problem in practice.
parent 31e8a42d
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -80,6 +80,7 @@ my %permissions = ();
my %typemap = ();
my %auxtypemap = ();
my %areamap = ();
my %globalcounts = ();
my $DEADPID = NODEDEAD_PID();
my $DEADEID = NODEDEAD_EID();
......@@ -160,6 +161,7 @@ while (my ($class,$type,$isvirt) = $result->fetchrow_array) {
$map->{'OSID'} = $typeinfo->default_osid();
$map->{'IMAGEABLE'}= $typeinfo->imageable();
$map->{'TRIVSPEED'}= $typeinfo->trivlink_maxspeed();
$map->{'TYPEINFO'} = $typeinfo;
$map->{'FEATURES'} = [];
$map->{'AUXTYPES'} = {};
$typemap{$type} = $map;
......@@ -305,6 +307,17 @@ else {
}
}
#
# Get the global counts.
#
$result =
DBQueryFatal("select phys_nodeid,count(phys_nodeid) from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"where n.node_id!=n.phys_nodeid group by phys_nodeid");
while (my ($node_id,$count) = $result->fetchrow_array) {
$globalcounts{$node_id} = $count;
}
# Find available nodes.
#
# This first query deals with just local nodes. Local nodes can host
......@@ -655,6 +668,21 @@ if ($widearea) {
my @types;
my @features;
my @flags;
my $maxvnodes;
#
# Grab the global allocation count of vnodes on this pnode (if there
# is one). This modifies the counts below. If the count has already
# been reached, then do not put this node into the ptop file.
#
$maxvnodes =
$typemap{$ptype}->{'TYPEINFO'}->GetAttribute("global_capacity");
if (defined($maxvnodes) && exists($globalcounts{$physnode})) {
$maxvnodes -= $globalcounts{$physnode};
next
if ($maxvnodes <= 0);
}
#
# Mark any nodes that are not up with a feature, so that they won't
......@@ -679,6 +707,9 @@ if ($widearea) {
foreach my $auxinfo (@{$auxtypes{$physnode}}) {
my ($auxtype,$count) = split(":", $auxinfo);
$count = $maxvnodes
if (defined($maxvnodes) && $maxvnodes < $count);
if (defined($mfactor) && $mfactor <= $count) {
$auxinfo = "$auxtype:$mfactor";
}
......
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