Skip to content

Commit 4a13f81

Browse files
author
Anthony Xu
committed
when host is pingtimeout and CCP can not determine the host status, put the host to Alert status , no VM HA.
1 parent ee0f0a1 commit 4a13f81

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

api/src/com/cloud/host/Status.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public static String[] toStrings(Status... states) {
123123
s_fsm.addTransition(Status.Connecting, Event.Ready, Status.Up);
124124
s_fsm.addTransition(Status.Connecting, Event.PingTimeout, Status.Alert);
125125
s_fsm.addTransition(Status.Connecting, Event.ShutdownRequested, Status.Disconnected);
126-
s_fsm.addTransition(Status.Connecting, Event.HostDown, Status.Alert);
126+
s_fsm.addTransition(Status.Connecting, Event.HostDown, Status.Down);
127127
s_fsm.addTransition(Status.Connecting, Event.Ping, Status.Connecting);
128128
s_fsm.addTransition(Status.Connecting, Event.ManagementServerDown, Status.Disconnected);
129129
s_fsm.addTransition(Status.Connecting, Event.AgentDisconnected, Status.Alert);

engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,10 @@ protected boolean handleDisconnectWithInvestigation(AgentAttache attache, Status
825825

826826
if (determinedState == Status.Down) {
827827
s_logger.error("Host is down: " + host.getId() + "-" + host.getName() + ". Starting HA on the VMs");
828+
if ((host.getType() != Host.Type.SecondaryStorage) && (host.getType() != Host.Type.ConsoleProxy)) {
829+
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host disconnected, " + host.getId(),
830+
"Host is down: " + host.getId() + "-" + host.getName() + ". Starting HA on the VMs");
831+
}
828832
event = Status.Event.HostDown;
829833
} else if (determinedState == Status.Up) {
830834
/* Got ping response from host, bring it back*/
@@ -857,20 +861,18 @@ protected boolean handleDisconnectWithInvestigation(AgentAttache attache, Status
857861
HostPodVO podVO = _podDao.findById(host.getPodId());
858862
String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName();
859863
_alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host in ALERT state, " + hostDesc,
860-
"In availability zone " + host.getDataCenterId()
861-
+ ", host is in alert state: " + host.getId() + "-" + host.getName());
864+
"In availability zone " + host.getDataCenterId() + ", " + host.getId() + "-" + host.getName()
865+
+ " disconnect due to event " + event + ", ms can't determine the host status" );
862866
}
863867
} else {
864868
s_logger.debug("The next status of Agent " + host.getId() + " is not Alert, no need to investigate what happened");
865869
}
866870
}
867-
868871
handleDisconnectWithoutInvestigation(attache, event, true, true);
869872
host = _hostDao.findById(hostId); // Maybe the host magically reappeared?
870-
if (host != null && (host.getStatus() == Status.Alert || host.getStatus() == Status.Down)) {
873+
if (host != null && host.getStatus() == Status.Down) {
871874
_haMgr.scheduleRestartForVmsOnHost(host, true);
872875
}
873-
874876
return true;
875877
}
876878

server/src/com/cloud/ha/HighAvailabilityManagerImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ protected HighAvailabilityManagerImpl() {
202202
public Status investigate(final long hostId) {
203203
final HostVO host = _hostDao.findById(hostId);
204204
if (host == null) {
205-
return null;
205+
return Status.Alert;
206206
}
207207

208208
Status hostState = null;
@@ -219,7 +219,7 @@ public Status investigate(final long hostId) {
219219
}
220220
}
221221

222-
return null;
222+
return Status.Alert;
223223
}
224224

225225
@Override

0 commit comments

Comments
 (0)