You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/07/30 04:13:00 UTC

[1/4] git commit: updated refs/heads/master to 486e0d0

Updated Branches:
  refs/heads/master f0f55226d -> 486e0d02f


Unused code removal


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

Branch: refs/heads/master
Commit: d0a3a69170314a1bc84d106d949f771005b677c2
Parents: 46e644e
Author: Alex Huang <al...@citrix.com>
Authored: Mon Jul 29 13:04:26 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Jul 29 19:13:31 2013 -0700

----------------------------------------------------------------------
 .../cloud/agent/manager/AgentManagerImpl.java   | 62 ++------------------
 1 file changed, 5 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d0a3a691/server/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
index f49fca6..3778431 100755
--- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -42,7 +42,6 @@ import javax.naming.ConfigurationException;
 import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.context.ServerContexts;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
 
 import com.cloud.agent.AgentManager;
@@ -69,16 +68,13 @@ import com.cloud.agent.api.UnsupportedAnswer;
 import com.cloud.agent.transport.Request;
 import com.cloud.agent.transport.Response;
 import com.cloud.alert.AlertManager;
-import com.cloud.capacity.dao.CapacityDao;
 import com.cloud.configuration.Config;
 import com.cloud.configuration.dao.ConfigurationDao;
-import com.cloud.dc.ClusterDetailsDao;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.dc.dao.DataCenterIpAddressDao;
 import com.cloud.dc.dao.HostPodDao;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.ConnectionException;
@@ -90,27 +86,20 @@ import com.cloud.host.HostVO;
 import com.cloud.host.Status;
 import com.cloud.host.Status.Event;
 import com.cloud.host.dao.HostDao;
-import com.cloud.host.dao.HostTagsDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.hypervisor.HypervisorGuruManager;
 import com.cloud.hypervisor.kvm.discoverer.KvmDummyResourceBase;
-import com.cloud.network.dao.IPAddressDao;
 import com.cloud.resource.Discoverer;
 import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceState;
 import com.cloud.resource.ServerResource;
-import com.cloud.storage.StorageManager;
-import com.cloud.storage.StorageService;
-import com.cloud.storage.dao.StoragePoolHostDao;
-import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.resource.DummySecondaryStorageResource;
-import com.cloud.storage.secondary.SecondaryStorageVmManager;
-import com.cloud.user.AccountManager;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
+import com.cloud.utils.db.EntityManager;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.HypervisorVersionChangedException;
@@ -120,8 +109,6 @@ import com.cloud.utils.nio.HandlerFactory;
 import com.cloud.utils.nio.Link;
 import com.cloud.utils.nio.NioServer;
 import com.cloud.utils.nio.Task;
