- VBOX: Don't attempt to stop a VM that is already shut down.

samples/vboxwrapper/
        vbox.cpp

svn path=/trunk/boinc/; revision=24185
This commit is contained in:
Rom Walton 2011-09-13 21:49:42 +00:00
parent 98efec4538
commit 8f3249720f
2 changed files with 28 additions and 14 deletions

View File

@ -5944,3 +5944,9 @@ Rom 13 Sept 2011
samples/vboxwrapper/
vbox.cpp
Rom 13 Sept 2011
- VBOX: Don't attempt to stop a VM that is already shut down.
samples/vboxwrapper/
vbox.cpp

View File

@ -778,23 +778,31 @@ int VBOX_VM::stop() {
char buf[256];
int retval;
fprintf(
stderr,
"%s Stopping virtual machine.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
command = "controlvm \"" + vm_name + "\" savestate";
retval = vbm_popen(command, output);
if (retval) {
if (is_running()) {
fprintf(
stderr,
"%s Error stopping virtual machine! rc = 0x%x\nCommand:\n%s\nOutput:\n%s\n",
boinc_msg_prefix(buf, sizeof(buf)),
retval,
command.c_str(),
output.c_str()
"%s Stopping virtual machine.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
command = "controlvm \"" + vm_name + "\" savestate";
retval = vbm_popen(command, output);
if (retval) {
fprintf(
stderr,
"%s Error stopping virtual machine! rc = 0x%x\nCommand:\n%s\nOutput:\n%s\n",
boinc_msg_prefix(buf, sizeof(buf)),
retval,
command.c_str(),
output.c_str()
);
return retval;
}
} else {
fprintf(
stderr,
"%s Virtual machine is already in a stopped state.\n",
boinc_msg_prefix(buf, sizeof(buf))
);
return retval;
}
return 0;
}