Commit e8f1f15c authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add more status options to the image_boot_status table for tracking

different kinds of image failures.
parent 1edda57d
......@@ -2069,14 +2069,15 @@ sub RecordImageStatus($$$$)
my $type = $node->type();
my $node_id = $node->node_id();
my $rsrcidx = $experiment->rsrcidx();
my $exptidx = $experiment->idx();
my $imageid = $self->imageid();
my $version = $self->version();
DBQueryWarn("insert into image_boot_status ".
"(stamp, rsrcidx, node_id, node_type, ".
"(stamp, exptidx, rsrcidx, node_id, node_type, ".
" imageid, imageid_version, status) ".
"values(UNIX_TIMESTAMP(now()), ".
" $rsrcidx, '$node_id', '$type', ".
" $exptidx, $rsrcidx, '$node_id', '$type', ".
" $imageid, $version, '$status')")
or return -1;
return 0;
......
......@@ -1701,6 +1701,7 @@ sub WaitForNodes($$@)
$node->_laststate("");
$node->_laststatestamp(time());
$node->_retried(0);
$node->_bootstatus(undef);
$node->Refresh();
#
# Count up number of virtnodes on each physnode.
......@@ -1828,6 +1829,15 @@ sub WaitForNodes($$@)
if (defined($node->_sliver()));
$node->_waitend(time());
delete($nodes{$node_id});
if ($state eq TBDB_NODESTATE_RELOADFAILED) {
$node->_bootstatus("reloadfail");
}
elsif ($state eq TBDB_NODESTATE_TBFAILED) {
$node->_bootstatus("tbfailed");
}
elsif ($state eq TBDB_NODESTATE_ISUP) {
$node->_bootstatus("success");
}
next;
}
$waittime = time() - $node->_waitstart();
......@@ -1838,6 +1848,7 @@ sub WaitForNodes($$@)
$node->_sliver()->SetStatus("failed")
if (defined($node->_sliver()));
$node->_waitend(time());
$node->_bootstatus("timedout");
delete($nodes{$node_id});
next;
}
......@@ -1873,6 +1884,7 @@ sub WaitForNodes($$@)
$node->_sliver()->SetStatus("failed")
if (defined($node->_sliver()));
$node->_waitend(time());
$node->_bootstatus("bootfail");
delete($nodes{$node_id});
}
next;
......@@ -1907,19 +1919,12 @@ sub WaitForNodes($$@)
$node->_bootlog(undef);
if (defined($node->_image()) && defined($node->_sliver())) {
if (defined($node->_image()) && defined($node->_sliver()) &&
defined($node->_bootstatus())) {
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);
$image->RecordImageStatus($experiment, $node,
$node->_bootstatus());
}
#
......
......@@ -2047,12 +2047,13 @@ 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,
`exptidx` int(11) NOT NULL default '0',
`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',
`status` enum('success','reloadfail','bootfail','timedout','tbfailed') NOT NULL default 'success',
PRIMARY KEY (`idx`),
KEY `stamp` (`stamp`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my $type = DBSlotType("image_boot_status", "status");
if (!$type) {
Fatal("No 'status' slot in 'image_boot_status' table");
}
if (! ($type =~ /tbfailed/)) {
DBQueryFatal("alter table image_boot_status change `status` `status` ".
" enum('success','reloadfail','bootfail','timedout',".
" 'tbfailed') NOT NULL default 'success'");
}
if (!DBSlotExists("image_boot_status", "exptidx")) {
DBQueryFatal("ALTER TABLE image_boot_status ADD ".
" `exptidx` int(11) NOT NULL default '0' after rsrcidx");
}
DBQueryFatal("update image_boot_status,experiment_resources ".
" set image_boot_status.exptidx=experiment_resources.exptidx ".
"where experiment_resources.idx=image_boot_status.rsrcidx");
return 0;
}
# Local Variables:
# mode:perl
# End:
Supports Markdown
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