Commit 04206982 authored by Leigh B Stoller's avatar Leigh B Stoller

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

parents 53025de5 d4e145e7
......@@ -77,6 +77,7 @@ $| = 1;
use lib "@prefix@/lib";
use libtestbed;
use libdb qw(TBSetSiteVar TBOPSPID DBQueryFatal);
use emutil qw(TBGetUniqueIndex);
use User;
use Project;
use Experiment;
......
......@@ -415,6 +415,10 @@ if ($pid) {
$osidquery .= " or i.pid='$pid'";
}
my $defaultosidquery = 'select distinct o.osid, t.type, o.osname, o.pid, o.OS, o.version, o.description, o.protogeni_export '.
'from os_info as o left join node_type_attributes as t '.
'on (o.osid=t.attrvalue) where t.attrkey="default_osid"';
#
# For subOS support (i.e., vnode OSes running atop vhost OSes), we have to
# check both the subosid and all the parent_osid it can run on.
......@@ -434,45 +438,55 @@ if ($pid) {
}
$subosidquery .= ")";
my %node_type_osids;
my %osid_node_types;
my %osid_subosids;
my %osid_name;
my %osid_pid;
my %osid_os;
my %osid_version;
my %osid_description;
my %node_countries;
my %node_latitudes;
my %node_longitudes;
our %node_type_osids;
our %osid_node_types;
our %osid_subosids;
our %osid_name;
our %osid_pid;
our %osid_os;
our %osid_version;
our %osid_description;
our %node_countries;
our %node_latitudes;
our %node_longitudes;
$result = DBQueryFatal($osidquery);
while (my ($osid,$type,$osname,$ospid,$osos,
$osversion,$osdescription,$geni) = $result->fetchrow()) {
if ($typemap{$type}) {
my $default = $typemap{$type}->{'OSID'};
if ($geni eq 1 ||
(defined($default) && $default eq $osid)) {
push(@{ $typemap{$type}->{'OSLIST'} }, $osid);
$osid_name{$osid} = $osname;
$osid_pid{$osid} = $ospid;
$osid_os{$osid} = $osos;
$osid_version{$osid} = $osversion;
$osid_description{$osid} = $osdescription;
}
}
if ($node_type_osids{$type}) {
push @{$node_type_osids{$type}}, $osid;
} else {
$node_type_osids{$type} = [$osid];
}
#
# We have to maintain a data structure telling us which types an OSID could
# be on for use below with generic OSIDs
#
if ($osid_node_types{$osid}) {
push @{$osid_node_types{$osid}}, $type;
} else {
$osid_node_types{$osid} = [$type];
processOs($result);
$result = DBQueryFatal($defaultosidquery);
processOs($result);
sub processOs
{
my $result = shift(@_);
while (my ($osid,$type,$osname,$ospid,$osos,
$osversion,$osdescription,$geni) = $result->fetchrow()) {
if ($typemap{$type}) {
my $default = $typemap{$type}->{'OSID'};
if ($geni eq 1 ||
(defined($default) && $default eq $osid)) {
push(@{ $typemap{$type}->{'OSLIST'} }, $osid);
$osid_name{$osid} = $osname;
$osid_pid{$osid} = $ospid;
$osid_os{$osid} = $osos;
$osid_version{$osid} = $osversion;
$osid_description{$osid} = $osdescription;
}
}
if ($node_type_osids{$type}) {
push @{$node_type_osids{$type}}, $osid;
} else {
$node_type_osids{$type} = [$osid];
}
#
# We have to maintain a data structure telling us which types an OSID could
# be on for use below with generic OSIDs
#
if ($osid_node_types{$osid}) {
push @{$osid_node_types{$osid}}, $type;
} else {
$osid_node_types{$osid} = [$type];
}
}
}
#
......
......@@ -175,15 +175,20 @@ else {
USERERROR("Bad page arguments!", 1);
}
$startclause = ($startwith ? "t.idx<$startwith " : "");
# Do the endwith to ensure the query does not take too long
$endwith = ($startwith ? $startwith - 1000 : 0);
$startclause = ($startwith ? "(t.idx<$startwith and t.idx>$endwith)" : "");
if (strlen($wclause)) {
if (strlen($startclause)) {
$wclause = "$wclause and $startclause";
}
}
else if (strlen($startclause)) {
$wclause = "where ($startclause)";
}
else {
$wclause = $startclause;
$wclause = "";
}
$query_result =
......
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