Commit 456c8137 authored by Leigh B Stoller's avatar Leigh B Stoller

Adjust boot waittime if there image backed datasets on the node. Use cheezy

metric until Mike adds uncompressed data size to the images table.
parent c21a0617
......@@ -637,6 +637,38 @@ sub ConvertToMebi($)
return $size;
}
#
# Compute a load time estimate for an image backed dataset.
#
sub LoadEstimate($)
{
my ($blockstore) = @_;
my $bsname = $blockstore->vname();
require Image;
if (!exists($blockstore->{'attributes'}->{"dataset"})) {
print STDERR "No dataset attribute for $bsname\n";
return -1;
}
my $dataset = $blockstore->{'attributes'}->{"dataset"};
my $image = Image->Lookup($dataset);
if (!defined($image)) {
print STDERR "No image for dataset $dataset for $bsname\n";
return -1;
}
# Bad, but don't want to use bignums to get MBs.
my $size = int(($image->lba_high() - $image->lba_low()) *
($image->lba_size() / (1024.0 * 1024.0)));
#
# Temporary approach; look for the size attribute and use that
# to extend the waittime. Later we will use the amount of actual
# data.
#
my $extratime = int($size / 100);
return $extratime;
}
############################################################################
#
# Package to describe a specific reservation of a blockstore.
......
......@@ -6342,7 +6342,8 @@ sub ClearGlobalIPAllocation($)
}
#
# Find the blockstore details from the virt table.
# Find the blockstore details from the virt table. We should
# make this a first class object, but too lazy right now.
#
sub LookupBlockstore($$)
{
......@@ -6358,9 +6359,43 @@ sub LookupBlockstore($$)
last;
}
}
if (defined($blockstore)) {
$blockstore->{'attributes'} = {};
foreach my $row
($virtexp->Table("virt_blockstore_attributes")->Rows()) {
if ($row->vname() eq $bsname) {
$blockstore->{'attributes'}->{$row->attrkey()} =
$row->attrvalue();
}
}
}
return $blockstore;
}
#
# Lookup blockstores for a node in the topology.
#
sub LookupBlockstoresForNode($$)
{
my ($self, $vname) = @_;
my @blockstores = ();
# Now get this after we are sure we need it.
my $virtexp = $self->GetVirtExperiment();
foreach my $bs ($virtexp->Table("virt_blockstores")->Rows()) {
if ($bs->fixed() eq $vname) {
my $blockstore = $self->LookupBlockstore($bs->vname());
if (!defined($blockstore)) {
print STDERR "Could not get blockstore for $vname\n";
return undef;
}
push(@blockstores, $blockstore);
}
}
return @blockstores;
}
sub LookupAddressPools($$)
{
my ($self, $pool_id_arg) = @_;
......
......@@ -1688,6 +1688,26 @@ sub WaitForNodes($$@)
$node->_parent()->_waitend(time());
}
}
# Adjust for image backed datasets which take more time to load.
my @blockstores = $experiment->LookupBlockstoresForNode($node->vname());
if (@blockstores) {
require Blockstore;
foreach my $blockstore (@blockstores) {
next
if ($blockstore->type() ne "imdataset");
my $bsname = $blockstore->vname();
my $extra = Blockstore::LoadEstimate($blockstore);
if ($extra < 0) {
print STDERR
"*** Could not compute load estimate for $bsname\n";
next;
}
print "Adding $extra seconds for blockstore $bsname\n";
$node->_maxwait($node->_maxwait() + $extra);
}
}
}
#
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -47,6 +47,7 @@ use Logfile;
use English;
use Data::Dumper;
use EmulabFeatures;
use Image;
# Configure variables
my $TB = "@prefix@";
......@@ -1236,6 +1237,27 @@ sub AddNode($$)
$waittime = ($node->bios_waittime() +
$osinfo->reboot_waittime()) * 2;
}
# Adjust for image backed datasets which take more time to load.
my @blockstores =
$self->parent()->experiment()->LookupBlockstoresForNode($node->vname());
if (@blockstores) {
require Blockstore;
foreach my $blockstore (@blockstores) {
next
if ($blockstore->type() ne "imdataset");
my $bsname = $blockstore->vname();
my $extra = Blockstore::LoadEstimate($blockstore);
if ($extra < 0) {
print STDERR
"*** Could not compute load estimate for $bsname\n";
next;
}
print "Adding $extra seconds for blockstore $bsname\n";
$waittime += $extra;
}
}
$node->_retrycount(1);
$node->_maxwait($waittime);
$node->_setupstatus($libossetup::SETUP_OKAY);
......
......@@ -174,8 +174,10 @@ Blockstore instproc set-mount-point {newmount} {
Blockstore instproc load-dataset {dataset} {
$self instvar attributes
$self instvar node
$self instvar type
set attributes(dataset) $dataset
set type "imdataset"
return
}
......
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