From e08751b52c77608eda1bb38e3437167f53e3b06b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 10 May 2017 14:50:42 +0200 Subject: Suspend machine on abnormal build for investigation --- bbot/agent.cxx | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/bbot/agent.cxx b/bbot/agent.cxx index b2d09d1..09156f2 100644 --- a/bbot/agent.cxx +++ b/bbot/agent.cxx @@ -171,6 +171,7 @@ bootstrap_machine (const dir_path& md, } m->suspend (); m->wait (); + info << "resuming after machine suspension"; return nullopt; }; @@ -640,7 +641,7 @@ try try {m->forcedown ();} catch (const failed&) {} })); - auto soft_fail = [&xp, &m, &r] (const char* msg, bool wait = true) + auto soft_fail = [&xp, &m, &r] (const char* msg) { { diag_record dr (error); @@ -648,10 +649,8 @@ try m->print_info (dr); } m->suspend (); - - if (wait) - m->wait (); - + m->wait (); + info << "resuming after machine suspension"; return r; }; @@ -700,17 +699,21 @@ try r.status = result_status::abnormal; // Soft-fail below. } - // If the build terminated abnormally, suspent the machine for - // investigation (note that here we don't wait or return). - // if (r.status == result_status::abnormal) - soft_fail ("build terminated abnormally", false); - - // Force the machine down (there is no need wasting time on clean - // shutdown since the next step is to drop the snapshot). Also fail - // softly if things go badly. - // - try {m->forcedown (false);} catch (const failed&) {} + { + // If the build terminated abnormally, suspend the machine for + // investigation. + // + return soft_fail ("build terminated abnormally"); + } + else + { + // Force the machine down (there is no need wasting time on clean + // shutdown since the next step is to drop the snapshot). Also fail + // softly if things go badly. + // + try {m->forcedown (false);} catch (const failed&) {} + } } run_btrfs (trace, "subvolume", "delete", xp); -- cgit v1.1