All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 4fa9d2ea authored by Leigh B Stoller's avatar Leigh B Stoller

Add a new table image_boot_status to record boot success/failure each time

an image is loaded on a node. We want to know both success and failure over
time so that we can determine when a image works or does not work on a
particular node/type. This is primarily for the image tracker to determine
what images work on what node types, but might be useful for in other
situations. I realize this duplicates some info we already have in the
image_history table, but that does not record failure, only success, and it
mostly concerned with who is using what images.
parent 3029a212
......@@ -2046,6 +2046,28 @@ sub RecordImageHistory($$$$$$)
return 0;
}
#
# Record more concise success/failure of an image each time it boots.
#
sub RecordImageStatus($$$$)
{
my ($self, $experiment, $node, $status) = @_;
my $type = $node->type();
my $node_id = $node->node_id();
my $rsrcidx = $experiment->rsrcidx();
my $imageid = $self->imageid();
my $version = $self->version();
DBQueryWarn("insert into image_boot_status ".
"(stamp, rsrcidx, node_id, node_type, ".
" imageid, imageid_version, status) ".
"values(UNIX_TIMESTAMP(now()), ".
" $rsrcidx, '$node_id', '$type', ".
" $imageid, $version, '$status')")
or return -1;
return 0;
}
#
# List of images created by a user urn.
#
......
......@@ -1063,6 +1063,7 @@ sub Action($$$)
$node->_reloaded(0);
# Backpointer used in WaitForNodes().
$node->_sliver($sliver);
$node->_image(undef);
if ($reservation->SameExperiment($experiment)) {
my $vnode;
......@@ -1122,6 +1123,7 @@ sub Action($$$)
push(@{ $reloads{$image->versid()} }, $vnode);
$imageinfo{$vnode->node_id()} = [$osinfo, $image];
$vnode->_reloaded(1);
$vnode->_image($image);
#
# Remove from reboots; we no longer want to do this,
......@@ -1235,12 +1237,12 @@ sub Action($$$)
}
push(@{ $reloads{$image->versid()} }, $node);
$node->_reloaded(1);
$node->_image($image);
# As with os_setup, we do not count images unless
# they are actually reloaded. I have no idea why.
$imageinfo{$node->node_id()} = [$osinfo, $image];
# Reload means reboot or power on.
# But skip the firewall; that is done specially since
# it has to come up before everything else.
......@@ -1870,6 +1872,21 @@ sub WaitForNodes($$@)
$node->_sliver()->status() eq "failed");
$node->_bootlog(undef);
if (defined($node->_image()) && defined($node->_sliver())) {
my $image = $node->_image();
my $status = "success";
if ($node->_sliver()->status() eq "failed") {
if ($node->eventstate() eq TBDB_NODESTATE_RELOADFAILED) {
$status = "reloadfail";
}
else {
$status = "bootfail";
}
}
$image->RecordImageStatus($experiment, $node, $status);
}
#
# Create a logfile from the boot log.
......
......@@ -2014,6 +2014,24 @@ CREATE TABLE `ifaces` (
KEY `lanid` (`lanid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `image_boot_status`
--
DROP TABLE IF EXISTS `image_boot_status`;
CREATE TABLE `image_boot_status` (
`idx` int(10) unsigned NOT NULL auto_increment,
`stamp` int(10) unsigned NOT NULL,
`rsrcidx` int(10) unsigned default NULL,
`node_id` varchar(32) NOT NULL,
`node_type` varchar(30) NOT NULL,
`imageid` int(8) default NULL,
`imageid_version` int(8) default NULL,
`status` enum('success','reloadfail','bootfail') NOT NULL default 'success',
PRIMARY KEY (`idx`),
KEY `stamp` (`stamp`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `image_history`
--
......
#
# Image status tracking
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBTableExists("image_boot_status")) {
DBQueryFatal("CREATE TABLE `image_boot_status` ( ".
" `idx` int(10) unsigned NOT NULL auto_increment, ".
" `stamp` int(10) unsigned NOT NULL, ".
" `rsrcidx` int(10) unsigned default NULL, ".
" `node_id` varchar(32) NOT NULL, ".
" `node_type` varchar(30) NOT NULL, ".
" `imageid` int(8) default NULL, ".
" `imageid_version` int(8) default NULL, ".
" `status` enum('success','reloadfail','bootfail') ".
" NOT NULL default 'success', ".
" PRIMARY KEY (`idx`), ".
" KEY `stamp` (`stamp`) ".
") ENGINE=MyISAM DEFAULT CHARSET=latin1");
}
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
#!/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
#
......@@ -526,6 +526,16 @@ foreach (keys(%{ $MyStruct->failedlist() })) {
push @{$t->{any_type}{"failed_${fatal}_list"}}, $_;
push @{$t->{by_type}{$type}{"failed_${fatal}_list"}}, $_;
#
# Image success/failure tracking but only on first load since we do
# not know what the user has done after that.
#
if ($node->_setupoperation() eq $RELOAD) {
my $image = $node->_loadimage();
$image->RecordImageStatus($experiment, $node,
($what eq 'boot' ? "bootfail" : "reloadfail"));
}
}
foreach (keys(%{ $MyStruct->nodelist() })) {
my $node = $MyStruct->node($_);
......@@ -602,7 +612,7 @@ if (defined $tally{reload}) {
my $type = $node_types[0];
$summary .= add_failed_nodes($line, 2, %{$d_t{$type}});
} else {
$summary .= "$line:\n";
......@@ -663,6 +673,14 @@ if ($exit_code == 0) {
$image = $node->_loadimage();
}
$todo{$node_id} = [$osinfo, $image];
#
# Image success/failure tracking but only on first load since we do
# not know what the user has done after that.
#
if (defined($image)) {
$image->RecordImageStatus($experiment, $node, "success");
}
}
}
Image->RecordImageHistory($experiment, 'os_setup',
......
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