-import com.cloud.vm.VirtualMachineManager;
-import com.cloud.vm.dao.VMInstanceDao;
 
 /**
  * Implementation of the Agent Manager. This class controls the connection to the agents.
@@ -153,36 +140,20 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     protected int _monitorId = 0;
     private final Lock _agentStatusLock = new ReentrantLock();
 
+    @Inject
+    protected EntityManager _entityMgr;
+
     protected NioServer _connection;
     @Inject
     protected HostDao _hostDao = null;
     @Inject
     protected DataCenterDao _dcDao = null;
     @Inject
-    protected DataCenterIpAddressDao _privateIPAddressDao = null;
-    @Inject
-    protected IPAddressDao _publicIPAddressDao = null;
-    @Inject
     protected HostPodDao _podDao = null;
     @Inject
-    protected VMInstanceDao _vmDao = null;
-    @Inject
-    protected CapacityDao _capacityDao = null;
-    @Inject
     protected ConfigurationDao _configDao = null;
     @Inject
-    protected PrimaryDataStoreDao _storagePoolDao = null;
-    @Inject
-    protected StoragePoolHostDao _storagePoolHostDao = null;
-    @Inject
     protected ClusterDao _clusterDao = null;
-    @Inject
-    protected ClusterDetailsDao _clusterDetailsDao = null;
-    @Inject
-    protected HostTagsDao _hostTagsDao = null;
-    @Inject
-    protected VolumeDao _volumeDao = null;
-
     protected int _port;
 
     @Inject
@@ -191,25 +162,11 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     protected AlertManager _alertMgr = null;
 
     @Inject
-    protected AccountManager _accountMgr = null;
-
-    @Inject
-    protected VirtualMachineManager _vmMgr = null;
-
-    @Inject StorageService _storageSvr = null;
-    @Inject StorageManager _storageMgr = null;
-
-    @Inject
     protected HypervisorGuruManager _hvGuruMgr;
 
-    @Inject SecondaryStorageVmManager _ssvmMgr;
-
     protected int _retry = 2;
 
-    protected String _instance;
-
     protected int _wait;
-    protected int _updateWait;
     protected int _alertWait;
     protected long _nodeId = -1;
 
@@ -243,9 +200,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         value = configs.get(Config.AlertWait.toString());
         _alertWait = NumbersUtil.parseInt(value, 1800);
 
-        value = configs.get(Config.UpdateWait.toString());
-        _updateWait = NumbersUtil.parseInt(value, 600);
-
         value = configs.get(Config.PingTimeout.toString());
         final float multiplier = value != null ? Float.parseFloat(value) : 2.5f;
         _pingTimeout = (long) (multiplier * _pingInterval);
@@ -255,11 +209,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         value = configs.get(Config.DirectAgentLoadSize.key());
         int threads = NumbersUtil.parseInt(value, 16);
 
-        _instance = configs.get("instance.name");
-        if (_instance == null) {
-            _instance = "DEFAULT";
-        }
-
         _nodeId = ManagementServerNode.getManagementServerId();
         s_logger.info("Configuring AgentManagerImpl. management server node id(msid): " + _nodeId);
 
@@ -641,7 +590,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         ServerResource resource = null;
         try {
             Class<?> clazz = Class.forName(resourceName);
-            Constructor constructor = clazz.getConstructor();
+            Constructor<?> constructor = clazz.getConstructor();
             resource = (ServerResource) constructor.newInstance();
         } catch (ClassNotFoundException e) {
             s_logger.warn("Unable to find class " + host.getResource(), e);
@@ -705,7 +654,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     }
 
 
-    @SuppressWarnings("rawtypes")
     protected boolean loadDirectlyConnectedHost(HostVO host, boolean forRebalance) {
         boolean initialized = false;
         ServerResource resource = null;


[4/4] git commit: updated refs/heads/master to 486e0d0

Posted by ah...@apache.org.
Fixed the applicationcontext.xml because I removed a class.  oh kelven oh kelven, when can we get back our java based config for core components...this is so bad for refactoring


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

Branch: refs/heads/master
Commit: 486e0d02f8bfadf14e743d9354ab52c3332f00cb
Parents: 1d4b22d
Author: Alex Huang <al...@citrix.com>
Authored: Mon Jul 29 19:12:15 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Jul 29 19:13:33 2013 -0700

----------------------------------------------------------------------
 client/tomcatconf/applicationContext.xml.in    | 1 -
 developer/pom.xml                              | 1 +
 server/src/com/cloud/configuration/Config.java | 6 +++++-
 3 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/486e0d02/client/tomcatconf/applicationContext.xml.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in
index 84585e6..1642844 100644
--- a/client/tomcatconf/applicationContext.xml.in
+++ b/client/tomcatconf/applicationContext.xml.in
@@ -805,7 +805,6 @@
     Misc components
   -->
   <bean id="actionEventUtils" class="com.cloud.event.ActionEventUtils" />
-  <bean id="agentMonitor" class="com.cloud.agent.manager.AgentMonitor" />
   <bean id="alertGenerator" class="com.cloud.event.AlertGenerator" />
   <bean id="apiDBUtils" class="com.cloud.api.ApiDBUtils" />
   <bean id="apiDiscoveryServiceImpl" class="org.apache.cloudstack.discovery.ApiDiscoveryServiceImpl" />

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/486e0d02/developer/pom.xml
----------------------------------------------------------------------
diff --git a/developer/pom.xml b/developer/pom.xml
index b86969f..bb17ca7 100644
--- a/developer/pom.xml
+++ b/developer/pom.xml
@@ -26,6 +26,7 @@
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>${cs.mysql.version}</version>
+	  <scope>runtime</scope>
     </dependency>
     <dependency>
       <groupId>commons-dbcp</groupId>

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/486e0d02/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 1107cf1..3d58d75 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -165,6 +165,10 @@ public enum Config {
 	IntegrationAPIPort("Advanced", ManagementServer.class, Integer.class, "integration.api.port", null, "Defaul API port", null),
 	InvestigateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "investigate.retry.interval", "60", "Time (in seconds) between VM pings when agent is disconnected", null),
 	MigrateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "migrate.retry.interval", "120", "Time (in seconds) between migration retries", null),
+    PingInterval("Advanced", AgentManager.class, Integer.class, "ping.interval", "60", "Ping interval in seconds", null),
+    PingTimeout("Advanced", AgentManager.class, Float.class, "ping.timeout", "2.5", "Multiplier to ping.interval before announcing an agent has timed out", null),
+    ClusterDeltaSyncInterval("Advanced", AgentManager.class, Integer.class, "sync.interval", "60", "Cluster Delta sync interval in seconds", null),
+    Port("Advanced", AgentManager.class, Integer.class, "port", "8250", "Port to listen on for agent connection.", null),
 	RouterCpuMHz("Advanced", NetworkManager.class, Integer.class, "router.cpu.mhz", String.valueOf(VpcVirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ), "Default CPU speed (MHz) for router VM.", null),
 	RestartRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "restart.retry.interval", "600", "Time (in seconds) between retries to restart a vm", null),
 	RouterStatsInterval("Advanced", NetworkManager.class, Integer.class, "router.stats.interval", "300", "Interval (in seconds) to report router statistics.", null),
@@ -430,7 +434,7 @@ public enum Config {
     InternalLbVmServiceOfferingId("Advanced", ManagementServer.class, String.class, "internallbvm.service.offering", null, "Uuid of the service offering used by internal lb vm; if NULL - default system internal lb offering will be used", null),
     ExecuteInSequence("Advanced", ManagementServer.class, Boolean.class, "execute.in.sequence.hypervisor.commands", "false", "If set to true, StartCommand, StopCommand, CopyCommand will be synchronized on the agent side." +
     		" If set to false, these commands become asynchronous. Default value is false.", null),
-    ExecuteInSequenceNetworkElementCommands("Advanced", NetworkManager.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." + 
+    ExecuteInSequenceNetworkElementCommands("Advanced", NetworkManager.class, Boolean.class, "execute.in.sequence.network.element.commands", "false", "If set to true, DhcpEntryCommand, SavePasswordCommand, UserDataCommand, VmDataCommand will be synchronized on the agent side." +
             " If set to false, these commands become asynchronous. Default value is false.", null),
 	
 	UCSSyncBladeInterval("Advanced", ManagementServer.class, Integer.class, "ucs.sync.blade.interval", "3600", "the interval cloudstack sync with UCS manager for available blades in case user remove blades from chassis without notifying CloudStack", null);


[3/4] git commit: updated refs/heads/master to 486e0d0

Posted by ah...@apache.org.
Removed AgentMonitor and moved it inside AgentManager


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

Branch: refs/heads/master
Commit: 1d4b22d6de7f28de89e592a218343bacf7c0b2b0
Parents: d0a3a69
Author: Alex Huang <al...@citrix.com>
Authored: Mon Jul 29 17:28:45 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Jul 29 19:13:32 2013 -0700

----------------------------------------------------------------------
 .../cloud/agent/manager/AgentManagerImpl.java   | 257 +++++++++++++----
 .../com/cloud/agent/manager/AgentMonitor.java   | 284 -------------------
 .../agent/manager/AgentMonitorService.java      |   2 -
 .../manager/ClusteredAgentManagerImpl.java      |   4 +-
 server/src/com/cloud/configuration/Config.java  |   4 -
 5 files changed, 202 insertions(+), 349 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d4b22d6/server/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
index 3778431..5be7bf9 100755
--- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -24,7 +24,6 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.Random;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.LinkedBlockingQueue;
@@ -41,6 +40,9 @@ import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
 
+import org.apache.cloudstack.config.ConfigDepot;
+import org.apache.cloudstack.config.ConfigKey;
+import org.apache.cloudstack.config.ConfigValue;
 import org.apache.cloudstack.context.ServerContexts;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
 
@@ -100,6 +102,9 @@ import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.EntityManager;
+import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.SearchCriteria2;
+import com.cloud.utils.db.SearchCriteriaService;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.exception.HypervisorVersionChangedException;
@@ -109,28 +114,15 @@ import com.cloud.utils.nio.HandlerFactory;
 import com.cloud.utils.nio.Link;
 import com.cloud.utils.nio.NioServer;
 import com.cloud.utils.nio.Task;
+import com.cloud.utils.time.InaccurateClock;
 
 /**
  * Implementation of the Agent Manager. This class controls the connection to the agents.
- *
- * @config {@table  || Param Name | Description | Values | Default ||
- *                  || port | port to listen on for agent connection. | Integer | 8250 ||
- *                  || workers | # of worker threads | Integer | 5 || || router.ram.size | default ram for router vm in mb | Integer | 128 ||
- *                  || router.ip.address | ip address for the router | ip | 10.1.1.1 ||
- *                  || wait | Time to wait for control commands to return | seconds | 1800 ||
- *                  || domain | domain for domain routers| String | foo.com ||
- *                  || alert.wait | time to wait before alerting on a disconnected agent | seconds | 1800 ||
- *                  || update.wait | time to wait before alerting on a updating agent | seconds | 600 ||
- *                  || ping.interval | ping interval in seconds | seconds | 60 ||
- *                  || instance.name | Name of the deployment String | required ||
- *                  || start.retry | Number of times to retry start | Number | 2 ||
- *                  || ping.timeout | multiplier to ping.interval before announcing an agent has timed out | float | 2.0x ||
- *                  || router.stats.interval | interval to report router statistics | seconds | 300s || }
  **/
 @Local(value = { AgentManager.class })
 public class AgentManagerImpl extends ManagerBase implements AgentManager, HandlerFactory {
-    private static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class);
-    private static final Logger status_logger = Logger.getLogger(Status.class);
+    protected static final Logger s_logger = Logger.getLogger(AgentManagerImpl.class);
+    protected static final Logger status_logger = Logger.getLogger(Status.class);
 
     protected ConcurrentHashMap<Long, AgentAttache> _agents = new ConcurrentHashMap<Long, AgentAttache>(10007);
     protected List<Pair<Integer, Listener>> _hostMonitors = new ArrayList<Pair<Integer, Listener>>(17);
