Commit ee5f241d authored by Leigh Stoller's avatar Leigh Stoller

Implement OS list optimization described in issue #415. Lets try it on

the Mothership for a while and see what breaks
parent 72b4ba32
......@@ -139,6 +139,7 @@ sub Create($$$$;$)
"fixed" => [] };
$self->{'RSPEC'} = {};
$self->{'GENIRSPEC'} = undef;
$self->{'IMAGES'} = undef;
# For forcing untyped nodes to an architecture.
$self->{'FORCEARCH'} = undef;
......@@ -202,6 +203,7 @@ sub pnodes($) { return $_[0]->{'PNODES'}; }
sub fixednodes($) { return $_[0]->{'FIXEDNODES'}; }
sub newreserved($) { return $_[0]->{'NEWRESERVED'}; }
sub clearnewreserved($) { $_[0]->{'NEWRESERVED'} = {}; }
sub allimages($) { return $_[0]->{'IMAGES'}; }
sub rspec($) { return $_[0]->{'RSPEC'}; }
sub genirspec($) { return $_[0]->{'GENIRSPEC'}; }
sub forcedarchitecture($){ return $_[0]->{'FORCEARCH'}; }
......
......@@ -139,6 +139,7 @@ sub Create($$$$;$)
"fixed" => [] };
$self->{'RSPEC'} = {};
$self->{'GENIRSPEC'} = undef;
$self->{'IMAGES'} = {};
# For forcing untyped nodes to an architecture.
$self->{'FORCEARCH'} = undef;
......@@ -202,6 +203,7 @@ sub pnodes($) { return $_[0]->{'PNODES'}; }
sub fixednodes($) { return $_[0]->{'FIXEDNODES'}; }
sub newreserved($) { return $_[0]->{'NEWRESERVED'}; }
sub clearnewreserved($) { $_[0]->{'NEWRESERVED'} = {}; }
sub allimages($) { return $_[0]->{'IMAGES'}; }
sub rspec($) { return $_[0]->{'RSPEC'}; }
sub genirspec($) { return $_[0]->{'GENIRSPEC'}; }
sub forcedarchitecture($){ return $_[0]->{'FORCEARCH'}; }
......@@ -2506,12 +2508,17 @@ sub GenVirtNodes($)
if (!defined($posinfo)) {
my $jailosinfo = $self->nodejailosinfo($vnode);
$desires->{"OS-" . $jailosinfo->osid()} = ['', 1.000000];
# For ptopgen.
$self->allimages()->{$jailosinfo->osid()} = 1;
}
else {
$desires->{"OS-" . $posinfo->osid()} = ['', 1.000000];
$desires->{"OS-" . $posinfo->osid() . "-" . $osinfo->osid()} =
['', 1.000000];
my $osid = $osinfo->osid();
my $posid = $posinfo->osid();
$desires->{"OS-" . $posid} = ['', 1.000000];
$desires->{"OS-" . $posid . "-" . $osid} = ['', 1.000000];
# For ptopgen.
$self->allimages()->{$posid} = 1;
$self->allimages()->{$posid . "-" . $osid} = 1;
}
}
elsif (!$osinfo->mfs()) {
......@@ -2521,11 +2528,17 @@ sub GenVirtNodes($)
#
if (!defined($posinfo)) {
$desires->{"OS-" . $osinfo->osid()} = ['', 1.000000];
# For ptopgen.
$self->allimages()->{$osinfo->osid()} = 1;
}
else {
$desires->{"OS-" . $posinfo->osid()} = ['', 1.000000];
$desires->{"OS-" . $posinfo->osid() . "-" . $osinfo->osid()} =
['', 1.000000];
my $osid = $osinfo->osid();
my $posid = $posinfo->osid();
$desires->{"OS-" . $posid} = ['', 1.000000];
$desires->{"OS-" . $posid . "-" . $osid} = ['', 1.000000];
# For ptopgen.
$self->allimages()->{$posid} = 1;
$self->allimages()->{$posid . "-" . $osid} = 1;
}
}
}
......@@ -4377,6 +4390,8 @@ sub CreateVtop($;$)
$self->options()->{'delay_desire_type'} = '';
$self->options()->{'delay_desire_name'} = "OS-$osid";
$self->options()->{'delay_desire_penalty'} = '1';
# For ptopgen.
$self->allimages()->{$osid} = 1;
}
else {
$self->options()->{'delay_desire_type'} = '';
......
......@@ -684,6 +684,7 @@ sub RunAssign($$)
my ($precheck, $prefix) = @_;
my $typelimitfile = $prefix .".limits";
my $imagelistfile = $prefix .".images";
my $ptopfile = $prefix . ".ptop";
my $vtopfile = $prefix . ".vtop";
if ($userspec) {
......@@ -811,6 +812,22 @@ sub RunAssign($$)
close(TYPELIMIT);
}
#
# Give ptopgen a clue about images are is use by the vtop file,
# to shrink the size of the ptop file (the nodes lines are huge!).
#
unlink($imagelistfile)
if (-e $imagelistfile);
if (defined($vtop->allimages())) {
open(IM, ">$imagelistfile") or
return -1;
foreach my $osid (keys(%{$vtop->allimages()})) {
print IM "$osid\n";
}
close(IM);
}
#
# Snapshot physical resources.
......@@ -856,6 +873,8 @@ sub RunAssign($$)
}
$ptopargs .= "-l $typelimitfile "
if (scalar(keys(%admission_control)));
$ptopargs .= "-I $imagelistfile "
if (-e $imagelistfile);
chat("ptopargs: '$ptopargs'\n");
TBDebugTimeStamp("ptopgen started");
......
......@@ -86,7 +86,7 @@ sub usage()
exit(-1);
}
my $optlist = "s:e:m:vp:rSan:c:uxg:h1:l:zZCbfGR";
my $optlist = "s:e:m:vp:rSan:c:uxg:h1:l:zZCbfGRI:";
my $is_advertisement = 0;
my $mfactor;
my $virtstuff = 0;
......@@ -237,6 +237,8 @@ my %globalcounts = ();
my %interfacestate= ();
my %vinterfaces = ();
my %rusagedata = ();
my %imagelist = ();
my $typelimitfile;
my $DEADPID = NODEDEAD_PID();
my $DEADEID = NODEDEAD_EID();
......@@ -246,7 +248,6 @@ my $exempt_eid;
my $switchtouse;
my $experiment;
my $typelimitfile = "";
sub fatal($);
......@@ -328,6 +329,19 @@ if (defined($options{"x"})) {
if (defined($options{"l"})) {
$typelimitfile = $options{"l"};
}
if (defined($options{"I"})) {
my $filename = $options{"I"};
open(IM, "< $filename") or
die("Count not open type limit file $filename\n");
my @imlist = <IM>;
close(IM);
foreach $line (@imlist) {
chomp($line);
$imagelist{$line} = $line;
}
}
if (defined($options{"1"})) {
$component_name = $options{"1"};
}
......@@ -1665,7 +1679,10 @@ foreach $node (@nodenames) {
push(@features, "OS-$osid:0.5");
# Add any subOSes the shared node osid can support
if (defined($osid_subosids{$osid})) {
push (@features, map "OS-$osid-$_:0", @{$osid_subosids{$osid}});
foreach my $o2 (@{$osid_subosids{$osid}}) {
push @features, "OS-$osid-$o2:0"
if (exists($imagelist{"${osid}-${o2}"}));
}
}
}
elsif ($node_type_osids{$type}) {
......@@ -1675,9 +1692,11 @@ foreach $node (@nodenames) {
#
foreach my $o1 (@{$node_type_osids{$type}}) {
if (! exists($node_usb{$node}) || ! exists($osid_avoid_usb{$o1})) {
push @features, "OS-$o1:0";
push @features, "OS-$o1:0"
if (exists($imagelist{$o1}));
foreach my $o2 (@{$osid_subosids{$o1}}) {
push @features, "OS-$o1-$o2:0";
push @features, "OS-$o1-$o2:0"
if (exists($imagelist{"${o1}-${o2}"}));
}
}
}
......@@ -2864,7 +2883,7 @@ sub print_osids
sub print_type_limits
{
if ($typelimitfile ne "") {
if ($typelimitfile) {
open(TYPELIMIT, "<$typelimitfile") or
die("Count not open type limit file $typelimitfile\n");
my @typelimits = <TYPELIMIT>;
......
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