when host is pingtimeout and CCP can not determine the host status, put the host to Alert status , no VM HA.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4a13f814 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4a13f814 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4a13f814 Branch: refs/heads/hotfix/CLOUDSTACK-7776 Commit: 4a13f81485c0f0664c60acafe534946e7428f080 Parents: ee0f0a1 Author: Anthony Xu <anthony...@citrix.com> Authored: Wed Oct 22 14:53:22 2014 -0700 Committer: Anthony Xu <anthony...@citrix.com> Committed: Wed Oct 22 15:14:46 2014 -0700 ---------------------------------------------------------------------- api/src/com/cloud/host/Status.java | 2 +- .../src/com/cloud/agent/manager/AgentManagerImpl.java | 12 +++++++----- .../src/com/cloud/ha/HighAvailabilityManagerImpl.java | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a13f814/api/src/com/cloud/host/Status.java ---------------------------------------------------------------------- diff --git a/api/src/com/cloud/host/Status.java b/api/src/com/cloud/host/Status.java index 2a8bf9e..732a066 100755 --- a/api/src/com/cloud/host/Status.java +++ b/api/src/com/cloud/host/Status.java @@ -123,7 +123,7 @@ public enum Status { s_fsm.addTransition(Status.Connecting, Event.Ready, Status.Up); s_fsm.addTransition(Status.Connecting, Event.PingTimeout, Status.Alert); s_fsm.addTransition(Status.Connecting, Event.ShutdownRequested, Status.Disconnected); - s_fsm.addTransition(Status.Connecting, Event.HostDown, Status.Alert); + s_fsm.addTransition(Status.Connecting, Event.HostDown, Status.Down); s_fsm.addTransition(Status.Connecting, Event.Ping, Status.Connecting); s_fsm.addTransition(Status.Connecting, Event.ManagementServerDown, Status.Disconnected); s_fsm.addTransition(Status.Connecting, Event.AgentDisconnected, Status.Alert); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a13f814/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java index c6664d9..105a82d 100755 --- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java +++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java @@ -825,6 +825,10 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl if (determinedState == Status.Down) { s_logger.error("Host is down: " + host.getId() + "-" + host.getName() + ". Starting HA on the VMs"); + if ((host.getType() != Host.Type.SecondaryStorage) && (host.getType() != Host.Type.ConsoleProxy)) { + _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host disconnected, " + host.getId(), + "Host is down: " + host.getId() + "-" + host.getName() + ". Starting HA on the VMs"); + } event = Status.Event.HostDown; } else if (determinedState == Status.Up) { /* Got ping response from host, bring it back*/ @@ -857,20 +861,18 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl HostPodVO podVO = _podDao.findById(host.getPodId()); String hostDesc = "name: " + host.getName() + " (id:" + host.getId() + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName(); _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host in ALERT state, " + hostDesc, - "In availability zone " + host.getDataCenterId() - + ", host is in alert state: " + host.getId() + "-" + host.getName()); + "In availability zone " + host.getDataCenterId() + ", " + host.getId() + "-" + host.getName() + + " disconnect due to event " + event + ", ms can't determine the host status" ); } } else { s_logger.debug("The next status of Agent " + host.getId() + " is not Alert, no need to investigate what happened"); } } - handleDisconnectWithoutInvestigation(attache, event, true, true); host = _hostDao.findById(hostId); // Maybe the host magically reappeared? - if (host != null && (host.getStatus() == Status.Alert || host.getStatus() == Status.Down)) { + if (host != null && host.getStatus() == Status.Down) { _haMgr.scheduleRestartForVmsOnHost(host, true); } - return true; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4a13f814/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java index 23fc7c9..fabdde6 100755 --- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java +++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java @@ -202,7 +202,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai public Status investigate(final long hostId) { final HostVO host = _hostDao.findById(hostId); if (host == null) { - return null; + return Status.Alert; } Status hostState = null; @@ -219,7 +219,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } } - return null; + return Status.Alert; } @Override