* Move the windows_format_error_string function to win_util.cpp, .h instead of it being scattered between util.h and str_util.cpp.
* Convert the Windows error string into UTF8 before allowing it to be used by the caller
* Remove windows_error_string from library
6.10 and older do not detect if VirtualBox has been installed. If a VM job is assigned to a host running on an old client and the wrapper detects VirtualBox is not installed reschedule the job for execution at a later date. This prevents the client from requesting excessive amounts of work which will all fail. Eventually the job will error out when it passes its deadline.
HOME environment variable is missing. Without the HOME environment
variable VirtualBox attempts to write log files and other state
information in root's home directory.
- Win process control (affects API and wrapper):
Since Win doesn't have an API for process suspend/resume,
we were suspending processes by
1) enumerating all the threads in the system (typically several thousand)
2) suspending those belonging to the given process
The problem: for each thread, the code was calling a function
in diagnostics_win.cpp to see if the thread was exempted from suspension.
This check (which is unnecessary anyway if we're suspending another process)
was surrounded by a semaphore acquire/release.
The result: performance problems.
It could take a minute to suspend the threads.
Solution:
1) do the check for exemption only if we're suspending threads
in our own process (i.e. from the API)
2) if we're suspending multiple processes, enumerate the threads
only once, and see if each one belongs to any of the processes
3) have the wrapper elevate itself to normal priority.
Otherwise it can get preempted for long periods,
sometimes in the middle of scanning the threads.
Note: post-9x versions of Win have a process group API that includes suspend/resume.
We'll switch to this soon.
controller to use. It can be specified by adding the following
tags to vbox_job.xml:
<vm_disk_controller_type></vm_disk_controller_type>
<vm_disk_controller_model></vm_disk_controller_model>
Executing vboxmanage --help will list the available options in the
storeagectl section.
Deleting stale snapshots now consists of enumerating the existing
snapshots and deleting all but the most recent snapshot. This fixes
the problem where, for one reason or another, a snapshot could not
be deleted at one point in time. The wrapper would just continue to
create new ones and was unable to successfully deal with the older
ones. Disk space would eventually run out.
VirtualBox 4.2 no longer requires certain commands to be executed
to unregister a VM while older versions do. Just ignore any error
codes, if it becomes a problem we can always make it conditional
on what version of VirtualBox is installed.