propagating fix from 2.2.4

This commit is contained in:
Alex Huang 2011-05-05 17:53:44 -07:00
parent b2cf4e39ea
commit 7bc25643a9
2 changed files with 8 additions and 5 deletions

View File

@ -1822,6 +1822,7 @@ public class AgentManagerImpl implements AgentManager, HandlerFactory, ResourceS
HostVO host = _hostDao.findById(id);
if (!_hostDao.directConnect(host, _nodeId)) {
s_logger.info("Someone else is loading " + host);
resource.disconnected();
return null;
}
}

View File

@ -700,7 +700,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
} catch (OperationTimedoutException e) {
s_logger.debug("Unable to send the start command to host " + dest.getHost());
if (e.isActive()) {
_haMgr.scheduleStop(vm, destHostId, WorkType.ForceStop);
_haMgr.scheduleStop(vm, destHostId, WorkType.CheckStop);
}
canRetry = false;
throw new AgentUnavailableException("Unable to start " + vm.getHostName(), destHostId, e);
@ -734,12 +734,14 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
}
}
} finally {
if (startedVm == null && canRetry) {
// decrement only for user VM's and newly created VM
if (vm.getType().equals(VirtualMachine.Type.User) && (vm.getLastHostId() == null)) {
if (startedVm == null) {
// decrement only for user VM's and newly created VM
if (vm.getType().equals(VirtualMachine.Type.User) && (vm.getLastHostId() == null)) {
_accountMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm);
}
changeState(vm, Event.OperationFailed, null, work, Step.Done);
if (canRetry) {
changeState(vm, Event.OperationFailed, null, work, Step.Done);
}
}
}