mirror of https://github.com/BOINC/boinc.git
VBOX: Rework VM running detection logic. We were checking for that condition in two places.
VBOX: Only attempt to unregister the VM on an unrecoverable startup error. VBOX: Attempt to detect the VM process ID for all recoverable startup errors and report to BOINC.
This commit is contained in:
parent
544c566dfe
commit
147638d295
|
@ -1004,7 +1004,8 @@ int VBOX_VM::run(double elapsed_time) {
|
|||
// Check to see if the VM is already in a running state, if so, poweroff.
|
||||
poll(false);
|
||||
if (online) {
|
||||
poweroff();
|
||||
retval = poweroff();
|
||||
if (retval) return ERR_NOT_EXITED;
|
||||
}
|
||||
|
||||
// If our last checkpoint time is greater than 0, restore from the previously
|
||||
|
|
|
@ -656,10 +656,6 @@ int main(int argc, char** argv) {
|
|||
char* temp_reason = (char*)"";
|
||||
int temp_delay = 300;
|
||||
|
||||
// Attempt to cleanup the VM
|
||||
vm.cleanup();
|
||||
write_checkpoint(elapsed_time, vm);
|
||||
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s VM failed to start.\n",
|
||||
|
@ -704,23 +700,30 @@ int main(int argc, char** argv) {
|
|||
);
|
||||
unrecoverable_error = false;
|
||||
temp_reason = (char*)"VM Hypervisor was unable to allocate enough memory to start VM.";
|
||||
} else if (ERR_NOT_EXITED == retval) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s NOTE: VM was already running. BOINC will be notified that it needs to clean up the environment.\n"
|
||||
" This might be a temporary problem and so this job will be rescheduled for another time.\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf))
|
||||
);
|
||||
unrecoverable_error = false;
|
||||
temp_reason = (char*)"VM environment needed to be cleaned up.";
|
||||
} else {
|
||||
vm.poll();
|
||||
vm.dumphypervisorlogs();
|
||||
}
|
||||
|
||||
// Check to see if the VM is already running. If so, notify BOINC about the process ID so it can
|
||||
if (unrecoverable_error) {
|
||||
// Attempt to cleanup the VM and exit.
|
||||
vm.cleanup();
|
||||
write_checkpoint(elapsed_time, vm);
|
||||
boinc_finish(retval);
|
||||
} else {
|
||||
// if the VM is already running notify BOINC about the process ID so it can
|
||||
// clean up the environment. We should be safe to run after that.
|
||||
//
|
||||
if (vm.online) {
|
||||
fprintf(
|
||||
stderr,
|
||||
"%s NOTE: VM was already running. BOINC will be notified that it needs to clean up the environment.\n"
|
||||
" This might be a temporary problem and so this job will be rescheduled for another time.\n",
|
||||
vboxwrapper_msg_prefix(buf, sizeof(buf))
|
||||
);
|
||||
unrecoverable_error = false;
|
||||
temp_reason = (char*)"VM environment needed to be cleaned up.";
|
||||
|
||||
vm.get_vm_process_id(vm_pid);
|
||||
vm.get_vm_process_id(vm_pid);
|
||||
if (vm_pid) {
|
||||
retval = boinc_report_app_status_aux(
|
||||
elapsed_time,
|
||||
checkpoint_cpu_time,
|
||||
|
@ -729,16 +732,7 @@ int main(int argc, char** argv) {
|
|||
bytes_sent,
|
||||
bytes_received
|
||||
);
|
||||
} else {
|
||||
|
||||
vm.dumphypervisorlogs();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (unrecoverable_error) {
|
||||
boinc_finish(retval);
|
||||
} else {
|
||||
boinc_temporary_exit(temp_delay, temp_reason);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue