From 3ad3bdd64e05a3d10e3e82f7efb1a60f98bc536d Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Mon, 11 Jul 2022 20:26:42 +0200 Subject: [PATCH 01/10] Update vbox_vboxmanage.cpp - replace "list hdds" with "showhdinfo" - add function to automatically generate a new disk UUID --- samples/vboxwrapper/vbox_vboxmanage.cpp | 60 ++++++++++++++++++------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index 1d2f04e1c4..f443533b26 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -543,42 +543,68 @@ namespace vboxmanage { // See: https://www.virtualbox.org/manual/ch05.html#hdimagewrites // https://www.virtualbox.org/manual/ch05.html#diffimages // the vdi file downloaded to the projects dir becomes the parent (read only) - // "--setuid" must not be used // each task gets it's own differencing image (writable) // differencing images are written to the VM's snapshot folder // + string set_new_uuid = ""; + size_t type_start; + size_t type_end; string medium_file = aid.project_dir; medium_file += "/" + multiattach_vdi_file; -#ifdef _WIN32 - replace(medium_file.begin(), medium_file.end(), '\\', '/'); -#endif - vboxlog_msg("Adding virtual disk drive to VM. (%s)", multiattach_vdi_file.c_str()); - command = "list hdds"; + command = "showhdinfo \"" + medium_file + "\" "; - retval = vbm_popen(command, output, "check if parent hdd is registered", false, false); - if (retval) return retval; + retval = vbm_popen(command, output, "check if parent hdd is registered"); + if (retval) { + // showhdinfo implicitly registers unregistered hdds. + // Hence, this has to be handled first. + // + if ((output.rfind("VBoxManage: error:", 0) != string::npos) && + (output.find("Cannot register the hard disk") != string::npos) && + (output.find("because a hard disk") != string::npos) && + (output.find("with UUID") != string::npos) && + (output.find("already exists") != string::npos)) { + // May happen if the project admin didn't set a new UUID. + set_new_uuid = "--setuuid \"\" "; + } else { + // other errors + return retval; + } + } -#ifdef _WIN32 - replace(output.begin(), output.end(), '\\', '/'); -#endif + // Output from showhdinfo should look a little like this: + // UUID: c119bcaf-636c-41f6-86c9-384739a31339 + // Parent UUID: base + // State: created + // Type: multiattach + // Location: C:\Users\romw\VirtualBox VMs\test2\test2.vdi + // Storage format: VDI + // Format variant: dynamic default + // Capacity: 2048 MBytes + // Size on disk: 2 MBytes + // Encryption: disabled + // Property: AllocationBlockSize=1048576 + // Child UUIDs: dcb0daa5-3bf9-47cb-bfff-c65e74484615 - if (output.find(medium_file) == string::npos) { - // parent hdd is not registered - // vdi files can't be registered and set to multiattach mode within 1 step. + type_start = output.find("\nType: ") + 1; + type_end = output.find("\n", type_start) - type_start; + + if (output.substr(type_start, type_end).find("multiattach") == string::npos) { + // Parent hdd is not (yet) of type multiattach. + // Vdi files can't be registered and set to multiattach mode within 1 step. // They must first be attached to a VM in normal mode, then detached from the VM // command = command_fix_part; - command += "--medium \"" + medium_file + "\" "; + command += set_new_uuid + "--medium \"" + medium_file + "\" "; - retval = vbm_popen(command, output, "register parent hdd", false, false); + retval = vbm_popen(command, output, "register parent hdd"); if (retval) return retval; command = command_fix_part; command += "--medium none "; - retval = vbm_popen(command, output, "detach parent vdi", false, false); + retval = vbm_popen(command, output, "detach parent vdi"); if (retval) return retval; // the vdi file is now registered and ready to be attached in multiattach mode // From 40399f9ec07f4abdb4269ccd50d7fc4035330f28 Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Wed, 13 Jul 2022 10:40:41 +0200 Subject: [PATCH 02/10] Modify logging related to UUID change The "expected error" (UUID already in use) should not be logged. All unexpected errors should be logged. --- samples/vboxwrapper/vbox_vboxmanage.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index f443533b26..12f2e103d3 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -555,7 +555,7 @@ namespace vboxmanage { vboxlog_msg("Adding virtual disk drive to VM. (%s)", multiattach_vdi_file.c_str()); command = "showhdinfo \"" + medium_file + "\" "; - retval = vbm_popen(command, output, "check if parent hdd is registered"); + retval = vbm_popen(command, output, "check if parent hdd is registered", false); if (retval) { // showhdinfo implicitly registers unregistered hdds. // Hence, this has to be handled first. @@ -569,6 +569,10 @@ namespace vboxmanage { set_new_uuid = "--setuuid \"\" "; } else { // other errors + vboxlog_msg("Error in check if parent hdd is registered.\nCommand:\n%s\nOutput:\n%s", + command.c_str(), + output.c_str() + ); return retval; } } @@ -586,7 +590,7 @@ namespace vboxmanage { // Encryption: disabled // Property: AllocationBlockSize=1048576 // Child UUIDs: dcb0daa5-3bf9-47cb-bfff-c65e74484615 - + // type_start = output.find("\nType: ") + 1; type_end = output.find("\n", type_start) - type_start; @@ -598,7 +602,7 @@ namespace vboxmanage { command = command_fix_part; command += set_new_uuid + "--medium \"" + medium_file + "\" "; - retval = vbm_popen(command, output, "register parent hdd"); + retval = vbm_popen(command, output, "register parent vdi"); if (retval) return retval; command = command_fix_part; From 30660b16ac56e50c6dba878036355acafe098022 Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Sat, 23 Jul 2022 10:37:57 +0200 Subject: [PATCH 03/10] Cleanup disk registration VirtualBox occasionally moves the disk registration entry to the global media store in VirtualBox.xml. In this case the disk entry must completely be removed and reattached. Otherwise the disk can't be attached as multiattach parent. --- samples/vboxwrapper/vbox_vboxmanage.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index 12f2e103d3..d5f1e0d933 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -598,7 +598,13 @@ namespace vboxmanage { // Parent hdd is not (yet) of type multiattach. // Vdi files can't be registered and set to multiattach mode within 1 step. // They must first be attached to a VM in normal mode, then detached from the VM - // + + // ensure the medium is not registered in the global media store + command = "closemedium \"" + medium_file + "\" "; + + retval = vbm_popen(command, output, "deregister parent vdi"); + if (retval) return retval; + command = command_fix_part; command += set_new_uuid + "--medium \"" + medium_file + "\" "; From c2835211077dcdea4fbbabce0c9ee61d63a5dc65 Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Sat, 23 Jul 2022 10:37:58 +0200 Subject: [PATCH 04/10] extend the vboxmanage sleep interval --- samples/vboxwrapper/vbox_common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/vboxwrapper/vbox_common.cpp b/samples/vboxwrapper/vbox_common.cpp index f8da6411ea..adcb4a33ac 100644 --- a/samples/vboxwrapper/vbox_common.cpp +++ b/samples/vboxwrapper/vbox_common.cpp @@ -1147,7 +1147,7 @@ CLEANUP: int VBOX_BASE::vbm_popen(string& command, string& output, const char* item, bool log_error, bool retry_failures, unsigned int timeout, bool log_trace) { int retval = 0; int retry_count = 0; - double sleep_interval = 1.0; + double sleep_interval = 2.0; string retry_notes; // Initialize command line From b30e3a09517759f87e4ebdb8b5f78e319e0d1890 Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Tue, 26 Jul 2022 07:08:40 +0200 Subject: [PATCH 05/10] mitigate possible VirtualBox bug Workaround for errors like this: VBoxManage.exe: error: Cannot attach medium 'D:\Boinc1\projects\lhcathomedev.cern.ch_lhcathome-dev\ATLAS_vbox_1.14_image.vdi': the media type 'MultiAttach' can only be attached to machines that were created with VirtualBox 4.0 or later VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component SessionMachine, interface IMachine, callee IUnknown VBoxManage.exe: error: Context: "AttachDevice(Bstr(pszCtl).raw(), port, device, DeviceType_HardDisk, pMedium2Mount)" at line 776 of file VBoxManageStorageController.cpp --- samples/vboxwrapper/vbox_common.cpp | 31 +++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/samples/vboxwrapper/vbox_common.cpp b/samples/vboxwrapper/vbox_common.cpp index adcb4a33ac..f1e995d050 100644 --- a/samples/vboxwrapper/vbox_common.cpp +++ b/samples/vboxwrapper/vbox_common.cpp @@ -661,7 +661,7 @@ int VBOX_BASE::get_scratch_directory(string& dir) { int VBOX_BASE::get_slot_directory(string& dir) { char slot_dir[256]; - getcwd(slot_dir, sizeof(slot_dir)); + if (getcwd(slot_dir, sizeof(slot_dir))) {;} dir = slot_dir; if (!dir.empty()) { @@ -1147,7 +1147,7 @@ CLEANUP: int VBOX_BASE::vbm_popen(string& command, string& output, const char* item, bool log_error, bool retry_failures, unsigned int timeout, bool log_trace) { int retval = 0; int retry_count = 0; - double sleep_interval = 2.0; + double sleep_interval = 1.0; string retry_notes; // Initialize command line @@ -1186,13 +1186,25 @@ int VBOX_BASE::vbm_popen(string& command, string& output, const char* item, bool // Error Code: VBOX_E_INVALID_OBJECT_STATE (0x80bb0007) // if (VBOX_E_INVALID_OBJECT_STATE == (unsigned int)retval) { - if (retry_notes.find("Another VirtualBox management") == string::npos) { - retry_notes += "Another VirtualBox management application has locked the session for\n"; - retry_notes += "this VM. BOINC cannot properly monitor this VM\n"; - retry_notes += "and so this job will be aborted.\n\n"; - } - if (retry_count) { - sleep_interval *= 2; + if ((output.find("Cannot attach medium") != string::npos) && + (output.find("the media type") != string::npos) && + (output.find("MultiAttach") != string::npos) && + (output.find("can only be attached to machines that were created with VirtualBox 4.0 or later") != string::npos)) { + // VirtualBox occasionally writes the 'MultiAttach' attribute to + // the disk entry in VirtualBox.xml although this is not allowed there. + // As a result all VMs trying to connect that disk fail. + // Report the error back immediately without a retry. + // + break; + } else { + if (retry_notes.find("Another VirtualBox management") == string::npos) { + retry_notes += "Another VirtualBox management application has locked the session for\n"; + retry_notes += "this VM. BOINC cannot properly monitor this VM\n"; + retry_notes += "and so this job will be aborted.\n\n"; + } + if (retry_count) { + sleep_interval *= 2; + } } } @@ -1482,4 +1494,3 @@ VBOX_VM::VBOX_VM() { VBOX_VM::~VBOX_VM() { } - From ad944a656be7b81e6736b15e607b8954f79adcd0 Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Tue, 26 Jul 2022 07:08:45 +0200 Subject: [PATCH 06/10] mitigate possible VirtualBox bug Workaround for errors like this: VBoxManage.exe: error: Cannot attach medium 'D:\Boinc1\projects\lhcathomedev.cern.ch_lhcathome-dev\ATLAS_vbox_1.14_image.vdi': the media type 'MultiAttach' can only be attached to machines that were created with VirtualBox 4.0 or later VBoxManage.exe: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component SessionMachine, interface IMachine, callee IUnknown VBoxManage.exe: error: Context: "AttachDevice(Bstr(pszCtl).raw(), port, device, DeviceType_HardDisk, pMedium2Mount)" at line 776 of file VBoxManageStorageController.cpp --- samples/vboxwrapper/vbox_vboxmanage.cpp | 193 +++++++++++++++--------- 1 file changed, 121 insertions(+), 72 deletions(-) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index d5f1e0d933..0d04997067 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -16,10 +16,10 @@ // along with BOINC. If not, see . #ifdef _WIN32 -#include #include "boinc_win.h" #include "win_util.h" #else +#include #include #include #include @@ -546,86 +546,135 @@ namespace vboxmanage { // each task gets it's own differencing image (writable) // differencing images are written to the VM's snapshot folder // - string set_new_uuid = ""; - size_t type_start; - size_t type_end; string medium_file = aid.project_dir; medium_file += "/" + multiattach_vdi_file; vboxlog_msg("Adding virtual disk drive to VM. (%s)", multiattach_vdi_file.c_str()); - command = "showhdinfo \"" + medium_file + "\" "; - retval = vbm_popen(command, output, "check if parent hdd is registered", false); - if (retval) { - // showhdinfo implicitly registers unregistered hdds. - // Hence, this has to be handled first. - // - if ((output.rfind("VBoxManage: error:", 0) != string::npos) && - (output.find("Cannot register the hard disk") != string::npos) && - (output.find("because a hard disk") != string::npos) && - (output.find("with UUID") != string::npos) && - (output.find("already exists") != string::npos)) { - // May happen if the project admin didn't set a new UUID. - set_new_uuid = "--setuuid \"\" "; - } else { - // other errors - vboxlog_msg("Error in check if parent hdd is registered.\nCommand:\n%s\nOutput:\n%s", - command.c_str(), - output.c_str() - ); - return retval; + bool vbox_bug_mitigation = false; + + do { + string set_new_uuid = ""; + string type_line = ""; + size_t type_start; + size_t type_end; + int retry_count = 0; + bool log_error = false; + + command = "showhdinfo \"" + medium_file + "\" "; + + retval = vbm_popen(command, output, "check if parent hdd is registered", false); + if (retval) { + // showhdinfo implicitly registers unregistered hdds. + // Hence, this has to be handled first. + // + if ((output.rfind("VBoxManage: error:", 0) != string::npos) && + (output.find("Cannot register the hard disk") != string::npos) && + (output.find("because a hard disk") != string::npos) && + (output.find("with UUID") != string::npos) && + (output.find("already exists") != string::npos)) { + // May happen if the project admin didn't set a new UUID. + set_new_uuid = "--setuuid \"\" "; + } else { + // other errors + vboxlog_msg("Error in check if parent hdd is registered.\nCommand:\n%s\nOutput:\n%s", + command.c_str(), + output.c_str() + ); + return retval; + } } - } - // Output from showhdinfo should look a little like this: - // UUID: c119bcaf-636c-41f6-86c9-384739a31339 - // Parent UUID: base - // State: created - // Type: multiattach - // Location: C:\Users\romw\VirtualBox VMs\test2\test2.vdi - // Storage format: VDI - // Format variant: dynamic default - // Capacity: 2048 MBytes - // Size on disk: 2 MBytes - // Encryption: disabled - // Property: AllocationBlockSize=1048576 - // Child UUIDs: dcb0daa5-3bf9-47cb-bfff-c65e74484615 - // - type_start = output.find("\nType: ") + 1; - type_end = output.find("\n", type_start) - type_start; - - if (output.substr(type_start, type_end).find("multiattach") == string::npos) { - // Parent hdd is not (yet) of type multiattach. - // Vdi files can't be registered and set to multiattach mode within 1 step. - // They must first be attached to a VM in normal mode, then detached from the VM - - // ensure the medium is not registered in the global media store - command = "closemedium \"" + medium_file + "\" "; - - retval = vbm_popen(command, output, "deregister parent vdi"); - if (retval) return retval; - - command = command_fix_part; - command += set_new_uuid + "--medium \"" + medium_file + "\" "; - - retval = vbm_popen(command, output, "register parent vdi"); - if (retval) return retval; - - command = command_fix_part; - command += "--medium none "; - - retval = vbm_popen(command, output, "detach parent vdi"); - if (retval) return retval; - // the vdi file is now registered and ready to be attached in multiattach mode + // Output from showhdinfo should look a little like this: + // UUID: c119bcaf-636c-41f6-86c9-384739a31339 + // Parent UUID: base + // State: created + // Type: multiattach + // Location: C:\Users\romw\VirtualBox VMs\test2\test2.vdi + // Storage format: VDI + // Format variant: dynamic default + // Capacity: 2048 MBytes + // Size on disk: 2 MBytes + // Encryption: disabled + // Property: AllocationBlockSize=1048576 + // Child UUIDs: dcb0daa5-3bf9-47cb-bfff-c65e74484615 // + + type_line = output; + transform(type_line.cbegin(), type_line.cend(), + type_line.begin(), [](unsigned char c) { return tolower(c); }); + type_start = type_line.find("\ntype: ") + 1; + type_end = type_line.find("\n", type_start) - type_start; + type_line = type_line.substr(type_start, type_end); + + if (type_line.find("multiattach") == string::npos) { + // Parent hdd is not (yet) of type multiattach. + // Vdi files can't be registered and set to multiattach mode within 1 step. + // They must first be attached to a VM in normal mode, then detached from the VM + + command = command_fix_part; + command += set_new_uuid + "--medium \"" + medium_file + "\" "; + + retval = vbm_popen(command, output, "register parent vdi"); + if (retval) return retval; + + command = command_fix_part; + command += "--medium none "; + + retval = vbm_popen(command, output, "detach parent vdi"); + if (retval) return retval; + // the vdi file is now registered and ready to be attached in multiattach mode + // + } + + do { + command = command_fix_part; + command += "--mtype multiattach "; + command += "--medium \"" + medium_file + "\" "; + + retval = vbm_popen(command, output, "storage attach (fixed disk - multiattach mode)", log_error); + if (retval) { + // VirtualBox occasionally writes the 'MultiAttach' attribute to + // the disk entry in VirtualBox.xml although this is not allowed there. + // As a result all VMs trying to connect that disk fail. + // The error needs to be cleaned here to allow vboxwrapper to + // succeed even with uncorrected VirtualBox versions. + // + // After cleanup attaching the disk should be tried again. + + if ((output.find("Cannot attach medium") != string::npos) && + (output.find("the media type") != string::npos) && + (output.find("MultiAttach") != string::npos) && + (output.find("can only be attached to machines that were created with VirtualBox 4.0 or later") != string::npos)) { + // try to deregister the medium from the global media store + command = "closemedium \"" + medium_file + "\" "; + + retval = vbm_popen(command, output, "deregister parent vdi"); + if (retval) return retval; + break; + } + + if (retry_count >= 1) { + // in case of other errors or if retry try also failed + vboxlog_msg("Error in storage attach (fixed disk - multiattach mode).\nCommand:\n%s\nOutput:\n%s", + command.c_str(), + output.c_str() + ); + return retval; + } + + retry_count++; + log_error = true; + boinc_sleep(1.0); + + } else { + vbox_bug_mitigation = true; + break; + } + } + while (true); } - - command = command_fix_part; - command += "--mtype multiattach "; - command += "--medium \"" + medium_file + "\" "; - - retval = vbm_popen(command, output, "storage attach (fixed disk - multiattach mode)"); - if (retval) return retval; + while (!vbox_bug_mitigation); } From 5347c8068c5594cc008dacb80e97c4c85601a08c Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Thu, 28 Jul 2022 09:20:22 +0200 Subject: [PATCH 07/10] Print a reminder to use unique UUIDs Setting a new disk UUID is a temporary workaround to avoid a task getting cancelled. Since it modifies the vdi file BOINC client will sooner or later download a fresh vdi copy from the server. For a permanent solution the project admin has to ensure each vdi file has a unique UUID before it is used for an app_version. --- samples/vboxwrapper/vbox_vboxmanage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index 0d04997067..4313ff608e 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -575,6 +575,10 @@ namespace vboxmanage { (output.find("already exists") != string::npos)) { // May happen if the project admin didn't set a new UUID. set_new_uuid = "--setuuid \"\" "; + + vboxlog_msg("Disk UUID conflicts with an already existing disk.\nWill set a new UUID for '%s'.\nThe project admin should be informed to do this server side running:\nvboxmanage clonemedium \n", + multiattach_vdi_file.c_str() + ); } else { // other errors vboxlog_msg("Error in check if parent hdd is registered.\nCommand:\n%s\nOutput:\n%s", From 89cd1148b7a29d5ccbf0a4cf95bf364ce06726fd Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Sun, 31 Jul 2022 17:34:50 +0200 Subject: [PATCH 08/10] Ensure correct logging Enables logging if loop is executed a 2nd time. --- samples/vboxwrapper/vbox_vboxmanage.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index 4313ff608e..c9b236f2da 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -551,6 +551,8 @@ namespace vboxmanage { vboxlog_msg("Adding virtual disk drive to VM. (%s)", multiattach_vdi_file.c_str()); + int retry_count = 0; + bool log_error = false; bool vbox_bug_mitigation = false; do { @@ -558,8 +560,6 @@ namespace vboxmanage { string type_line = ""; size_t type_start; size_t type_end; - int retry_count = 0; - bool log_error = false; command = "showhdinfo \"" + medium_file + "\" "; @@ -655,11 +655,15 @@ namespace vboxmanage { retval = vbm_popen(command, output, "deregister parent vdi"); if (retval) return retval; + + retry_count++; + log_error = true; + boinc_sleep(1.0); break; } if (retry_count >= 1) { - // in case of other errors or if retry try also failed + // in case of other errors or if retry also failed vboxlog_msg("Error in storage attach (fixed disk - multiattach mode).\nCommand:\n%s\nOutput:\n%s", command.c_str(), output.c_str() From 57d6556b9e05f072b0a872620f4bcef309e7a248 Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Sun, 31 Jul 2022 19:31:50 +0200 Subject: [PATCH 09/10] Avoid an enless loop condition --- samples/vboxwrapper/vbox_vboxmanage.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/vboxwrapper/vbox_vboxmanage.cpp b/samples/vboxwrapper/vbox_vboxmanage.cpp index c9b236f2da..6aef5daae3 100644 --- a/samples/vboxwrapper/vbox_vboxmanage.cpp +++ b/samples/vboxwrapper/vbox_vboxmanage.cpp @@ -646,7 +646,8 @@ namespace vboxmanage { // // After cleanup attaching the disk should be tried again. - if ((output.find("Cannot attach medium") != string::npos) && + if ((retry_count < 1) && + (output.find("Cannot attach medium") != string::npos) && (output.find("the media type") != string::npos) && (output.find("MultiAttach") != string::npos) && (output.find("can only be attached to machines that were created with VirtualBox 4.0 or later") != string::npos)) { From 5b44ed2e6054bb20839acd703dfad1f5bfc72a23 Mon Sep 17 00:00:00 2001 From: computezrmle <57127745+computezrmle@users.noreply.github.com> Date: Sun, 31 Jul 2022 21:20:03 +0200 Subject: [PATCH 10/10] Cancel previous change --- samples/vboxwrapper/vbox_common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/vboxwrapper/vbox_common.cpp b/samples/vboxwrapper/vbox_common.cpp index f1e995d050..d847ea0cfb 100644 --- a/samples/vboxwrapper/vbox_common.cpp +++ b/samples/vboxwrapper/vbox_common.cpp @@ -661,7 +661,7 @@ int VBOX_BASE::get_scratch_directory(string& dir) { int VBOX_BASE::get_slot_directory(string& dir) { char slot_dir[256]; - if (getcwd(slot_dir, sizeof(slot_dir))) {;} + getcwd(slot_dir, sizeof(slot_dir)); dir = slot_dir; if (!dir.empty()) {