- VBOX: If vm.run() fails, it turns out the VM is parked in some kind of saved

state, deregistering the VM would fail all commands because the VM was not
        mutable.  The first thing we should do when deregistering is discard
        any saved state.
        
    samples/vboxwrapper/
        vbox.cpp
        

svn path=/trunk/boinc/; revision=24862
This commit is contained in:
Rom Walton 2011-12-22 00:15:06 +00:00
parent e73736a01a
commit 86d5915342
3 changed files with 28 additions and 12 deletions

View File

@ -9269,3 +9269,13 @@ Rom 21 Dec 2011
samples/vboxwrapper/
vbox.cpp
Rom 21 Dec 2011
- VBOX: If vm.run() fails, it turns out the VM is parked in some kind of saved
state, deregistering the VM would fail all commands because the VM was not
mutable. The first thing we should do when deregistering is discard
any saved state.
samples/vboxwrapper/
vbox.cpp

View File

@ -499,11 +499,6 @@ int VBOX_VM::register_vm() {
// Create and register the VM
//
fprintf(
stderr,
"%s Registering virtual machine with VirtualBox.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
command = "createvm ";
command += "--name \"" + vm_name + "\" ";
command += "--basefolder \"" + virtual_machine_slot_directory + "\" ";
@ -731,7 +726,7 @@ int VBOX_VM::register_vm_firewall_rules() {
command = "modifyvm \"" + vm_name + "\" ";
command += "--natpf1 delete \"vboxwrapper\" ";
vbm_popen(command, output, "remove stale port forwarding rule", false);
vbm_popen(command, output, "remove stale port forwarding rule");
// Add new firewall rule
//
@ -767,7 +762,18 @@ int VBOX_VM::deregister_vm() {
);
// First step in deregistering a VM is to delete its storage controller(s)
// Discard any saved state information
//
fprintf(
stderr,
"%s Discarding saved state of virtual machine.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
command = "discardstate \"" + vm_name + "\" ";
vbm_popen(command, output, "discard state", false);
// Delete its storage controller(s)
//
fprintf(
stderr,
@ -855,7 +861,7 @@ int VBOX_VM::deregister_stale_vm() {
// Did the user delete the VM in VirtualBox and not the medium? If so,
// just remove the medium.
command = "closemedium disk \"" + virtual_machine_slot_directory + "/" + image_filename + "\" ";
retval = vbm_popen(command, output, "remove medium");
vbm_popen(command, output, "remove medium", false);
}
return 0;
}

View File

@ -81,13 +81,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24858_windows_intelx86.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_intelx86.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24858_windows_intelx86.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_intelx86.pdb"
SubSystem="2"
TargetMachine="1"
/>
@ -182,13 +182,13 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcmt.lib libcpmt.lib kernel32.lib user32.lib gdi32.lib ole32.lib wsock32.lib"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24858_windows_x86_64.exe"
OutputFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_x86_64.exe"
LinkIncremental="0"
SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true"
DelayLoadDLLs=""
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24858_windows_x86_64.pdb"
ProgramDatabaseFile=".\Build\$(PlatformName)\$(ConfigurationName)\vboxwrapper_24860_windows_x86_64.pdb"
SubSystem="2"
TargetMachine="17"
/>