From 0dadd51733038d928501c039ccfcdd2137fc735f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 9 Jun 2019 23:00:46 -0700 Subject: [PATCH] vboxwrapper: if control operation (suspend, resume, snapshot) fails, restart after 5 minutes rather than 1 day. Also fix message to say what operation failed. --- samples/vboxwrapper/vboxwrapper.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp index ddf628d30d..7441733ea3 100644 --- a/samples/vboxwrapper/vboxwrapper.cpp +++ b/samples/vboxwrapper/vboxwrapper.cpp @@ -48,6 +48,10 @@ // Daniel Lombraña González // Marius Millea +#define RESTART_DELAY 300 + // if a VM operation (suspend, resume, snapshot) fails, + // exit and restart after this delay. + #ifdef _WIN32 #include "boinc_win.h" #include "win_util.h" @@ -1125,7 +1129,11 @@ int main(int argc, char** argv) { if ((unsigned)retval == VBOX_E_INVALID_OBJECT_STATE) { vboxlog_msg("ERROR: VM task failed to pause, rescheduling task for a later time."); pVM->poweroff(); - boinc_temporary_exit(86400, "VM job unmanageable, restarting later."); + sprintf(buf, + "VM suspend failed. Will exit and restart in %d sec.", + RESTART_DELAY + ); + boinc_temporary_exit(RESTART_DELAY, buf); } } } else { @@ -1134,7 +1142,11 @@ int main(int argc, char** argv) { if ((unsigned)retval == VBOX_E_INVALID_OBJECT_STATE) { vboxlog_msg("ERROR: VM task failed to resume, rescheduling task for a later time."); pVM->poweroff(); - boinc_temporary_exit(86400, "VM job unmanageable, restarting later."); + sprintf(buf, + "VM resume failed. Will exit and restart in %d sec.", + RESTART_DELAY + ); + boinc_temporary_exit(RESTART_DELAY, buf); } } @@ -1209,7 +1221,11 @@ int main(int argc, char** argv) { // vboxlog_msg("ERROR: Checkpoint maintenance failed, rescheduling task for a later time. (%d)", retval); pVM->poweroff(); - boinc_temporary_exit(86400, "VM job unmanageable, restarting later."); + sprintf(buf, + "VM snapshot failed. Will exit and restart in %d sec.", + RESTART_DELAY + ); + boinc_temporary_exit(RESTART_DELAY, buf); } else { // tell BOINC we've successfully created a checkpoint. //