public function stopHost($vmDetails)
{
// what are we doing?
$log = usingLog()->startAction("stop VM");
// is the VM actually running?
if (!$this->isRunning($vmDetails)) {
// we've decided not to treat this as an error ... that might
// change in a future release
$log->endAction("VM was already stopped or destroyed");
return;
}
// yes it is ... shut it down
$command = "vagrant halt";
$result = $this->runCommandAgainstHostManager($vmDetails, $command);
// did it work?
if ($result->returnCode != 0) {
$log->endAction("VM failed to shutdown :(");
throw new E5xx_ActionFailed(__METHOD__);
}
// all done - success!
$log->endAction("VM successfully stopped");
}