From a52651bf56c9bc31808917179e62fa866f85ff7a Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Wed, 14 Mar 2012 18:54:03 +0000 Subject: [PATCH] - VBOX: Use the boinc_temporary_exit API properly. Wait for 5 minutes before allowing another attempt to start the VM when the hypervisor cannot allocate enough memory. - VBOX: Print out a trace statement about the suspend/resume directive from the vboxwrapper perspective. This in conjuction with the BOINC API trace statements should provide a better idea with what is going on. samples/vboxwrapper vboxwrapper.cpp svn path=/trunk/boinc/; revision=25424 --- checkin_notes | 12 ++++++++++++ samples/vboxwrapper/vboxwrapper.cpp | 24 +++++++++++++++++++----- win_build/libboincapi_staticcrt.vcproj | 4 ++-- win_build/vboxwrapper.vcproj | 8 ++++---- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/checkin_notes b/checkin_notes index 1bb71fe5d5..da35023ce5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -2628,3 +2628,15 @@ Charlie 14 Mar 2012 client/ coproc_detect.cpp + +Rom 14 Mar 2012 + - VBOX: Use the boinc_temporary_exit API properly. Wait for 5 minutes + before allowing another attempt to start the VM when the hypervisor + cannot allocate enough memory. + - VBOX: Print out a trace statement about the suspend/resume directive + from the vboxwrapper perspective. This in conjuction with the + BOINC API trace statements should provide a better idea with + what is going on. + + samples/vboxwrapper + vboxwrapper.cpp diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp index b90fa36020..3df28ef89b 100644 --- a/samples/vboxwrapper/vboxwrapper.cpp +++ b/samples/vboxwrapper/vboxwrapper.cpp @@ -332,7 +332,6 @@ int main(int argc, char** argv) { double ncpus = 0.0; bool report_vm_pid = false; bool report_net_usage = false; - bool unrecoverable_error = false; int vm_pid = 0; unsigned long vm_exit_code = 0; std::string vm_log; @@ -450,12 +449,18 @@ int main(int argc, char** argv) { retval = vm.run(); if (retval) { // All failure to start error are unrecoverable by default - unrecoverable_error = true; + bool unrecoverable_error = true; + char* temp_reason = ""; + int temp_delay = 300; // Get logs before cleanup vm.get_system_log(system_log); vm.get_vm_log(vm_log); + // Attempt to cleanup the VM + vm.cleanup(); + write_checkpoint(elapsed_time, vm); + fprintf( stderr, "%s VM failed to start.\n", @@ -499,6 +504,7 @@ int main(int argc, char** argv) { vboxwrapper_msg_prefix(buf, sizeof(buf)) ); unrecoverable_error = false; + temp_reason = "VM Hypervisor was unable to allocate enough memory to start VM."; } else { fprintf( stderr, @@ -514,11 +520,9 @@ int main(int argc, char** argv) { } if (unrecoverable_error) { - vm.cleanup(); - write_checkpoint(elapsed_time, vm); boinc_finish(retval); } else { - boinc_temporary_exit(0); + boinc_temporary_exit(temp_delay, temp_reason); } } @@ -585,10 +589,20 @@ int main(int argc, char** argv) { } if (boinc_status.suspended) { if (!vm.suspended) { + fprintf( + stderr, + "%s Suspending VM.\n", + vboxwrapper_msg_prefix(buf, sizeof(buf)) + ); vm.pause(); } } else { if (vm.suspended) { + fprintf( + stderr, + "%s Resuming VM.\n", + vboxwrapper_msg_prefix(buf, sizeof(buf)) + ); vm.resume(); } diff --git a/win_build/libboincapi_staticcrt.vcproj b/win_build/libboincapi_staticcrt.vcproj index 0ef055bc44..7376531473 100644 --- a/win_build/libboincapi_staticcrt.vcproj +++ b/win_build/libboincapi_staticcrt.vcproj @@ -186,7 +186,7 @@ @@ -182,13 +182,13 @@