Visitar URL original
KVM HA: Fix CheckOnHostAnswer success flag when there is no heartbeat… · ablecloud-team/ablestack-cloud@02902d5 · GitHub
Skip to content

Commit 02902d5

Browse files
sureshanapartidhslove
authored andcommitted
KVM HA: Fix CheckOnHostAnswer success flag when there is no heartbeat (apache#13373)
(cherry picked from commit 4262c02)
1 parent 8b27a42 commit 02902d5

5 files changed

Lines changed: 8 additions & 4 deletions

File tree

‎plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtCheckOnHostCommandWrapper.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public Answer execute(final CheckOnHostCommand command, final LibvirtComputingRe
5757
if (hasHeartBeat) {
5858
return new CheckOnHostAnswer(command, true, "Heart is beating");
5959
} else {
60-
return new CheckOnHostAnswer(command, "Heart is not beating");
60+
return new CheckOnHostAnswer(command, false, "Heart is not beating");
6161
}
6262
} catch (final InterruptedException e) {
6363
return new CheckOnHostAnswer(command, "CheckOnHostCommand: can't get status of host: InterruptedException");

‎plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/kvm/ha/KVMHostActivityChecker.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public Status getHostAgentStatus(Host host) {
117117
}
118118

119119
Status hostStatusFromNeighbour = checkHostStatusWithNeighbourHosts(host);
120+
logger.debug("{} status reported from itself: {} and neighbor: {}", host.toString(), hostStatusFromItself, hostStatusFromNeighbour);
120121
Status hostStatus = hostStatusFromItself;
121122
if (hostStatusFromNeighbour == Status.Up && (hostStatusFromItself == Status.Disconnected || hostStatusFromItself == Status.Down)) {
122123
hostStatus = Status.Disconnected;

‎plugins/hypervisors/kvm/src/test/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResourceTest.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import javax.xml.xpath.XPathExpressionException;
6262
import javax.xml.xpath.XPathFactory;
6363

64+
import com.cloud.agent.api.CheckOnHostAnswer;
6465
import com.google.gson.JsonObject;
6566
import com.google.gson.JsonParser;
6667

@@ -3202,7 +3203,9 @@ public void testCheckOnHostCommand() {
32023203
assertNotNull(wrapper);
32033204

32043205
final Answer answer = wrapper.execute(command, libvirtComputingResourceMock);
3205-
assertFalse(answer.getResult());
3206+
assertTrue(answer.getResult());
3207+
assertTrue(answer instanceof CheckOnHostAnswer);
3208+
assertFalse(((CheckOnHostAnswer)answer).isAlive());
32063209

32073210
verify(libvirtComputingResourceMock, times(1)).getMonitor();
32083211
}

‎plugins/hypervisors/vmware/src/main/java/com/cloud/hypervisor/vmware/resource/VmwareResource.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5807,7 +5807,7 @@ protected Answer execute(PingTestCommand cmd) {
58075807
}
58085808

58095809
protected Answer execute(CheckOnHostCommand cmd) {
5810-
return new CheckOnHostAnswer(cmd, null, "Not Implmeneted");
5810+
return new CheckOnHostAnswer(cmd, null, "Not Implemented");
58115811
}
58125812

58135813
protected Answer execute(ModifySshKeysCommand cmd) {

‎plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCheckOnHostCommandWrapper.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ public final class CitrixCheckOnHostCommandWrapper extends CommandWrapper<CheckO
3131

3232
@Override
3333
public Answer execute(final CheckOnHostCommand command, final CitrixResourceBase citrixResourceBase) {
34-
return new CheckOnHostAnswer(command, "Not Implmeneted");
34+
return new CheckOnHostAnswer(command, "Not Implemented");
3535
}
3636
}

0 commit comments

Comments
 (0)