From 945035d3f1cae3da209f9baebacaee8387fa8cd8 Mon Sep 17 00:00:00 2001 From: nikolasgianna Date: Tue, 20 Jun 2017 17:18:07 +0200 Subject: [PATCH] version and error displaying improvements --- samples/vboxwrapper/vbox_common.cpp | 8 ++----- samples/vboxwrapper/vbox_common.h | 13 ++++++++++ samples/vboxwrapper/vboxwrapper.cpp | 37 +++++++++++++++-------------- 3 files changed, 34 insertions(+), 24 deletions(-) diff --git a/samples/vboxwrapper/vbox_common.cpp b/samples/vboxwrapper/vbox_common.cpp index 6464465fe7..d8ef4c10cb 100644 --- a/samples/vboxwrapper/vbox_common.cpp +++ b/samples/vboxwrapper/vbox_common.cpp @@ -375,10 +375,6 @@ string VBOX_BASE::get_error(int num){ More information can be found here: https://en.wikipedia.org/wiki/X86_virtualization\n \ Error Code: ERR_CPU_VM_EXTENSIONS_DISABLED\n", - " NOTE: VirtualBox has reported an improperly configured virtual machine. It was configured to require\n \ - hardware acceleration for virtual machines, but your processor does not support the required feature.\n \ - Please report this issue to the project so that it can be addresssed.\n", - " NOTE: VirtualBox hypervisor reports that another hypervisor has locked the hardware acceleration\n \ for virtual machines feature in exclusive mode.\n", @@ -390,14 +386,14 @@ string VBOX_BASE::get_error(int num){ "VM environment needed to be cleaned up.", - "Forign VM Hypervisor locked hardware acceleration features.", + "Foreign VM Hypervisor locked hardware acceleration features.", "VM Hypervisor was unable to allocate enough memory to start VM.", "VM Hypervisor failed to enter an online state in a timely fashion." }; - std::vector v(args, args + 14); + std::vector v(args, args + 13); return v[num]; } diff --git a/samples/vboxwrapper/vbox_common.h b/samples/vboxwrapper/vbox_common.h index 99bc78feb4..42d1b019c4 100644 --- a/samples/vboxwrapper/vbox_common.h +++ b/samples/vboxwrapper/vbox_common.h @@ -74,6 +74,19 @@ // #define VBOXWRAPPER_ERR_RECOVERABLE -1000 +#define ENV_UNCLEAN 0 +#define VM_RUNNING 1 +#define NO_HA 2 +#define VBOX_SNAPSHOT 3 +#define SESSION_LOCK 4 +#define HA_OFF 5 +#define LOCKED_HA 6 +#define NO_MEM 7 +#define NOT_ONLINE 8 +#define VM_ENV 9 +#define FOREIGN_HYPERV 10 +#define TEMP_NO_MEM 11 +#define NO_ONLINE 12 // Vboxwrapper diagnostics // diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp index 0ee21b9a64..74e5ca231c 100644 --- a/samples/vboxwrapper/vboxwrapper.cpp +++ b/samples/vboxwrapper/vboxwrapper.cpp @@ -425,8 +425,7 @@ int main(int argc, char** argv) { // Log banner // vboxlog_msg("Detected: vboxwrapper %d", VBOXWRAPPER_RELEASE); - vboxlog_msg("Detected: BOINC client v%d.%d", BOINC_MAJOR_VERSION, BOINC_MINOR_VERSION); - + // Initialize system services // #ifdef _WIN32 @@ -446,6 +445,8 @@ int main(int argc, char** argv) { boinc_parse_init_data_file(); boinc_get_init_data(aid); + vboxlog_msg("Detected: BOINC client v%d.%d.%d", aid.major_version, aid.minor_version, aid.release); + //Use COM_OFF to choose how we initialize() the VM #ifdef _WIN32 #ifndef COM_OFF @@ -787,25 +788,25 @@ int main(int argc, char** argv) { const char* temp_reason = ""; if (VBOXWRAPPER_ERR_RECOVERABLE == retval) { - error_reason = pVM->get_error(0); + error_reason = pVM->get_error(ENV_UNCLEAN); unrecoverable_error = false; - temp_reason = pVM->get_error(10).c_str(); + temp_reason = pVM->get_error(VM_ENV).c_str(); } else if (ERR_NOT_EXITED == retval) { - error_reason = pVM->get_error(1); + error_reason = pVM->get_error(VM_RUNNING); unrecoverable_error = false; - temp_reason = pVM->get_error(10).c_str(); + temp_reason = pVM->get_error(VM_ENV).c_str(); } else if (ERR_INVALID_PARAM == retval) { - error_reason = pVM->get_error(2); + error_reason = pVM->get_error(NO_HA); skip_cleanup = true; retval = ERR_EXEC; } else if (retval == (int)RPC_S_SERVER_UNAVAILABLE) { - error_reason = pVM->get_error(3); + error_reason = pVM->get_error(VBOX_SNAPSHOT); skip_cleanup = true; retval = ERR_EXEC; } else if (retval == (int)VBOX_E_INVALID_OBJECT_STATE) { - error_reason = pVM->get_error(4); + error_reason = pVM->get_error(SESSION_LOCK); unrecoverable_error = false; - temp_reason = pVM->get_error(10).c_str(); + temp_reason = pVM->get_error(VM_ENV).c_str(); } else { do_dump_hypervisor_logs = true; } @@ -863,24 +864,24 @@ int main(int argc, char** argv) { const char* temp_reason = ""; if (pVM->is_logged_failure_vm_extensions_disabled()) { - error_reason = pVM->get_error(5); + error_reason = pVM->get_error(HA_OFF); retval = ERR_EXEC; } else if (pVM->is_logged_failure_vm_extensions_not_supported()) { - error_reason = pVM->get_error(6); + error_reason = pVM->get_error(NO_HA); } else if (pVM->is_logged_failure_vm_extensions_in_use()) { - error_reason = pVM->get_error(7); + error_reason = pVM->get_error(LOCKED_HA); unrecoverable_error = false; - temp_reason = pVM->get_error(11).c_str(); + temp_reason = pVM->get_error(FOREIGN_HYPERV).c_str(); temp_delay = 86400; } else if (pVM->is_logged_failure_host_out_of_memory()) { - error_reason = pVM->get_error(8); + error_reason = pVM->get_error(NO_MEM); unrecoverable_error = false; - temp_reason = pVM->get_error(12).c_str(); + temp_reason = pVM->get_error(TEMP_NO_MEM).c_str(); } else if (timeout <= dtime()) { - error_reason = pVM->get_error(9); + error_reason = pVM->get_error(NOT_ONLINE); unrecoverable_error = false; do_dump_hypervisor_logs = true; - temp_reason = pVM->get_error(13).c_str(); + temp_reason = pVM->get_error(NO_ONLINE).c_str(); temp_delay = 86400; }