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-10 15:35:11 +0200
commit96145726e0fc4060b4ebc86a6a06786aad696e85 (patch)
tree26708976404a66c419f8fc3e4dcee274fbefe46a
parentc63815eb8a8e60ee615182348106a7be1b5e2f18 (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 54d7056..3371bf1 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 0d1bda1..5fb283e 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;
@@ -377,7 +377,7 @@ namespace bbot
}
void kvm_machine::
- suspend ()
+ suspend (bool fh)
{
try
{
@@ -385,7 +385,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 6040d9e..1d4c454 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