Skip to content

Commit 6b4aed2

Browse files
committed
CLOUDSTACK-3535: fix regression introduced in 5d9fa5d
1 parent 4c6ec5f commit 6b4aed2

3 files changed

Lines changed: 16 additions & 7 deletions

File tree

engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ protected Void createVolumeFromBaseImageCallBack(
522522
if (result.isSuccess()) {
523523
vo.processEvent(Event.OperationSuccessed, result.getAnswer());
524524
} else {
525+
525526
vo.processEvent(Event.OperationFailed);
526527
volResult.setResult(result.getResult());
527528
}

plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,19 @@ public Status isAgentAlive(HostVO agent) {
5959
return null;
6060
}
6161
CheckOnHostCommand cmd = new CheckOnHostCommand(agent);
62-
List<HostVO> neighbors = _resourceMgr.listAllHostsInCluster(agent.getClusterId());
62+
List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(agent.getClusterId(), Status.Up);
6363
for (HostVO neighbor : neighbors) {
6464
if (neighbor.getId() == agent.getId() || neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM) {
6565
continue;
6666
}
67-
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
68-
69-
return answer.getResult() ? Status.Down : Status.Up;
70-
67+
try {
68+
Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
69+
if (answer != null) {
70+
return answer.getResult() ? Status.Down : Status.Up;
71+
}
72+
} catch (Exception e) {
73+
s_logger.debug("Failed to send command to host: " + neighbor.getId());
74+
}
7175
}
7276

7377
return null;

server/src/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,10 +1254,14 @@ public <T extends VMInstanceVO> boolean advanceStop(T vm, boolean forced, User u
12541254

12551255
} catch (AgentUnavailableException e) {
12561256
s_logger.warn("Unable to stop vm, agent unavailable: " + e.toString());
1257-
throw e;
1257+
if (!forced) {
1258+
throw e;
1259+
}
12581260
} catch (OperationTimedoutException e) {
12591261
s_logger.warn("Unable to stop vm, operation timed out: " + e.toString());
1260-
throw e;
1262+
if (!forced) {
1263+
throw e;
1264+
}
12611265
} finally {
12621266
if (!stopped) {
12631267
if (!forced) {

0 commit comments

Comments
 (0)