aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-10-09 16:37:31 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-10-09 16:37:31 +0200
commitf76bc9bf7f2b9378102d0d34b12987170b5ae3ef (patch)
tree20e09e59c1fc0c5317337409d3e81a9eba315dbf
parent355fb2bf20af05ccd885279db26f9ccce669dd13 (diff)
Don't fail hard if we were unable to suspend machine
-rw-r--r--bbot/agent/agent.cxx28
-rw-r--r--bbot/agent/machine.cxx6
-rw-r--r--bbot/agent/machine.hxx2
-rw-r--r--bbot/worker/worker.cxx2
4 files changed, 25 insertions, 13 deletions
diff --git a/bbot/agent/agent.cxx b/bbot/agent/agent.cxx
index 59ffa03..dac70ee 100644
--- a/bbot/agent/agent.cxx
+++ b/bbot/agent/agent.cxx
@@ -176,7 +176,7 @@ bootstrap_machine (const dir_path& md,
[&m, &md] ()
{
info << "trying to force machine " << md << " down";
- try {m->forcedown ();} catch (const failed&) {}
+ try {m->forcedown (false);} catch (const failed&) {}
}));
// What happens if the bootstrap process hangs? The simple thing would
@@ -193,9 +193,15 @@ bootstrap_machine (const dir_path& md,
dr << msg << " for machine " << md << ", suspending";
m->print_info (dr);
}
- m->suspend ();
- m->wait ();
- info << "resuming after machine suspension";
+
+ try
+ {
+ m->suspend (false);
+ m->wait (false);
+ info << "resuming after machine suspension";
+ }
+ catch (const failed&) {}
+
return nullopt;
};
@@ -689,7 +695,7 @@ try
[&m, &xp] ()
{
info << "trying to force machine " << xp << " down";
- try {m->forcedown ();} catch (const failed&) {}
+ try {m->forcedown (false);} catch (const failed&) {}
}));
auto soft_fail = [&xp, &m, &r] (const char* msg)
@@ -699,9 +705,15 @@ try
dr << msg << " for machine " << xp << ", suspending";
m->print_info (dr);
}
- m->suspend ();
- m->wait ();
- info << "resuming after machine suspension";
+
+ try
+ {
+ m->suspend (false);
+ m->wait (false);
+ info << "resuming after machine suspension";
+ }
+ catch (const failed&) {}
+
return r;
};
diff --git a/bbot/agent/machine.cxx b/bbot/agent/machine.cxx
index b309fdf..955ab77 100644
--- a/bbot/agent/machine.cxx
+++ b/bbot/agent/machine.cxx
@@ -172,7 +172,7 @@ namespace bbot
forcedown (bool fail_hard) override;
virtual void
- suspend () override;
+ suspend (bool fail_hard) override;
bool
wait (size_t& seconds, bool fail_hard) override;
@@ -376,7 +376,7 @@ namespace bbot
}
void kvm_machine::
- suspend ()
+ suspend (bool fh)
{
try
{
@@ -384,7 +384,7 @@ namespace bbot
}
catch (const system_error& e)
{
- fail << "unable to communicate with qemu monitor: " << e;
+ fail (fh) << "unable to communicate with qemu monitor: " << e;
}
}
diff --git a/bbot/agent/machine.hxx b/bbot/agent/machine.hxx
index e352e42..b72e846 100644
--- a/bbot/agent/machine.hxx
+++ b/bbot/agent/machine.hxx
@@ -36,7 +36,7 @@ namespace bbot
// Suspend the machine.
//
virtual void
- suspend () = 0;
+ suspend (bool fail_hard = true) = 0;
// Wait for the machine to terminate up to the specified number of
// seconds. Update the timeout and return false if the machine is still
diff --git a/bbot/worker/worker.cxx b/bbot/worker/worker.cxx
index a34d57b..1efeaf1 100644
--- a/bbot/worker/worker.cxx
+++ b/bbot/worker/worker.cxx
@@ -747,7 +747,7 @@ int
main (int argc, char* argv[])
try
{
- // This is a little hack to make out baseutils for Windows work when called
+ // This is a little hack to make our baseutils for Windows work when called
// with absolute path. In a nutshell, MSYS2's exec*p() doesn't search in the
// parent's executable directory, only in PATH. And since we are running
// without a shell (that would read /etc/profile which sets PATH to some