mirror of https://github.com/BOINC/boinc.git
VBOX: Check for the completion file regardless if the VM is running or not.
This commit is contained in:
parent
6f3fa7e39d
commit
afd34b8072
|
@ -1941,6 +1941,13 @@ bool VBOX_VM::is_logged_failure_guest_job_out_of_memory() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool VBOX_VM::is_logged_completion_file_exists() {
|
||||
char path[MAXPATHLEN];
|
||||
sprintf(path, "shared/%s", completion_trigger_file.c_str());
|
||||
if (boinc_file_exists(path)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool VBOX_VM::is_virtualbox_version_newer(int maj, int min, int rel) {
|
||||
int vbox_major = 0, vbox_minor = 0, vbox_release = 0;
|
||||
if (3 == sscanf(virtualbox_version.c_str(), "%d.%d.%d", &vbox_major, &vbox_minor, &vbox_release)) {
|
||||
|
|
|
@ -205,7 +205,6 @@ public:
|
|||
int pause();
|
||||
int resume();
|
||||
void check_trickle_triggers();
|
||||
void check_completion_trigger();
|
||||
int create_snapshot(double elapsed_time);
|
||||
int cleanup_snapshots(bool delete_active);
|
||||
int restore_snapshot();
|
||||
|
@ -223,6 +222,7 @@ public:
|
|||
bool is_logged_failure_vm_extensions_not_supported();
|
||||
bool is_logged_failure_host_out_of_memory();
|
||||
bool is_logged_failure_guest_job_out_of_memory();
|
||||
bool is_logged_completion_file_exists();
|
||||
bool is_virtualbox_version_newer(int maj, int min, int rel);
|
||||
bool is_virtualbox_error_recoverable(int retval);
|
||||
|
||||
|
|
|
@ -407,40 +407,22 @@ void set_remote_desktop_info(APP_INIT_DATA& /* aid */, VBOX_VM& vm) {
|
|||
}
|
||||
}
|
||||
|
||||
// check for completion trigger file
|
||||
//
|
||||
void VBOX_VM::check_completion_trigger() {
|
||||
void extract_completion_file_info(VBOX_VM& vm, unsigned long& exit_code, string& message) {
|
||||
char path[MAXPATHLEN];
|
||||
static double detect_time = 0;
|
||||
char buf[1024];
|
||||
|
||||
if (detect_time) {
|
||||
if (dtime() > detect_time + 60) {
|
||||
cleanup();
|
||||
dump_hypervisor_logs(true);
|
||||
boinc_finish(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
sprintf(path, "shared/%s", completion_trigger_file.c_str());
|
||||
if (!boinc_file_exists(path)) return;
|
||||
detect_time = dtime();
|
||||
#if 0
|
||||
int exit_code = 0;
|
||||
sprintf(path, "shared/%s", vm.completion_trigger_file.c_str());
|
||||
FILE* f = fopen(path, "r");
|
||||
if (f) {
|
||||
char buf[1024];
|
||||
message = "";
|
||||
if (fgets(buf, 1024, f) != NULL) {
|
||||
exit_code = atoi(buf);
|
||||
}
|
||||
while (fgets(buf, 1024, f) != NULL) {
|
||||
fputs(buf, stderr);
|
||||
message += buf;
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
cleanup();
|
||||
dump_hypervisor_logs(true);
|
||||
boinc_finish(exit_code);
|
||||
#endif
|
||||
}
|
||||
|
||||
// check for trickle trigger files, and send trickles if find them.
|
||||
|
@ -1074,6 +1056,17 @@ int main(int argc, char** argv) {
|
|||
vm.dump_hypervisor_logs(true);
|
||||
boinc_finish(EXIT_ABORTED_BY_CLIENT);
|
||||
}
|
||||
if (vm.is_logged_completion_file_exists()) {
|
||||
vm.reset_vm_process_priority();
|
||||
vm.cleanup();
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s VM Completion File Detected.\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf))
|
||||
);
|
||||
extract_completion_file_info(vm, vm_exit_code, message);
|
||||
boinc_finish(vm_exit_code);
|
||||
}
|
||||
if (!vm.online) {
|
||||
// Is this a type of event we can recover from?
|
||||
if (vm.is_logged_failure_host_out_of_memory()) {
|
||||
|
@ -1160,9 +1153,6 @@ int main(int argc, char** argv) {
|
|||
if ((loop_iteration % 10) == 0) {
|
||||
current_cpu_time = starting_cpu_time + vm.get_vm_cpu_time();
|
||||
vm.check_trickle_triggers();
|
||||
if (!vm.completion_trigger_file.empty()) {
|
||||
vm.check_completion_trigger();
|
||||
}
|
||||
}
|
||||
|
||||
if (vm.job_duration) {
|
||||
|
|
Loading…
Reference in New Issue