CLOUDSTACK-3535: fix regression introduced in 5d9fa5d42e

This commit is contained in:
Edison Su 2013-08-27 18:08:06 -07:00
parent 4c6ec5f3c6
commit 6b4aed2aca
3 changed files with 16 additions and 7 deletions

View File

@ -522,6 +522,7 @@ public class VolumeServiceImpl implements VolumeService {
if (result.isSuccess()) { if (result.isSuccess()) {
vo.processEvent(Event.OperationSuccessed, result.getAnswer()); vo.processEvent(Event.OperationSuccessed, result.getAnswer());
} else { } else {
vo.processEvent(Event.OperationFailed); vo.processEvent(Event.OperationFailed);
volResult.setResult(result.getResult()); volResult.setResult(result.getResult());
} }

View File

@ -59,15 +59,19 @@ public class KVMInvestigator extends AdapterBase implements Investigator {
return null; return null;
} }
CheckOnHostCommand cmd = new CheckOnHostCommand(agent); 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) { for (HostVO neighbor : neighbors) {
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM) { if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM) {
continue; continue;
} }
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd); try {
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
return answer.getResult() ? Status.Down : Status.Up; 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; return null;

View File

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