@@ -140,6 +132,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     protected int _monitorId = 0;
     private final Lock _agentStatusLock = new ReentrantLock();
 
+
     @Inject
     protected EntityManager _entityMgr;
 
@@ -166,24 +159,40 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
 
     protected int _retry = 2;
 
-    protected int _wait;
-    protected int _alertWait;
+    protected ConfigValue<Integer> _wait;
+    protected ConfigValue<Integer> _alertWait;
     protected long _nodeId = -1;
 
-    protected Random _rand = new Random(System.currentTimeMillis());
-
-    protected int _pingInterval;
-    protected long _pingTimeout;
-    @Inject protected AgentMonitorService _monitor;
+    protected ConfigValue<Integer> _pingInterval;
+    protected ConfigValue<Float> _pingTimeout;
 
     protected ExecutorService _executor;
     protected ThreadPoolExecutor _connectExecutor;
     protected ScheduledExecutorService _directAgentExecutor;
+    protected ScheduledExecutorService _monitorExecutor;
 
     protected StateMachine2<Status, Status.Event, Host> _statusStateMachine = Status.getStateMachine();
+    private final Map<Long, Long> _pingMap = new ConcurrentHashMap<Long, Long>(10007);
 
     @Inject ResourceManager _resourceMgr;
 
+    @Inject
+    protected ConfigDepot _configDepot;
+
+    protected final ConfigKey<Integer> Workers = new ConfigKey<Integer>(Integer.class, "workers", "Advance", AgentManager.class, "5",
+            "Number of worker threads handling remote agent connections.", false, "5-Max Thread Limit");
+    protected final ConfigKey<Integer> Port = new ConfigKey<Integer>(Integer.class, "port", "Advance", AgentManager.class, "8250", "Port to listen on for remote agent connections.", false, "Usable port range");
+    protected final ConfigKey<Integer> PingInterval = new ConfigKey<Integer>(Integer.class, "ping.interval", "Advance", AgentManager.class, "60", "Interval to send application level pings to make sure the connection is still working", false, "Seconds");
+    protected final ConfigKey<Float> PingTimeout = new ConfigKey<Float>(Float.class, "ping.timeout", "Advance", AgentManager.class, "2.5", "Multiplier to ping.interval before announcing an agent has timed out", true, null);
+    protected final ConfigKey<Integer> Wait = new ConfigKey<Integer>(Integer.class, "wait", "Advance", AgentManager.class, "1800",
+            "Time in seconds to wait for control commands to return", true, "Seconds");
+    protected final ConfigKey<Integer> AlertWait = new ConfigKey<Integer>(Integer.class, "alert.wait", "Advance", AgentManager.class, "1800",
+            "Seconds to wait before alerting on a disconnected agent", true, "Seconds");
+    protected final ConfigKey<Integer> DirectAgentLoadSize = new ConfigKey<Integer>(Integer.class, "direct.agent.load.size", "Advance", AgentManager.class, "16",
+            "The number of direct agents to load each time", false, null);
+    protected final ConfigKey<Integer> DirectAgentPoolSize = new ConfigKey<Integer>(Integer.class, "direct.agent.pool.size", "Advance", AgentManager.class, "500",
+            "Default size for DirectAgentPool", false, null);
+
     @Override
     public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
 
@@ -191,51 +200,47 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         _port = NumbersUtil.parseInt(configs.get("port"), 8250);
         final int workers = NumbersUtil.parseInt(configs.get("workers"), 5);
 
-        String value = configs.get(Config.PingInterval.toString());
-        _pingInterval = NumbersUtil.parseInt(value, 60);
-
-        value = configs.get(Config.Wait.toString());
-        _wait = NumbersUtil.parseInt(value, 1800);
+        _pingInterval = _configDepot.get(PingInterval);
 
-        value = configs.get(Config.AlertWait.toString());
-        _alertWait = NumbersUtil.parseInt(value, 1800);
-
-        value = configs.get(Config.PingTimeout.toString());
-        final float multiplier = value != null ? Float.parseFloat(value) : 2.5f;
-        _pingTimeout = (long) (multiplier * _pingInterval);
+        _wait = _configDepot.get(Wait);
+        _alertWait = _configDepot.get(AlertWait);
+        _pingTimeout = _configDepot.get(PingTimeout);
 
         s_logger.info("Ping Timeout is " + _pingTimeout);
 
-        value = configs.get(Config.DirectAgentLoadSize.key());
-        int threads = NumbersUtil.parseInt(value, 16);
+        ConfigValue<Integer> threads = _configDepot.get(DirectAgentLoadSize);
 
         _nodeId = ManagementServerNode.getManagementServerId();
         s_logger.info("Configuring AgentManagerImpl. management server node id(msid): " + _nodeId);
 
-        long lastPing = (System.currentTimeMillis() >> 10) - _pingTimeout;
+        long lastPing = (System.currentTimeMillis() >> 10) - (long)(_pingTimeout.value() * _pingInterval.value());
         _hostDao.markHostsAsDisconnected(_nodeId, lastPing);
 
-        // _monitor = ComponentLocator.inject(AgentMonitor.class, _nodeId, _hostDao, _vmDao, _dcDao, _podDao, this, _alertMgr, _pingTimeout);
-        registerForHostEvents(_monitor, true, true, false);
+        registerForHostEvents(new BehindOnPingListener(), true, true, false);
 
-        _executor = new ThreadPoolExecutor(threads, threads, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("AgentTaskPool"));
+        _executor = new ThreadPoolExecutor(threads.value(), threads.value(), 60l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("AgentTaskPool"));
 
-        _connectExecutor = new ThreadPoolExecutor(100, 500, 60l, TimeUnit.SECONDS,
-                new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("AgentConnectTaskPool"));
+        _connectExecutor = new ThreadPoolExecutor(100, 500, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("AgentConnectTaskPool"));
         //allow core threads to time out even when there are no items in the queue
         _connectExecutor.allowCoreThreadTimeOut(true);
 
         _connection = new NioServer("AgentManager", _port, workers + 10, this);
         s_logger.info("Listening on " + _port + " with " + workers + " workers");
 
-        value = configs.get(Config.DirectAgentPoolSize.key());
-        int size = NumbersUtil.parseInt(value, 500);
-        _directAgentExecutor = new ScheduledThreadPoolExecutor(size, new NamedThreadFactory("DirectAgent"));
-        s_logger.debug("Created DirectAgentAttache pool with size: " + size);
+        
+        ConfigValue<Integer> size = _configDepot.get(DirectAgentPoolSize);
+        _directAgentExecutor = new ScheduledThreadPoolExecutor(size.value(), new NamedThreadFactory("DirectAgent"));
+        s_logger.debug("Created DirectAgentAttache pool with size: " + size.value());
+        
+        _monitorExecutor = new ScheduledThreadPoolExecutor(1, new NamedThreadFactory("AgentMonitor"));
 
         return true;
     }
 
