From: Ian Jackson Date: Fri, 23 Oct 2020 16:08:02 +0000 (+0100) Subject: host reuse fixes: Properly clear out old static tasks from history X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ee9a8727422c5a6f09985df568b93fcbf7415129;p=osstest.git host reuse fixes: Properly clear out old static tasks from history The algorithm for clearing out old lifecycle entries was wrong: it would delete all entries for non-live tasks. In practice this would properly remove all the old entries for non-static tasks, since ownd tasks typically don't releease things until the task ends (and it becomes non-live). And it wouldn't remove more than it should do unless some now-not-live task had an allocation overlapping with us, which is not supposed to be possible if we are doing a host wipe. But it would not remove static tasks ever, since they are always live. Change to a completely different algorithm: * Check that only us (ie, $ttaskid) has (any shares of) this host allocated. There's a function resource_check_allocated_core which already does this and since we're conceptually part of Executive it is proper for us to call it. This is just a sanity check. * Delete all lifecycle entries predating the first entry made by us. (We could just delete all entries other than ours, but in theory maybe some future code could result in a siutation where someone else could have had another share briefly at some point.) This removes old junk from the "Tasks that could have affected" in reports. Signed-off-by: Ian Jackson --- diff --git a/Osstest/JobDB/Executive.pm b/Osstest/JobDB/Executive.pm index 1dcf55f..097c8d7 100644 --- a/Osstest/JobDB/Executive.pm +++ b/Osstest/JobDB/Executive.pm @@ -515,15 +515,19 @@ sub jobdb_host_update_lifecycle_info ($$$) { #method if ($mode eq 'wiped') { db_retry($flight, [qw(running)], $dbh_tests,[], sub { - $dbh_tests->do(<{Others}; + $dbh_tests->do(<