incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject [5/50] [abbrv] git commit: refs/heads/vim51_win8 - CLOUDSTACK-1367 NPE noticed in logs while AgentMonitor is monitoring the host ping interval
Date Mon, 25 Feb 2013 20:46:47 GMT
CLOUDSTACK-1367 NPE noticed in logs while AgentMonitor is monitoring the host ping interval

Added null check. If the host is not found, we dont ping anymore.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/6823adb3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/6823adb3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/6823adb3

Branch: refs/heads/vim51_win8
Commit: 6823adb3ac195e1c5fa76a898b5a0c8b011e7a88
Parents: 1689062
Author: Prachi Damle <prachi@cloud.com>
Authored: Thu Feb 21 17:39:09 2013 -0800
Committer: Prachi Damle <prachi@cloud.com>
Committed: Thu Feb 21 17:40:08 2013 -0800

----------------------------------------------------------------------
 .../src/com/cloud/agent/manager/AgentMonitor.java  |   32 +++++++++-----
 1 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/6823adb3/server/src/com/cloud/agent/manager/AgentMonitor.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentMonitor.java b/server/src/com/cloud/agent/manager/AgentMonitor.java
index 97c0411..c019a76 100755
--- a/server/src/com/cloud/agent/manager/AgentMonitor.java
+++ b/server/src/com/cloud/agent/manager/AgentMonitor.java
@@ -71,7 +71,7 @@ public class AgentMonitor extends Thread implements Listener {
     private ConnectionConcierge _concierge;
     @Inject ClusterDao _clusterDao;
     @Inject ResourceManager _resourceMgr;
-    
+
     // private ConnectionConcierge _concierge;
     private Map<Long, Long> _pingMap;
 
@@ -104,7 +104,7 @@ public class AgentMonitor extends Thread implements Listener {
 
     /**
      * Check if the agent is behind on ping
-     * 
+     *
      * @param agentId
      *            agent or host id.
      * @return null if the agent is not kept here. true if behind; false if not.
@@ -144,21 +144,29 @@ public class AgentMonitor extends Thread implements Listener {
                 	SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
                 	sc.addAnd(sc.getEntity().getId(), Op.EQ, agentId);
                 	HostVO h = sc.find();
-                	ResourceState resourceState = h.getResourceState();
-                	if (resourceState == ResourceState.Disabled || resourceState == ResourceState.Maintenance
|| resourceState == ResourceState.ErrorInMaintenance) {
-                		/* Host is in non-operation state, so no investigation and direct put agent
to Disconnected */
-                		status_Logger.debug("Ping timeout but host " + agentId + " is in resource
state of " + resourceState + ", so no investigation");
-                		_agentMgr.disconnectWithoutInvestigation(agentId, Event.ShutdownRequested);
-                	} else {
-                		status_Logger.debug("Ping timeout for host " + agentId + ", do invstigation");
-                		_agentMgr.disconnectWithInvestigation(agentId, Event.PingTimeout);
+                    if (h != null) {
+                        ResourceState resourceState = h.getResourceState();
+                        if (resourceState == ResourceState.Disabled || resourceState == ResourceState.Maintenance
+                                || resourceState == ResourceState.ErrorInMaintenance) {
+                            /*
+                             * Host is in non-operation state, so no
+                             * investigation and direct put agent to
+                             * Disconnected
+                             */
+                            status_Logger.debug("Ping timeout but host " + agentId + " is
in resource state of "
+                                    + resourceState + ", so no investigation");
+                            _agentMgr.disconnectWithoutInvestigation(agentId, Event.ShutdownRequested);
+                        } else {
+                            status_Logger.debug("Ping timeout for host " + agentId + ", do
invstigation");
+                            _agentMgr.disconnectWithInvestigation(agentId, Event.PingTimeout);
+                        }
                 	}
                 }
 
                 SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
                 sc.addAnd(sc.getEntity().getResourceState(), Op.IN, ResourceState.PrepareForMaintenance,
ResourceState.ErrorInMaintenance);
                 List<HostVO> hosts = sc.list();
-                
+
                 for (HostVO host : hosts) {
                     long hostId = host.getId();
                     DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId());
@@ -170,7 +178,7 @@ public class AgentMonitor extends Thread implements Listener {
                         List<VMInstanceVO> vosMigrating = _vmDao.listVmsMigratingFromHost(hostId);
                         if (vos.isEmpty() && vosMigrating.isEmpty()) {
                             _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, host.getDataCenterId(),
host.getPodId(), "Migration Complete for host " + hostDesc, "Host [" + hostDesc + "] is ready
for maintenance");
-                            _resourceMgr.resourceStateTransitTo(host, ResourceState.Event.InternalEnterMaintenance,
_msId);   
+                            _resourceMgr.resourceStateTransitTo(host, ResourceState.Event.InternalEnterMaintenance,
_msId);
                         }
                     }
                 }


Mime
View raw message