+    protected long getTimeout() {
+        return (long)(_pingTimeout.value() * _pingInterval.value());
+    }
+
     @Override
     public Task create(Task.Type type, Link link, byte[] data) {
         return new AgentHandler(type, link, data);
@@ -354,7 +359,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     }
 
     protected int getPingInterval() {
-        return _pingInterval;
+        return _pingInterval.value();
     }
 
     @Override
@@ -389,7 +394,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         }
 
         if (timeout <= 0) {
-            timeout = _wait;
+            timeout = _wait.value();
         }
         assert noDbTxn() : "I know, I know.  Why are we so strict as to not allow txn across an agent call?  ...  Why are we so cruel ... Why are we such a dictator .... Too bad... Sorry...but NO AGENT COMMANDS WRAPPED WITHIN DB TRANSACTIONS!";
 
@@ -568,13 +573,13 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     @Override
     public boolean start() {
         startDirectlyConnectedHosts();
-        if (_monitor != null) {
-            _monitor.startMonitoring(_pingTimeout);
-        }
+
         if (_connection != null) {
             _connection.start();
         }
 
+        _monitorExecutor.scheduleWithFixedDelay(new MonitorTask(), _pingInterval.value(), _pingInterval.value(), TimeUnit.SECONDS);
+
         return true;
     }
 
@@ -712,9 +717,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
 
     @Override
     public boolean stop() {
-        if (_monitor != null) {
-            _monitor.signalStop();
-        }
+
         if (_connection != null) {
             _connection.stop();
         }
@@ -736,6 +739,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         }
 
         _connectExecutor.shutdownNow();
+        _monitorExecutor.shutdownNow();
         return true;
     }
 
