CLOUDSTACK-3535: fix regression introduced in 5d9fa5d42e

This commit is contained in:
Edison Su 2013-08-27 18:08:06 -07:00
parent 6489b3bf61
commit 2227eb191a
3 changed files with 16 additions and 7 deletions

View File

@ -1203,10 +1203,14 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
} catch (AgentUnavailableException e) {
s_logger.warn("Unable to stop vm, agent unavailable: " + e.toString());
throw e;
if (!forced) {
throw e;
}
} catch (OperationTimedoutException e) {
s_logger.warn("Unable to stop vm, operation timed out: " + e.toString());
throw e;
if (!forced) {
throw e;
}
} finally {
if (!stopped) {
if (!cleanUpEvenIfUnableToStop) {

View File

@ -518,6 +518,7 @@ public class VolumeServiceImpl implements VolumeService {
if (result.isSuccess()) {
vo.processEvent(Event.OperationSuccessed, result.getAnswer());
} else {
vo.processEvent(Event.OperationFailed);
volResult.setResult(result.getResult());
// hack for Vmware: host is down, previously download template to the host needs to be re-downloaded, so we need to reset

View File

@ -58,15 +58,19 @@ public class KVMInvestigator extends AdapterBase implements Investigator {
return null;
}
CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
List<HostVO> neighbors = _resourceMgr.listAllHostsInCluster(agent.getClusterId());
List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(agent.getClusterId(), Status.Up);
for (HostVO neighbor : neighbors) {
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM) {
continue;
}
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
return answer.getResult() ? Status.Down : Status.Up;
try {
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
if (answer != null) {
return answer.getResult() ? Status.Down : Status.Up;
}
} catch (Exception e) {
s_logger.debug("Failed to send command to host: " + neighbor.getId());
}
}
return null;