@@ -824,7 +828,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
                 } else if (determinedState == Status.Disconnected) {
                     s_logger.warn("Agent is disconnected but the host is still up: " + host.getId() + "-" + host.getName());
                     if (currentStatus == Status.Disconnected) {
-                        if (((System.currentTimeMillis() >> 10) - host.getLastPinged()) > _alertWait) {
+                        if (((System.currentTimeMillis() >> 10) - host.getLastPinged()) > _alertWait.value()) {
                             s_logger.warn("Host " + host.getId() + " has been disconnected pass the time it should be disconnected.");
                             event = Status.Event.WaitedTooLong;
                         } else {
@@ -1404,7 +1408,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         attache = createAttacheForDirectConnect(host, resource);
         StartupAnswer[] answers = new StartupAnswer[cmds.length];
         for (int i = 0; i < answers.length; i++) {
-            answers[i] = new StartupAnswer(cmds[i], attache.getId(), _pingInterval);
+            answers[i] = new StartupAnswer(cmds[i], attache.getId(), _pingInterval.value());
         }
         attache.process(answers);
         attache = notifyMonitorsOfConnection(attache, cmds, forRebalance);
@@ -1434,4 +1438,143 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         return _directAgentExecutor;
     }
 
+    public Long getAgentPingTime(long agentId) {
+        return _pingMap.get(agentId);
+    }
+
+    public void pingBy(long agentId) {
+        _pingMap.put(agentId, InaccurateClock.getTimeInSeconds());
+    }
+
+    protected class MonitorTask implements Runnable {
+        @Override
+        public void run() {
+            s_logger.trace("Agent Monitor is started.");
+
+            try {
+                List<Long> behindAgents = findAgentsBehindOnPing();
+                for (Long agentId : behindAgents) {
+                    SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
+                    sc.addAnd(sc.getEntity().getId(), Op.EQ, agentId);
+                    HostVO h = sc.find();
+                    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");
+                            disconnectWithoutInvestigation(agentId, Event.ShutdownRequested);
+                        } else {
+                            status_logger.debug("Ping timeout for host " + agentId + ", do invstigation");
+                            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());
+                    HostPodVO podVO = _podDao.findById(host.getPodId());
+                    String hostDesc = "name: " + host.getName() + " (id:" + hostId + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName();
+
+                    if (host.getType() != Host.Type.Storage) {
+//                        List<VMInstanceVO> vos = _vmDao.listByHostId(hostId);
+//                        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);
+//                        }
+                    }
+                }
+            } catch (Throwable th) {
+                s_logger.error("Caught the following exception: ", th);
+            }
+
+            s_logger.trace("Agent Monitor is leaving the building!");
+        }
+
+        protected List<Long> findAgentsBehindOnPing() {
+            List<Long> agentsBehind = new ArrayList<Long>();
+            long cutoffTime = InaccurateClock.getTimeInSeconds() - getTimeout();
+            for (Map.Entry<Long, Long> entry : _pingMap.entrySet()) {
+                if (entry.getValue() < cutoffTime) {
+                    agentsBehind.add(entry.getKey());
+                }
+            }
+
+            if (agentsBehind.size() > 0) {
+                s_logger.info("Found the following agents behind on ping: " + agentsBehind);
+            }
+
+            return agentsBehind;
+        }
+    }
+
+    protected class BehindOnPingListener implements Listener {
+        @Override
+        public boolean isRecurring() {
+            return true;
+        }
+
+        @Override
+        public boolean processAnswers(long agentId, long seq, Answer[] answers) {
+            return false;
+        }
+
+        @Override
+        public boolean processCommands(long agentId, long seq, Command[] commands) {
+            boolean processed = false;
+            for (Command cmd : commands) {
+                if (cmd instanceof PingCommand) {
+                    pingBy(agentId);
+                }
+            }
+            return processed;
+        }
+
+        @Override
+        public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) {
+            return null;
+        }
+
+        @Override
+        public void processConnect(Host host, StartupCommand cmd, boolean forRebalance) {
+            if (host.getType().equals(Host.Type.TrafficMonitor) ||
+                    host.getType().equals(Host.Type.SecondaryStorage)) {
+                return;
+            }
+
+            // NOTE: We don't use pingBy here because we're initiating.
+            _pingMap.put(host.getId(), InaccurateClock.getTimeInSeconds());
+        }
+
+        @Override
+        public boolean processDisconnect(long agentId, Status state) {
+            _pingMap.remove(agentId);
+            return true;
+        }
+
+        @Override
+        public boolean processTimeout(long agentId, long seq) {
+            return true;
+        }
+
+        @Override
+        public int getTimeout() {
+            return -1;
+        }
+
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d4b22d6/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
deleted file mode 100755
index be85031..0000000
--- a/server/src/com/cloud/agent/manager/AgentMonitor.java
+++ /dev/null
@@ -1,284 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.manager;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.inject.Inject;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.agent.api.AgentControlAnswer;
-import com.cloud.agent.api.AgentControlCommand;
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.PingCommand;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.alert.AlertManager;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.HostPodVO;
-import com.cloud.dc.dao.ClusterDao;
-import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.dc.dao.HostPodDao;
-import com.cloud.host.Host;
-import com.cloud.host.HostVO;
-import com.cloud.host.Status;
-import com.cloud.host.Status.Event;
-import com.cloud.host.dao.HostDao;
-import com.cloud.resource.ResourceManager;
-import com.cloud.resource.ResourceState;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteriaService;
-import com.cloud.utils.time.InaccurateClock;
-import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.dao.VMInstanceDao;
-
-@Component
-public class AgentMonitor extends Thread implements AgentMonitorService {
-    private static Logger s_logger = Logger.getLogger(AgentMonitor.class);
-    private static Logger status_Logger = Logger.getLogger(Status.class);
-    private long _pingTimeout = 120; // Default set to 120 seconds
-    @Inject private HostDao _hostDao;
-    private boolean _stop;
-    @Inject
-    private AgentManagerImpl _agentMgr;
-    @Inject private VMInstanceDao _vmDao;
-    @Inject private final DataCenterDao _dcDao = null;
-    @Inject private final HostPodDao _podDao = null;
-    @Inject private AlertManager _alertMgr;
-    private long _msId;
-    @Inject ClusterDao _clusterDao;
-    @Inject ResourceManager _resourceMgr;
-        
-    // private ConnectionConcierge _concierge;
-    private final Map<Long, Long> _pingMap;
-
-    public AgentMonitor() {
-        _pingMap = new ConcurrentHashMap<Long, Long>(10007);
-    }
-    
-    /**
-     * 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.
-     */
-    @Override
-    public Boolean isAgentBehindOnPing(long agentId) {
-        Long pingTime = _pingMap.get(agentId);
-        if (pingTime == null) {
-            return null;
-        }
-        return pingTime < (InaccurateClock.getTimeInSeconds() - _pingTimeout);
-    }
-
-    @Override
-    public Long getAgentPingTime(long agentId) {
-        return _pingMap.get(agentId);
-    }
-
-    @Override
-    public void pingBy(long agentId) {
-        _pingMap.put(agentId, InaccurateClock.getTimeInSeconds());
-    }
-
-    // TODO : use host machine time is not safe in clustering environment
-    @Override
-    public void run() {
-        s_logger.info("Agent Monitor is started.");
-
-        while (!_stop) {
-            try {
-                // check every 60 seconds
-                Thread.sleep(60 * 1000);
-            } catch (InterruptedException e) {
-                s_logger.info("Who woke me from my slumber?");
-            }
-
-            try {
-                List<Long> behindAgents = findAgentsBehindOnPing();
-                for (Long agentId : behindAgents) {
-                	SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
-                	sc.addAnd(sc.getEntity().getId(), Op.EQ, agentId);
-                	HostVO h = sc.find();
-                    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());
-                    HostPodVO podVO = _podDao.findById(host.getPodId());
-                    String hostDesc = "name: " + host.getName() + " (id:" + hostId + "), availability zone: " + dcVO.getName() + ", pod: " + podVO.getName();
-
-                    if (host.getType() != Host.Type.Storage) {
-                        List<VMInstanceVO> vos = _vmDao.listByHostId(hostId);
-                        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);
-                        }
-                    }
-                }
-            } catch (Throwable th) {
-                s_logger.error("Caught the following exception: ", th);
-            }
-        }
-
-        s_logger.info("Agent Monitor is leaving the building!");
-    }
-
-    @Override
-    public void signalStop() {
-        _stop = true;
-        interrupt();
-    }
-
-    @Override
-    public boolean isRecurring() {
-        return true;
-    }
-
-    @Override
-    public boolean processAnswers(long agentId, long seq, Answer[] answers) {
-        return false;
-    }
-
-    @Override @DB
-    public boolean processCommands(long agentId, long seq, Command[] commands) {
-        boolean processed = false;
-        for (Command cmd : commands) {
-            if (cmd instanceof PingCommand) {
-                pingBy(agentId);
-            }
-        }
-        return processed;
-    }
-
-    protected List<Long> findAgentsBehindOnPing() {
-        List<Long> agentsBehind = new ArrayList<Long>();
-        long cutoffTime = InaccurateClock.getTimeInSeconds() - _pingTimeout;
-        for (Map.Entry<Long, Long> entry : _pingMap.entrySet()) {
-            if (entry.getValue() < cutoffTime) {
-                agentsBehind.add(entry.getKey());
-            }
-        }
-
-        if (agentsBehind.size() > 0) {
-            s_logger.info("Found the following agents behind on ping: " + agentsBehind);
-        }
-
-        return agentsBehind;
-    }
-
-    /**
-     * @deprecated We're using the in-memory
-     */
-    @Deprecated
-    protected List<HostVO> findHostsBehindOnPing() {
-        long time = (System.currentTimeMillis() >> 10) - _pingTimeout;
-        List<HostVO> hosts = _hostDao.findLostHosts(time);
-        if (s_logger.isInfoEnabled()) {
-            s_logger.info("Found " + hosts.size() + " hosts behind on ping. pingTimeout : " + _pingTimeout +
-                    ", mark time : " + time);
-        }
-
-        for (HostVO host : hosts) {
-            if (host.getType().equals(Host.Type.ExternalFirewall) ||
-                    host.getType().equals(Host.Type.ExternalLoadBalancer) ||
-                    host.getType().equals(Host.Type.TrafficMonitor) ||
-                    host.getType().equals(Host.Type.SecondaryStorage)) {
-                continue;
-            }
-
-            if (host.getManagementServerId() == null || host.getManagementServerId() == _msId) {
-                if (s_logger.isInfoEnabled()) {
-                    s_logger.info("Asking agent mgr to investgate why host " + host.getId() +
-                            " is behind on ping. last ping time: " + host.getLastPinged());
-                }
-                _agentMgr.disconnectWithInvestigation(host.getId(), Event.PingTimeout);
-            }
-        }
-
-        return hosts;
-    }
-
-    @Override
-    public AgentControlAnswer processControlCommand(long agentId, AgentControlCommand cmd) {
-        return null;
-    }
-
-    @Override
-    public void processConnect(Host host, StartupCommand cmd, boolean forRebalance) {
-        if (host.getType().equals(Host.Type.TrafficMonitor) ||
-                host.getType().equals(Host.Type.SecondaryStorage)) {
-            return;
-        }
-
-        // NOTE: We don't use pingBy here because we're initiating.
-        _pingMap.put(host.getId(), InaccurateClock.getTimeInSeconds());
-    }
-
-    @Override
-    public boolean processDisconnect(long agentId, Status state) {
-        _pingMap.remove(agentId);
-        return true;
-    }
-
-    @Override
-    public boolean processTimeout(long agentId, long seq) {
-        return true;
-    }
-
-    @Override
-    public int getTimeout() {
-        return -1;
-    }
-
-    @Override
-    public void startMonitoring(long pingTimeout) {
-        _pingTimeout = pingTimeout;
-    	start();
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d4b22d6/server/src/com/cloud/agent/manager/AgentMonitorService.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentMonitorService.java b/server/src/com/cloud/agent/manager/AgentMonitorService.java
index 5759e5f..4dd2c1e 100644
--- a/server/src/com/cloud/agent/manager/AgentMonitorService.java
+++ b/server/src/com/cloud/agent/manager/AgentMonitorService.java
@@ -20,9 +20,7 @@ import com.cloud.agent.Listener;
 
 public interface AgentMonitorService extends Listener {
 
-	public Boolean isAgentBehindOnPing(long agentId);
     public Long getAgentPingTime(long agentId);
     public void pingBy(long agentId);
     public void signalStop();
-    public void startMonitoring(long pingTimeout);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d4b22d6/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index a9a6b4a..91b0343 100755
--- a/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -208,7 +208,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
         }
 
         // for agents that are self-managed, threshold to be considered as disconnected after pingtimeout
-        long cutSeconds = (System.currentTimeMillis() >> 10) - (_pingTimeout);
+        long cutSeconds = (System.currentTimeMillis() >> 10) - getTimeout();
         List<HostVO> hosts = _hostDao.findAndUpdateDirectAgentToLoad(cutSeconds, _loadSize.value().longValue(), _nodeId);
         List<HostVO> appliances = _hostDao.findAndUpdateApplianceToLoad(cutSeconds, _nodeId);
         hosts.addAll(appliances);
@@ -720,7 +720,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
     public void onManagementNodeLeft(List<ManagementServerHostVO> nodeList, long selfNodeId) {
         for (ManagementServerHostVO vo : nodeList) {
             s_logger.info("Marking hosts as disconnected on Management server" + vo.getMsid());
-            long lastPing = (System.currentTimeMillis() >> 10) - _pingTimeout;
+            long lastPing = (System.currentTimeMillis() >> 10) - getTimeout();
             _hostDao.markHostsAsDisconnected(vo.getMsid(), lastPing);
             s_logger.info("Deleting entries from op_host_transfer table for Management server " + vo.getMsid());
             cleanupTransferMap(vo.getMsid());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1d4b22d6/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index ff484be..1107cf1 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -165,10 +165,6 @@ public enum Config {
 	IntegrationAPIPort("Advanced", ManagementServer.class, Integer.class, "integration.api.port", null, "Defaul API port", null),
 	InvestigateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "investigate.retry.interval", "60", "Time (in seconds) between VM pings when agent is disconnected", null),
 	MigrateRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "migrate.retry.interval", "120", "Time (in seconds) between migration retries", null),
-	PingInterval("Advanced", AgentManager.class, Integer.class, "ping.interval", "60", "Ping interval in seconds", null),
-	PingTimeout("Advanced", AgentManager.class, Float.class, "ping.timeout", "2.5", "Multiplier to ping.interval before announcing an agent has timed out", null),
-	ClusterDeltaSyncInterval("Advanced", AgentManager.class, Integer.class, "sync.interval", "60", "Cluster Delta sync interval in seconds", null),
-	Port("Advanced", AgentManager.class, Integer.class, "port", "8250", "Port to listen on for agent connection.", null),
 	RouterCpuMHz("Advanced", NetworkManager.class, Integer.class, "router.cpu.mhz", String.valueOf(VpcVirtualNetworkApplianceManager.DEFAULT_ROUTER_CPU_MHZ), "Default CPU speed (MHz) for router VM.", null),
 	RestartRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "restart.retry.interval", "600", "Time (in seconds) between retries to restart a vm", null),
 	RouterStatsInterval("Advanced", NetworkManager.class, Integer.class, "router.stats.interval", "300", "Interval (in seconds) to report router statistics.", null),


[2/4] git commit: updated refs/heads/master to 486e0d0

Posted by ah...@apache.org.
Separate agentmanager from server code.  Moved out ssvm.  Remove methods that shouldn't be used


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

Branch: refs/heads/master
Commit: 46e644e134f474c5eaa65df18c5bb1eee0ad37a5
Parents: f0f5522
Author: Alex Huang <al...@citrix.com>
Authored: Mon Jul 29 11:43:53 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Jul 29 19:13:31 2013 -0700

----------------------------------------------------------------------
 .../test/DirectAgentManagerSimpleImpl.java      |  24 +--
 server/src/com/cloud/agent/AgentManager.java    |  10 +-
 .../com/cloud/agent/manager/AgentAttache.java   |   8 +-
 .../cloud/agent/manager/AgentManagerImpl.java   |  33 +---
 .../com/cloud/agent/manager/AgentMonitor.java   |  19 +-
 .../agent/manager/ConnectedAgentAttache.java    |   8 +-
 .../cloud/agent/manager/DirectAgentAttache.java |   5 -
 .../com/cloud/agent/manager/DummyAttache.java   |   8 -
 .../com/cloud/resource/ResourceManagerImpl.java |  12 +-
 .../com/cloud/agent/MockAgentManagerImpl.java   | 189 -------------------
 10 files changed, 23 insertions(+), 293 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
index ac50e9b..a88d208 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java
@@ -58,7 +58,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 
 public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentManager {
     private static final Logger logger = Logger.getLogger(DirectAgentManagerSimpleImpl.class);
-    private Map<Long, ServerResource> hostResourcesMap = new HashMap<Long, ServerResource>();
+    private final Map<Long, ServerResource> hostResourcesMap = new HashMap<Long, ServerResource>();
     @Inject
     HostDao hostDao;
     @Inject
@@ -223,12 +223,6 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa
     }
 
     @Override
-    public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
     public Answer sendTo(Long dcId, HypervisorType type, Command cmd) {
         // TODO Auto-generated method stub
         return null;
@@ -254,12 +248,6 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa
     }
 
     @Override
-    public AgentAttache findAttache(long hostId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
     public void disconnectWithoutInvestigation(long hostId, Event event) {
         // TODO Auto-generated method stub
 
@@ -284,15 +272,9 @@ public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentMa
     }
 
     @Override
-    public Answer sendToSSVM(Long dcId, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public void disconnectWithInvestigation(long hostId, Event event) {
+    public boolean isAgentAttached(long hostId) {
         // TODO Auto-generated method stub
-
+        return false;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/src/com/cloud/agent/AgentManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/AgentManager.java b/server/src/com/cloud/agent/AgentManager.java
index 02dd10d..de9be96 100755
--- a/server/src/com/cloud/agent/AgentManager.java
+++ b/server/src/com/cloud/agent/AgentManager.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.agent;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.StartupCommand;
@@ -28,7 +26,6 @@ import com.cloud.exception.ConnectionException;
 import com.cloud.exception.OperationTimedoutException;
 import com.cloud.host.HostVO;
 import com.cloud.host.Status;
-import com.cloud.host.Status.Event;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.resource.ServerResource;
 import com.cloud.utils.component.Manager;
@@ -133,8 +130,6 @@ public interface AgentManager extends Manager {
      */
     void unregisterForHostEvents(int id);
 
-    public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException;
-
     Answer sendTo(Long dcId, HypervisorType type, Command cmd);
 
 
@@ -145,7 +140,7 @@ public interface AgentManager extends Manager {
 
     public boolean agentStatusTransitTo(HostVO host, Status.Event e, long msId);
 
-    public AgentAttache findAttache(long hostId);
+    boolean isAgentAttached(long hostId);
 
     void disconnectWithoutInvestigation(long hostId, Status.Event event);
 
@@ -154,7 +149,4 @@ public interface AgentManager extends Manager {
     public void pullAgentOutMaintenance(long hostId);
 
 	boolean reconnect(long hostId);
-    Answer sendToSSVM(Long dcId, final Command cmd);
-
-    void disconnectWithInvestigation(final long hostId, final Status.Event event);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/src/com/cloud/agent/manager/AgentAttache.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentAttache.java b/server/src/com/cloud/agent/manager/AgentAttache.java
index 1785bcf..67deba0 100755
--- a/server/src/com/cloud/agent/manager/AgentAttache.java
+++ b/server/src/com/cloud/agent/manager/AgentAttache.java
@@ -329,7 +329,7 @@ public abstract class AgentAttache {
     public boolean equals(Object obj) {
         try {
             AgentAttache that = (AgentAttache) obj;
-            return this._id == that._id;
+            return _id == that._id;
         } catch (ClassCastException e) {
             assert false : "Who's sending an " + obj.getClass().getSimpleName() + " to AgentAttache.equals()? ";
         return false;
@@ -486,12 +486,6 @@ public abstract class AgentAttache {
     public abstract void send(Request req) throws AgentUnavailableException;
 
     /**
-     * Update password.
-     * @param new/changed password.
-     */
-    public abstract void updatePassword(Command new_password);
-
-    /**
      * Process disconnect.
      * @param state state of the agent.
      */

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/src/com/cloud/agent/manager/AgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/AgentManagerImpl.java b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
index 46b8644..f49fca6 100755
--- a/server/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/server/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -123,8 +123,6 @@ import com.cloud.utils.nio.Task;
 import com.cloud.vm.VirtualMachineManager;
 import com.cloud.vm.dao.VMInstanceDao;
 
-import edu.emory.mathcs.backport.java.util.Collections;
-
 /**
  * Implementation of the Agent Manager. This class controls the connection to the agents.
  *
@@ -372,7 +370,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         }
     }
 
-    @Override
     public AgentAttache findAttache(long hostId) {
         AgentAttache attache = null;
         synchronized (_agents) {
@@ -381,29 +378,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         return attache;
     }
 
-
-
-    private void sendToSSVM(final long dcId, final Command cmd, final Listener listener) throws AgentUnavailableException {
-        List<HostVO> ssAHosts = _ssvmMgr.listUpAndConnectingSecondaryStorageVmHost(dcId);
-        if (ssAHosts == null || ssAHosts.isEmpty() ) {
-            throw new AgentUnavailableException("No ssvm host found", -1);
-        }
-        Collections.shuffle(ssAHosts);
-        HostVO ssAhost = ssAHosts.get(0);
-        send(ssAhost.getId(), new Commands(cmd), listener);
-    }
-
-    @Override
-    public Answer sendToSSVM(final Long dcId, final Command cmd) {
-        List<HostVO> ssAHosts = _ssvmMgr.listUpAndConnectingSecondaryStorageVmHost(dcId);
-        if (ssAHosts == null || ssAHosts.isEmpty() ) {
-            return new Answer(cmd, false, "can not find secondary storage VM agent for data center " + dcId);
-        }
-        Collections.shuffle(ssAHosts);
-        HostVO ssAhost = ssAHosts.get(0);
-        return easySend(ssAhost.getId(), cmd);
-    }
-
     @Override
     public Answer sendTo(Long dcId, HypervisorType type, Command cmd) {
         List<ClusterVO> clusters = _clusterDao.listByDcHyType(dcId, type.toString());
@@ -1044,7 +1018,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         return true;
     }
 
-    @Override
     public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
         if (event == Event.AgentDisconnected) {
             if (s_logger.isDebugEnabled()) {
@@ -1062,6 +1035,11 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         return false;
     }
 
+    @Override
+    public boolean isAgentAttached(long hostId) {
+        return findAttache(hostId) != null;
+    }
+
     protected AgentAttache createAttacheForConnect(HostVO host, Link link) throws ConnectionException {
         s_logger.debug("create ConnectedAgentAttache for " + host.getId());
         AgentAttache attache = new ConnectedAgentAttache(this, host.getId(), link, host.isInMaintenanceStates());
@@ -1462,7 +1440,6 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         }
     }
 
-    @Override
     public void disconnectWithInvestigation(final long hostId, final Status.Event event) {
         disconnectInternal(hostId, event, true);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/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 2c0266e..be85031 100755
--- a/server/src/com/cloud/agent/manager/AgentMonitor.java
+++ b/server/src/com/cloud/agent/manager/AgentMonitor.java
@@ -26,8 +26,6 @@ import javax.inject.Inject;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.Listener;
 import com.cloud.agent.api.AgentControlAnswer;
 import com.cloud.agent.api.AgentControlCommand;
 import com.cloud.agent.api.Answer;
@@ -35,7 +33,6 @@ import com.cloud.agent.api.Command;
 import com.cloud.agent.api.PingCommand;
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.alert.AlertManager;
-import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
 import com.cloud.dc.dao.ClusterDao;
@@ -48,10 +45,9 @@ import com.cloud.host.Status.Event;
 import com.cloud.host.dao.HostDao;
 import com.cloud.resource.ResourceManager;
 import com.cloud.resource.ResourceState;
-import com.cloud.utils.db.ConnectionConcierge;
 import com.cloud.utils.db.DB;
-import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteria.Op;
+import com.cloud.utils.db.SearchCriteria2;
 import com.cloud.utils.db.SearchCriteriaService;
 import com.cloud.utils.time.InaccurateClock;
 import com.cloud.vm.VMInstanceVO;
@@ -64,17 +60,18 @@ public class AgentMonitor extends Thread implements AgentMonitorService {
     private long _pingTimeout = 120; // Default set to 120 seconds
     @Inject private HostDao _hostDao;
     private boolean _stop;
-    @Inject private AgentManager _agentMgr;
+    @Inject
+    private AgentManagerImpl _agentMgr;
     @Inject private VMInstanceDao _vmDao;
-    @Inject private DataCenterDao _dcDao = null;
-    @Inject private HostPodDao _podDao = null;
+    @Inject private final DataCenterDao _dcDao = null;
+    @Inject private final HostPodDao _podDao = null;
     @Inject private AlertManager _alertMgr;
     private long _msId;
     @Inject ClusterDao _clusterDao;
     @Inject ResourceManager _resourceMgr;
         
     // private ConnectionConcierge _concierge;
-    private Map<Long, Long> _pingMap;
+    private final Map<Long, Long> _pingMap;
 
     public AgentMonitor() {
         _pingMap = new ConcurrentHashMap<Long, Long>(10007);
@@ -87,6 +84,7 @@ public class AgentMonitor extends Thread implements AgentMonitorService {
      *            agent or host id.
      * @return null if the agent is not kept here. true if behind; false if not.
      */
+    @Override
     public Boolean isAgentBehindOnPing(long agentId) {
         Long pingTime = _pingMap.get(agentId);
         if (pingTime == null) {
@@ -95,10 +93,12 @@ public class AgentMonitor extends Thread implements AgentMonitorService {
         return pingTime < (InaccurateClock.getTimeInSeconds() - _pingTimeout);
     }
 
+    @Override
     public Long getAgentPingTime(long agentId) {
         return _pingMap.get(agentId);
     }
 
+    @Override
     public void pingBy(long agentId) {
         _pingMap.put(agentId, InaccurateClock.getTimeInSeconds());
     }
@@ -168,6 +168,7 @@ public class AgentMonitor extends Thread implements AgentMonitorService {
         s_logger.info("Agent Monitor is leaving the building!");
     }
 
+    @Override
     public void signalStop() {
         _stop = true;
         interrupt();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/src/com/cloud/agent/manager/ConnectedAgentAttache.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/ConnectedAgentAttache.java b/server/src/com/cloud/agent/manager/ConnectedAgentAttache.java
index c98307b..e5d2867 100755
--- a/server/src/com/cloud/agent/manager/ConnectedAgentAttache.java
+++ b/server/src/com/cloud/agent/manager/ConnectedAgentAttache.java
@@ -20,8 +20,6 @@ import java.nio.channels.ClosedChannelException;
 
 import org.apache.log4j.Logger;
 
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.Command;
 import com.cloud.agent.transport.Request;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.host.Status;
@@ -72,7 +70,7 @@ public class ConnectedAgentAttache extends AgentAttache {
     public boolean equals(Object obj) {
         try {
             ConnectedAgentAttache that = (ConnectedAgentAttache) obj;
-            return super.equals(obj) && this._link == that._link && this._link != null;
+            return super.equals(obj) && _link == that._link && _link != null;
         } catch (ClassCastException e) {
             assert false : "Who's sending an " + obj.getClass().getSimpleName() + " to " + this.getClass().getSimpleName() + ".equals()? ";
         return false;
@@ -94,8 +92,4 @@ public class ConnectedAgentAttache extends AgentAttache {
         }
     }
 
-    @Override
-    public void updatePassword(Command newPassword) {
-        throw new IllegalStateException("Should not have come here ");
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/src/com/cloud/agent/manager/DirectAgentAttache.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/DirectAgentAttache.java b/server/src/com/cloud/agent/manager/DirectAgentAttache.java
index 9b7d69f..7a36998 100755
--- a/server/src/com/cloud/agent/manager/DirectAgentAttache.java
+++ b/server/src/com/cloud/agent/manager/DirectAgentAttache.java
@@ -212,9 +212,4 @@ public class DirectAgentAttache extends AgentAttache {
         }
     }
 
-
-    @Override
-    public void updatePassword(Command new_password) {
-        _resource.executeRequest(new_password);
-    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/src/com/cloud/agent/manager/DummyAttache.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/agent/manager/DummyAttache.java b/server/src/com/cloud/agent/manager/DummyAttache.java
index 14286d2..182c1b8 100755
--- a/server/src/com/cloud/agent/manager/DummyAttache.java
+++ b/server/src/com/cloud/agent/manager/DummyAttache.java
@@ -16,8 +16,6 @@
 // under the License.
 package com.cloud.agent.manager;
 
-import com.cloud.agent.AgentManager;
-import com.cloud.agent.api.Command;
 import com.cloud.agent.transport.Request;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.host.Status;
@@ -47,10 +45,4 @@ public class DummyAttache extends AgentAttache {
 
 	}
 
-
-    @Override
-    public void updatePassword(Command newPassword) {
-        throw new IllegalStateException("Should not have come here ");
-    }
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/src/com/cloud/resource/ResourceManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resource/ResourceManagerImpl.java b/server/src/com/cloud/resource/ResourceManagerImpl.java
index d0c5aa6..a177b32 100755
--- a/server/src/com/cloud/resource/ResourceManagerImpl.java
+++ b/server/src/com/cloud/resource/ResourceManagerImpl.java
@@ -819,13 +819,6 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         if (!isForced && host.getResourceState() != ResourceState.Maintenance) {
             throw new CloudRuntimeException("Host " + host.getUuid() + " cannot be deleted as it is not in maintenance mode. Either put the host into maintenance or perform a forced deletion.");
         }
-        /*
-         * TODO: check current agent status and updateAgentStatus to removed. If
-         * it was already removed, that means someone is deleting host
-         * concurrently, return. And consider the situation of CloudStack
-         * shutdown during delete. A global lock?
-         */
-        AgentAttache attache = _agentMgr.findAttache(hostId);
         // Get storage pool host mappings here because they can be removed as a
         // part of handleDisconnect later
         // TODO: find out the bad boy, what's a buggy logic!
@@ -2204,8 +2197,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
     }
 
     private boolean doUpdateHostPassword(long hostId) {
-        AgentAttache attache = _agentMgr.findAttache(hostId);
-        if (attache == null) {
+        if (_agentMgr.isAgentAttached(hostId)) {
             return false;
         }
 
@@ -2214,7 +2206,7 @@ public class ResourceManagerImpl extends ManagerBase implements ResourceManager,
         nv = _hostDetailsDao.findDetail(hostId, ApiConstants.PASSWORD);
         String password = nv.getValue();
         UpdateHostPasswordCommand cmd = new UpdateHostPasswordCommand(username, password);
-        attache.updatePassword(cmd);
+        _agentMgr.easySend(hostId, cmd);
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46e644e1/server/test/com/cloud/agent/MockAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/test/com/cloud/agent/MockAgentManagerImpl.java b/server/test/com/cloud/agent/MockAgentManagerImpl.java
deleted file mode 100755
index 01f4e9c..0000000
--- a/server/test/com/cloud/agent/MockAgentManagerImpl.java
+++ /dev/null
@@ -1,189 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent;
-
-import java.util.Map;
-
-import javax.ejb.Local;
-import javax.naming.ConfigurationException;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.springframework.stereotype.Component;
-
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.Command;
-import com.cloud.agent.api.StartupCommand;
-import com.cloud.agent.manager.AgentAttache;
-import com.cloud.agent.manager.Commands;
-import com.cloud.exception.AgentUnavailableException;
-import com.cloud.exception.ConnectionException;
-import com.cloud.exception.OperationTimedoutException;
-import com.cloud.host.HostVO;
-import com.cloud.host.Status.Event;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.resource.ServerResource;
-import com.cloud.utils.component.ManagerBase;
-
-@Component
-@Local(value = { AgentManager.class })
-public class MockAgentManagerImpl extends ManagerBase implements AgentManager {
-
-    @Override
-    public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        // TODO Auto-generated method stub
-        return true;
-    }
-
-    @Override
-    public boolean start() {
-        return true;
-    }
-
-    @Override
-    public boolean stop() {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public String getName() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer easySend(Long hostId, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer send(Long hostId, Command cmd) throws AgentUnavailableException, OperationTimedoutException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer[] send(Long hostId, Commands cmds) throws AgentUnavailableException, OperationTimedoutException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Answer[] send(Long hostId, Commands cmds, int timeout) throws AgentUnavailableException, OperationTimedoutException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public long send(Long hostId, Commands cmds, Listener listener) throws AgentUnavailableException {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public int registerForHostEvents(Listener listener, boolean connections, boolean commands, boolean priority) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public int registerForInitialConnects(StartupCommandProcessor creator, boolean priority) {
-        // TODO Auto-generated method stub
-        return 0;
-    }
-
-    @Override
-    public void unregisterForHostEvents(int id) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public boolean reconnect(long hostId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public Answer sendTo(Long dcId, HypervisorType type, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-
-    @Override
-    public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public boolean agentStatusTransitTo(HostVO host, Event e, long msId) {
-        // TODO Auto-generated method stub
-        return false;
-    }
-
-    @Override
-    public AgentAttache findAttache(long hostId) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public void pullAgentToMaintenance(long hostId) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void disconnectWithoutInvestigation(long hostId, Event event) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public void pullAgentOutMaintenance(long hostId) {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public Answer sendToSSVM(Long dcId, Command cmd) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-	@Override
-	public void disconnectWithInvestigation(long hostId, Event event) {
-		// TODO Auto-generated method stub
-
-	}
-
-}