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/09/07 00:39:04 UTC

[34/36] git commit: updated refs/heads/master to a05ec6d

Made changes to configuration.  Eliminated ConfigValue and only use ConfigKey


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

Branch: refs/heads/master
Commit: 8f556e6d88a9bc6eb9e3a83a3715fc1ef414cc0c
Parents: b8e79c3
Author: Alex Huang <al...@citrix.com>
Authored: Thu Sep 5 14:27:45 2013 -0700
Committer: Alex Huang <al...@citrix.com>
Committed: Fri Sep 6 15:40:38 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/agent/AgentManager.java       |   3 +
 .../cloud/agent/manager/AgentManagerImpl.java   |  51 +-
 .../manager/ClusteredAgentManagerImpl.java      |  31 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java |  49 +-
 .../orchestration/NetworkOrchestrator.java      |  20 +-
 .../orchestration/VolumeOrchestrator.java       |  15 +-
 .../cloud/vm/VirtualMachineManagerImplTest.java |  10 +-
 .../storage/test/EndpointSelectorTest.java      |  80 +--
 .../src/com/cloud/cluster/ClusterManager.java   |  10 +-
 .../com/cloud/cluster/ClusterManagerImpl.java   |  42 +-
 .../cloud/cluster/ClusterManagerMBeanImpl.java  |  68 +-
 .../cloud/cluster/ClusterServiceAdapter.java    |   6 +-
 .../cluster/ClusterServiceServletAdapter.java   | 146 ++--
 .../cluster/ClusterServiceServletImpl.java      |  84 ++-
 .../framework/config/ConfigDepot.java           |  14 +-
 .../cloudstack/framework/config/ConfigKey.java  |  63 ++
 .../framework/config/ConfigValue.java           | 100 ---
 .../framework/config/impl/ConfigDepotImpl.java  |  51 +-
 .../config/impl/ConfigDepotAdminTest.java       |   4 +-
 .../jobs/impl/AsyncJobManagerImpl.java          | 665 +++++++++----------
 .../guru/BigSwitchVnsGuestNetworkGuru.java      |   2 +-
 .../lb/InternalLoadBalancerVMManagerImpl.java   |  27 +-
 .../cloud/network/guru/OvsGuestNetworkGuru.java |   2 +-
 .../src/com/cloud/alert/AlertManagerImpl.java   |  18 +-
 .../com/cloud/capacity/CapacityManagerImpl.java |   7 +-
 .../configuration/ConfigurationManagerImpl.java |  12 +-
 .../consoleproxy/ConsoleProxyManagerImpl.java   |   2 +-
 .../cloud/hypervisor/HypervisorGuruBase.java    |   8 +-
 .../com/cloud/network/IpAddressManagerImpl.java |   8 +-
 .../network/guru/ExternalGuestNetworkGuru.java  |   2 +-
 .../cloud/network/guru/GuestNetworkGuru.java    |   7 +-
 .../VirtualNetworkApplianceManagerImpl.java     |  34 +-
 .../com/cloud/network/vpc/VpcManagerImpl.java   |   9 +-
 .../network/vpn/RemoteAccessVpnManagerImpl.java |   9 +-
 .../com/cloud/resource/ResourceManagerImpl.java |  15 +-
 .../com/cloud/server/ManagementServerImpl.java  |   7 +-
 .../com/cloud/storage/StorageManagerImpl.java   |  17 +-
 .../secondary/SecondaryStorageManagerImpl.java  |   2 +-
 .../com/cloud/template/TemplateAdapterBase.java |   8 +-
 .../com/cloud/template/TemplateManagerImpl.java |   8 +-
 server/src/com/cloud/vm/UserVmManagerImpl.java  |   6 +-
 .../utils/component/ComponentLifecycleBase.java |  21 +-
 .../cloud/utils/component/ConfigInjector.java   |  27 -
 .../com/cloud/utils/component/InjectConfig.java |  29 -
 44 files changed, 721 insertions(+), 1078 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/engine/components-api/src/com/cloud/agent/AgentManager.java
----------------------------------------------------------------------
diff --git a/engine/components-api/src/com/cloud/agent/AgentManager.java b/engine/components-api/src/com/cloud/agent/AgentManager.java
index ec77032..f820227 100755
--- a/engine/components-api/src/com/cloud/agent/AgentManager.java
+++ b/engine/components-api/src/com/cloud/agent/AgentManager.java
@@ -16,6 +16,8 @@
 // under the License.
 package com.cloud.agent;
 
+import org.apache.cloudstack.framework.config.ConfigKey;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.manager.Commands;
@@ -30,6 +32,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
  */
 public interface AgentManager {
     final static String WaitCK = "wait";
+    static final ConfigKey<Integer> Wait = new ConfigKey<Integer>("Advanced", Integer.class, WaitCK, "1800", "Time in seconds to wait for control commands to return", true);
 
     public enum TapAgentsAction {
         Add, Del, Contains,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/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 d8d31cd..7bdc6ff 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/AgentManagerImpl.java
@@ -43,7 +43,6 @@ import org.apache.log4j.Logger;
 import org.apache.cloudstack.context.ServerContexts;
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
@@ -155,13 +154,8 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
 
     protected int _retry = 2;
 
-    protected ConfigValue<Integer> _wait;
-    protected ConfigValue<Integer> _alertWait;
     protected long _nodeId = -1;
 
-    protected ConfigValue<Integer> _pingInterval;
-    protected ConfigValue<Float> _pingTimeout;
-
     protected ExecutorService _executor;
     protected ThreadPoolExecutor _connectExecutor;
     protected ScheduledExecutorService _directAgentExecutor;
@@ -188,47 +182,34 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
             "The number of direct agents to load each time", false);
     protected final ConfigKey<Integer> DirectAgentPoolSize = new ConfigKey<Integer>(Integer.class, "direct.agent.pool.size", "Advance", "500",
             "Default size for DirectAgentPool", false);
-    static final ConfigKey<Integer> Wait = new ConfigKey<Integer>("Advanced", Integer.class, WaitCK, "1800", "Time in seconds to wait for control commands to return", true);
-
-    protected ConfigValue<Integer> _port;
 
     @Override
     public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
 
-        _port = _configDepot.get(Port);
-        ConfigValue<Integer> workers = _configDepot.get(Workers);
-
-        _pingInterval = _configDepot.get(PingInterval);
-
-        _wait = _configDepot.get(Wait);
-        _alertWait = _configDepot.get(AlertWait);
-        _pingTimeout = _configDepot.get(PingTimeout);
-
-        s_logger.info("Ping Timeout is " + _pingTimeout);
+        s_logger.info("Ping Timeout is " + PingTimeout.value());
 
-        ConfigValue<Integer> threads = _configDepot.get(DirectAgentLoadSize);
+        int threads = DirectAgentLoadSize.value();
 
         _nodeId = ManagementServerNode.getManagementServerId();
         s_logger.info("Configuring AgentManagerImpl. management server node id(msid): " + _nodeId);
 
-        long lastPing = (System.currentTimeMillis() >> 10) - (long)(_pingTimeout.value() * _pingInterval.value());
+        long lastPing = (System.currentTimeMillis() >> 10) - (long)(PingTimeout.value() * PingInterval.value());
         _hostDao.markHostsAsDisconnected(_nodeId, lastPing);
 
         registerForHostEvents(new BehindOnPingListener(), true, true, false);
 
-        _executor = new ThreadPoolExecutor(threads.value(), threads.value(), 60l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("AgentTaskPool"));
+        _executor = new ThreadPoolExecutor(threads, threads, 60l, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("AgentTaskPool"));
 
         _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.value(), workers.value() + 10, this);
-        s_logger.info("Listening on " + _port.value() + " with " + workers.value() + " workers");
+        _connection = new NioServer("AgentManager", Port.value(), Workers.value() + 10, this);
+        s_logger.info("Listening on " + Port.value() + " with " + Workers.value() + " workers");
 
         
-        ConfigValue<Integer> size = _configDepot.get(DirectAgentPoolSize);
-        _directAgentExecutor = new ScheduledThreadPoolExecutor(size.value(), new NamedThreadFactory("DirectAgent"));
-        s_logger.debug("Created DirectAgentAttache pool with size: " + size.value());
+        _directAgentExecutor = new ScheduledThreadPoolExecutor(DirectAgentPoolSize.value(), new NamedThreadFactory("DirectAgent"));
+        s_logger.debug("Created DirectAgentAttache pool with size: " + DirectAgentPoolSize.value());
         
         _monitorExecutor = new ScheduledThreadPoolExecutor(1, new NamedThreadFactory("AgentMonitor"));
 
@@ -236,7 +217,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     }
 
     protected long getTimeout() {
-        return (long)(_pingTimeout.value() * _pingInterval.value());
+        return (long)(PingTimeout.value() * PingInterval.value());
     }
 
     @Override
@@ -357,7 +338,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
     }
 
     protected int getPingInterval() {
-        return _pingInterval.value();
+        return PingInterval.value();
     }
 
     @Override
@@ -392,7 +373,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
         }
 
         if (timeout <= 0) {
-            timeout = _wait.value();
+            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!";
 
@@ -576,7 +557,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl
             _connection.start();
         }
 
-        _monitorExecutor.scheduleWithFixedDelay(new MonitorTask(), _pingInterval.value(), _pingInterval.value(), TimeUnit.SECONDS);
+        _monitorExecutor.scheduleWithFixedDelay(new MonitorTask(), PingInterval.value(), PingInterval.value(), TimeUnit.SECONDS);
 
         return true;
     }
@@ -828,7 +809,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.value()) {
+                        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 {
@@ -840,8 +821,8 @@ 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();
                         if ((host.getType() != Host.Type.SecondaryStorage) && (host.getType() != Host.Type.ConsoleProxy)) {
-                            _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host disconnected, " + hostDesc, "If the agent for host [" + hostDesc
-                                    + "] is not restarted within " + _alertWait + " seconds, HA will begin on the VMs");
+                            _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, host.getDataCenterId(), host.getPodId(), "Host disconnected, " + hostDesc,
+                                "If the agent for host [" + hostDesc + "] is not restarted within " + AlertWait + " seconds, HA will begin on the VMs");
                         }
                         event = Status.Event.AgentDisconnected;
                     }
@@ -1408,7 +1389,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.value());
+            answers[i] = new StartupAnswer(cmds[i], attache.getId(), PingInterval.value());
         }
         attache.process(answers);
         attache = notifyMonitorsOfConnection(attache, cmds, forRebalance);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
index d84505b..ca94fbc 100755
--- a/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/agent/manager/ClusteredAgentManagerImpl.java
@@ -50,7 +50,6 @@ import com.google.gson.Gson;
 
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
 
@@ -142,11 +141,6 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
         "Interval between scans to load agents", false, ConfigKey.Scope.Global, 1000);
     
 
-    protected ConfigValue<Boolean> _agentLBEnabled;
-    protected ConfigValue<Double> _connectedAgentsThreshold;
-    protected ConfigValue<Integer> _loadSize;
-    protected ConfigValue<Integer> _directAgentScanInterval;
-
     @Override
     public boolean configure(String name, Map<String, Object> xmlParams) throws ConfigurationException {
         _peers = new HashMap<String, SocketChannel>(7);
@@ -155,11 +149,6 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
 
         s_logger.info("Configuring ClusterAgentManagerImpl. management server node id(msid): " + _nodeId);
 
-        _loadSize = _configDepot.get(LoadSize);
-        _directAgentScanInterval = _configDepot.get(ScanInterval);
-        _agentLBEnabled = _configDepot.get(EnableLB);
-        _connectedAgentsThreshold = _configDepot.get(ConnectedAgentThreshold);
-
         ClusteredAgentAttache.initialize(this);
 
         _clusterMgr.registerListener(this);
@@ -175,9 +164,9 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
         if (!super.start()) {
             return false;
         }
-        _timer.schedule(new DirectAgentScanTimerTask(), STARTUP_DELAY, _directAgentScanInterval.value());
+        _timer.schedule(new DirectAgentScanTimerTask(), STARTUP_DELAY, ScanInterval.value());
         if (s_logger.isDebugEnabled()) {
-            s_logger.debug("Scheduled direct agent scan task to run at an interval of " + _directAgentScanInterval.value() + " seconds");
+            s_logger.debug("Scheduled direct agent scan task to run at an interval of " + ScanInterval.value() + " seconds");
         }
 
         // schedule transfer scan executor - if agent LB is enabled
@@ -207,7 +196,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) - getTimeout();
-        List<HostVO> hosts = _hostDao.findAndUpdateDirectAgentToLoad(cutSeconds, _loadSize.value().longValue(), _nodeId);
+        List<HostVO> hosts = _hostDao.findAndUpdateDirectAgentToLoad(cutSeconds, LoadSize.value().longValue(), _nodeId);
         List<HostVO> appliances = _hostDao.findAndUpdateApplianceToLoad(cutSeconds, _nodeId);
         hosts.addAll(appliances);
 
@@ -506,13 +495,13 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
                     throw new CloudRuntimeException("Unable to resolve " + ip);
                 }
                 try {
-                    ch = SocketChannel.open(new InetSocketAddress(addr, _port.value()));
+                    ch = SocketChannel.open(new InetSocketAddress(addr, Port.value()));
                     ch.configureBlocking(true); // make sure we are working at blocking mode
                     ch.socket().setKeepAlive(true);
                     ch.socket().setSoTimeout(60 * 1000);
                     try {
                         SSLContext sslContext = Link.initSSLContext(true);
-                        sslEngine = sslContext.createSSLEngine(ip, _port.value());
+                        sslEngine = sslContext.createSSLEngine(ip, Port.value());
                         sslEngine.setUseClientMode(true);
 
                         Link.doHandshake(ch, sslEngine, true);
@@ -1369,7 +1358,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
     }
 
     public boolean isAgentRebalanceEnabled() {
-        return _agentLBEnabled.value();
+        return EnableLB.value();
     }
 
     private ClusteredAgentRebalanceService _rebalanceService;
@@ -1379,7 +1368,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
         Profiler profilerAgentLB = new Profiler();
         profilerAgentLB.start();
         //initiate agent lb task will be scheduled and executed only once, and only when number of agents loaded exceeds _connectedAgentsThreshold
-        if (_agentLBEnabled.value() && !_agentLbHappened) {
+        if (EnableLB.value() && !_agentLbHappened) {
             SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
             sc.addAnd(sc.getEntity().getManagementServerId(), Op.NNULL);
             sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.Routing);
@@ -1392,12 +1381,12 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust
             double managedHostsCount = allManagedRoutingAgents.size();
             if (allHostsCount > 0.0) {
                 double load = managedHostsCount / allHostsCount;
-                if (load >= _connectedAgentsThreshold.value()) {
-                    s_logger.debug("Scheduling agent rebalancing task as the average agent load " + load + " is more than the threshold " + _connectedAgentsThreshold);
+                if (load >= ConnectedAgentThreshold.value()) {
+                    s_logger.debug("Scheduling agent rebalancing task as the average agent load " + load + " is more than the threshold " + ConnectedAgentThreshold.value());
                     _rebalanceService.scheduleRebalanceAgents();
                     _agentLbHappened = true;
                 } else {
-                    s_logger.trace("Not scheduling agent rebalancing task as the averages load " + load + " is less than the threshold " + _connectedAgentsThreshold);
+                    s_logger.trace("Not scheduling agent rebalancing task as the averages load " + load + " is less than the threshold " + ConnectedAgentThreshold.value());
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
index bd93212..24f0795 100755
--- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
+++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java
@@ -45,7 +45,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -159,7 +158,6 @@ import com.cloud.utils.Journal;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.Ternary;
-import com.cloud.utils.component.InjectConfig;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.concurrency.NamedThreadFactory;
 import com.cloud.utils.db.DB;
@@ -302,28 +300,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 
     ScheduledExecutorService _executor = null;
 
-    @InjectConfig(key = AgentManager.WaitCK)
-    protected ConfigValue<Integer> _operationTimeout;
-
-    @InjectConfig(key = "start.retry")
-    protected ConfigValue<Integer> _retry;
     protected long _nodeId;
 
-    @InjectConfig(key = "vm.op.cleanup.wait")
-    protected ConfigValue<Long> _cleanupWait;
-    @InjectConfig(key = "vm.op.cleanup.interval")
-    protected ConfigValue<Long> _cleanupInterval;
-    @InjectConfig(key = "vm.op.cancel.interval")
-    protected ConfigValue<Long> _cancelWait;
-    @InjectConfig(key = "vm.op.wait.interval")
-    protected ConfigValue<Integer> _opWaitInterval;
-    @InjectConfig(key = "vm.op.lock.state.retry")
-    protected ConfigValue<Integer> _lockStateRetry;
-    @InjectConfig(key = "vm.destroy.forcestop")
-    protected ConfigValue<Boolean> _forceStop;
-    @InjectConfig(key = "sync.interval")
-    protected ConfigValue<Integer> _syncInterval;
-
     @Override
     public void registerGuru(VirtualMachine.Type type, VirtualMachineGuru guru) {
         synchronized (_vmGurus) {
@@ -494,7 +472,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
 
     @Override
     public boolean start() {
-        _executor.scheduleAtFixedRate(new CleanupTask(), _cleanupInterval.value(), _cleanupInterval.value(), TimeUnit.SECONDS);
+        _executor.scheduleAtFixedRate(new CleanupTask(), VmOpCleanupInterval.value(), VmOpCleanupInterval.value(), TimeUnit.SECONDS);
         cancelWorkItems(_nodeId);
         return true;
     }
@@ -556,13 +534,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
                 return true;
             }
 
-            if (vo.getSecondsTaskIsInactive() > _cancelWait.value()) {
+            if (vo.getSecondsTaskIsInactive() > VmOpCancelInterval.value()) {
                 s_logger.warn("The task item for vm " + vm + " has been inactive for " + vo.getSecondsTaskIsInactive());
                 return false;
             }
 
             try {
-                Thread.sleep(_opWaitInterval.value());
+                Thread.sleep(VmOpWaitInterval.value());
             } catch (InterruptedException e) {
                 s_logger.info("Waiting for " + vm + " but is interrupted");
                 throw new ConcurrentOperationException("Waiting for " + vm + " but is interrupted");
@@ -578,7 +556,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         long vmId = vm.getId();
 
         ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Starting, vm.getType(), vm.getId());
-        int retry = _lockStateRetry.value();
+        int retry = VmOpLockStateRetry.value();
         while (retry-- != 0) {
             Transaction txn = Transaction.currentTxn();
             Ternary<VMInstanceVO, ReservationContext, ItWorkVO> result = null;
@@ -729,7 +707,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             boolean reuseVolume = true;
             DataCenterDeployment originalPlan = plan;
 
-            int retry = _retry.value();
+            int retry = StartRetry.value();
             while (retry-- != 0) { // It's != so that it can match -1.
 
                 if (reuseVolume) {
@@ -1329,7 +1307,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             s_logger.debug("Destroying vm " + vm);
         }
 
-        advanceStop(vm, _forceStop.value());
+        advanceStop(vm, VmDestroyForcestop.value());
 
         if (!_vmSnapshotMgr.deleteAllVMSnapshots(vm.getId(), null)) {
             s_logger.debug("Unable to delete all snapshots for " + vm);
@@ -1865,7 +1843,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         public void run() {
             s_logger.trace("VM Operation Thread Running");
             try {
-                _workDao.cleanup(_cleanupWait.value());
+                _workDao.cleanup(VmOpCleanupWait.value());
             } catch (Exception e) {
                 s_logger.error("VM Operations failed due to ", e);
             }
@@ -2575,7 +2553,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             }
 
             // initiate the cron job
-            ClusterSyncCommand syncCmd = new ClusterSyncCommand(_syncInterval.value(), clusterId);
+            ClusterSyncCommand syncCmd = new ClusterSyncCommand(ClusterDeltaSyncInterval.value(), clusterId);
             try {
                 long seq_no = _agentMgr.send(agentId, new Commands(syncCmd), this);
                 s_logger.debug("Cluster VM sync started with jobid " + seq_no);
@@ -2628,7 +2606,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
             }
             try {
                 lock.addRef();
-                List<VMInstanceVO> instances = _vmDao.findVMInTransition(new Date(new Date().getTime() - (_operationTimeout.value() * 1000)), State.Starting, State.Stopping);
+                List<VMInstanceVO> instances = _vmDao.findVMInTransition(new Date(new Date().getTime() - (AgentManager.Wait.value() * 1000)), State.Starting, State.Stopping);
                 for (VMInstanceVO instance : instances) {
                     State state = instance.getState();
                     if (state == State.Stopping) {
@@ -3229,11 +3207,6 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         return result;
     }
 
-    @InjectConfig(key = CapacityManager.CpuOverprovisioningFactorCK)
-    ConfigValue<Float> _cpuOverprovisioningFactor;
-    @InjectConfig(key = CapacityManager.MemOverprovisioningFactorCK)
-    ConfigValue<Float> _memOverprovisioningFactor;
-
     @Override
     public VMInstanceVO reConfigureVm(String vmUuid, ServiceOffering oldServiceOffering, boolean reconfiguringOnExistingHost) throws ResourceUnavailableException,
         ConcurrentOperationException {
@@ -3243,8 +3216,8 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
         ServiceOffering newServiceOffering = _entityMgr.findById(ServiceOffering.class, newServiceofferingId);
         HostVO hostVo = _hostDao.findById(vm.getHostId());
 
-        Float memoryOvercommitRatio = _memOverprovisioningFactor.valueIn(hostVo.getClusterId());
-        Float cpuOvercommitRatio = _cpuOverprovisioningFactor.valueIn(hostVo.getClusterId());
+        Float memoryOvercommitRatio = CapacityManager.MemOverprovisioningFactor.valueIn(hostVo.getClusterId());
+        Float cpuOvercommitRatio = CapacityManager.CpuOverprovisioningFactor.valueIn(hostVo.getClusterId());
         long minMemory = (long)(newServiceOffering.getRamSize() / memoryOvercommitRatio);
         ScaleVmCommand reconfigureCmd = new ScaleVmCommand(vm.getInstanceName(), newServiceOffering.getCpu(), (int)(newServiceOffering.getSpeed() / cpuOvercommitRatio),
             newServiceOffering.getSpeed(), minMemory * 1024L * 1024L, newServiceOffering.getRamSize() * 1024L * 1024L, newServiceOffering.getLimitCpuUse());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
index ab27ecb..cd32e8c 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java
@@ -44,7 +44,6 @@ import org.apache.cloudstack.context.ServerContexts;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.region.PortableIpDao;
@@ -342,20 +341,11 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
     SearchBuilder<IPAddressVO> AssignIpAddressSearch;
     SearchBuilder<IPAddressVO> AssignIpAddressFromPodVlanSearch;
 
-    ConfigValue<Integer> _networkGcWait;
-    ConfigValue<Integer> _networkGcInterval;
-    ConfigValue<Integer> _networkLockTimeout;
-    ConfigValue<String> _domainSuffix;
-
     HashMap<Long, Long> _lastNetworkIdsToFree = new HashMap<Long, Long>();
 
     @Override
     @DB
     public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
-        _networkGcWait = _configDepot.get(NetworkGcWait);
-        _networkGcInterval = _configDepot.get(NetworkGcInterval);
-        _networkLockTimeout = _configDepot.get(NetworkLockTimeout);
-
         // populate providers
         Map<Network.Service, Set<Network.Provider>> defaultSharedNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>();
         Set<Network.Provider> defaultProviders = new HashSet<Network.Provider>();
@@ -580,7 +570,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
     @Override
     public boolean start() {
-        _executor.scheduleWithFixedDelay(new NetworkGarbageCollector(), _networkGcInterval.value(), _networkGcInterval.value(), TimeUnit.SECONDS);
+        _executor.scheduleWithFixedDelay(new NetworkGarbageCollector(), NetworkGcInterval.value(), NetworkGcInterval.value(), TimeUnit.SECONDS);
         return true;
     }
 
@@ -920,7 +910,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
         }
 
         // Acquire lock only when network needs to be implemented
-        network = _networksDao.acquireInLockTable(networkId, _networkLockTimeout.value());
+        network = _networksDao.acquireInLockTable(networkId, NetworkLockTimeout.value());
         if (network == null) {
             // see NetworkVO.java
             ConcurrentOperationException ex = new ConcurrentOperationException("Unable to acquire network configuration");
@@ -1783,7 +1773,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
                     // 2) If null, generate networkDomain using domain suffix from the global config variables
                     if (networkDomain == null) {
-                        networkDomain = "cs" + Long.toHexString(owner.getId()) + _domainSuffix.valueIn(zoneId);
+                        networkDomain = "cs" + Long.toHexString(owner.getId()) + GuestDomainSuffix.valueIn(zoneId);
                     }
 
                 } else {
@@ -1908,7 +1898,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
 
         try {
             //do global lock for the network
-            network = _networksDao.acquireInLockTable(networkId, _networkLockTimeout.value());
+            network = _networksDao.acquireInLockTable(networkId, NetworkLockTimeout.value());
             if (network == null) {
                 s_logger.warn("Unable to acquire lock for the network " + network + " as a part of network shutdown");
                 return false;
@@ -2235,7 +2225,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
                             s_logger.debug("We found network " + networkId + " to be free for the first time.  Adding it to the list: " + currentTime);
                         }
                         stillFree.put(networkId, currentTime);
-                    } else if (time > (currentTime - _networkGcWait.value())) {
+                    } else if (time > (currentTime - NetworkGcWait.value())) {
                         if (s_logger.isDebugEnabled()) {
                             s_logger.debug("Network " + networkId + " is still free but it's not time to shutdown yet: " + time);
                         }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 5af1a7c..088c943 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -47,7 +47,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeAp
 import org.apache.cloudstack.framework.async.AsyncCallFuture;
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
@@ -140,8 +139,6 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
     ConfigDepot _configDepot;
 
     private final StateMachine2<Volume.State, Volume.Event, Volume> _volStateMachine;
-    private ConfigValue<Long> _maxVolumeSizeInGb;
-    private ConfigValue<Boolean> _recreateSystemVmEnabled;
     protected List<StoragePoolAllocator> _storagePoolAllocators;
 
     public List<StoragePoolAllocator> getStoragePoolAllocators() {
@@ -489,8 +486,8 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
     public boolean validateVolumeSizeRange(long size) {
         if (size < 0 || (size > 0 && size < (1024 * 1024 * 1024))) {
             throw new InvalidParameterValueException("Please specify a size of at least 1 Gb.");
-        } else if (size > (_maxVolumeSizeInGb.value() * 1024 * 1024 * 1024)) {
-            throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + _maxVolumeSizeInGb + " Gb.");
+        } else if (size > (MaxVolumeSize.value() * 1024 * 1024 * 1024)) {
+            throw new InvalidParameterValueException("volume size " + size + ", but the maximum size allowed is " + MaxVolumeSize + " Gb.");
         }
 
         return true;
@@ -909,7 +906,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
     }
 
     private List<VolumeTask> getTasks(List<VolumeVO> vols, Map<Volume, StoragePool> destVols) throws StorageUnavailableException {
-        boolean recreate = _recreateSystemVmEnabled.value();
+        boolean recreate = RecreatableSystemVmEnabled.value();
         List<VolumeTask> tasks = new ArrayList<VolumeTask>();
         for (VolumeVO vol : vols) {
             StoragePoolVO assignedPool = null;
@@ -981,7 +978,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
 
     private Pair<VolumeVO, DataStore> recreateVolume(VolumeVO vol, VirtualMachineProfile vm, DeployDestination dest) throws StorageUnavailableException {
         VolumeVO newVol;
-        boolean recreate = _recreateSystemVmEnabled.value();
+        boolean recreate = RecreatableSystemVmEnabled.value();
         DataStore destPool = null;
         if (recreate && (dest.getStorageForDisks() == null || dest.getStorageForDisks().get(vol) == null)) {
             destPool = dataStoreMgr.getDataStore(vol.getPoolId(), DataStoreRole.Primary);
@@ -1120,10 +1117,6 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-        _maxVolumeSizeInGb = _configDepot.get(MaxVolumeSize);
-
-        _recreateSystemVmEnabled = _configDepot.get(RecreatableSystemVmEnabled);
-
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
index 4e3b60b..7d55064 100644
--- a/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
+++ b/engine/orchestration/test/com/cloud/vm/VirtualMachineManagerImplTest.java
@@ -41,7 +41,6 @@ import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
 import org.apache.cloudstack.framework.config.ConfigDepot;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
@@ -268,14 +267,7 @@ public class VirtualMachineManagerImplTest {
         doReturn(hostVO).when(_hostDao).findById(1L);
         doReturn(1L).when(_vmInstance).getDataCenterId();
         doReturn(1L).when(hostVO).getClusterId();
-        @SuppressWarnings("unchecked")
-        ConfigValue<Float> memOverprovisioningFactor = mock(ConfigValue.class);
-        @SuppressWarnings("unchecked")
-        ConfigValue<Float> cpuOverprovisioningFactor = mock(ConfigValue.class);
-        when(_configDepot.get(CapacityManager.MemOverprovisioningFactor)).thenReturn(memOverprovisioningFactor);
-        when(memOverprovisioningFactor.valueIn(1L)).thenReturn(1.0f);
-        when(_configDepot.get(CapacityManager.CpuOverprovisioningFactor)).thenReturn(cpuOverprovisioningFactor);
-        when(cpuOverprovisioningFactor.valueIn(1L)).thenReturn(1.0f);
+        when(CapacityManager.CpuOverprovisioningFactor.valueIn(1L)).thenReturn(1.0f);
         ScaleVmCommand reconfigureCmd = new ScaleVmCommand("myVmName", newServiceOffering.getCpu(),
                 newServiceOffering.getSpeed(), newServiceOffering.getSpeed(), newServiceOffering.getRamSize(), newServiceOffering.getRamSize(),
                 newServiceOffering.getLimitCpuUse());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
index e319142..b7a9fbd 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
@@ -18,8 +18,50 @@
  */
 package org.apache.cloudstack.storage.test;
 
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreProvider;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
+import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
+import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
+import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+
 import com.cloud.agent.AgentManager;
+<<<<<<< HEAD
 import com.cloud.server.LockMasterListener;
+=======
+>>>>>>> Made changes to configuration.  Eliminated ConfigValue and only use ConfigKey
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.DataCenterVO;
@@ -49,43 +91,6 @@ import com.cloud.user.AccountManager;
 import com.cloud.user.User;
 import com.cloud.utils.component.ComponentContext;
 import com.cloud.utils.db.Merovingian2;
-import junit.framework.Assert;
-import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
-import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
-import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreProvider;
-import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
-import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
-import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
-import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-import javax.inject.Inject;
-import java.net.URI;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations = { "classpath:/fakeDriverTestContext.xml" })
@@ -120,7 +125,6 @@ public class EndpointSelectorTest {
     ImageStoreVO imageStore;
     @Inject
     AccountManager accountManager;
-    LockMasterListener lockMasterListener;
     VolumeInfo vol = null;
     FakePrimaryDataStoreDriver driver = new FakePrimaryDataStoreDriver();
     @Inject

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/cluster/src/com/cloud/cluster/ClusterManager.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManager.java b/framework/cluster/src/com/cloud/cluster/ClusterManager.java
index 51d993e..90846a4 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManager.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManager.java
@@ -16,11 +16,17 @@
 // under the License.
 package com.cloud.cluster;
 
+import org.apache.cloudstack.framework.config.ConfigKey;
+
 import com.cloud.utils.component.Manager;
 
 public interface ClusterManager extends Manager {
     static final String ALERT_SUBJECT = "cluster-alert";
-	
+    final ConfigKey<Integer> HeartbeatInterval = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.interval", "management-server", "1500",
+        "Interval to check for the heart beat between management server nodes", false);
+    final ConfigKey<Integer> HeartbeatThreshold = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.threshold", "management-server", "150000",
+        "Threshold before self-fence the management server", true);
+
     void OnReceiveClusterServicePdu(ClusterServicePdu pdu);
 
     /**
@@ -40,8 +46,6 @@ public interface ClusterManager extends Manager {
      */
     void broadcast(long agentId, String cmds);
 
-    int getHeartbeatThreshold();
-	
     void registerListener(ClusterManagerListener listener);
     void unregisterListener(ClusterManagerListener listener);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
index 24e30a2..ec74489 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerImpl.java
@@ -47,7 +47,6 @@ import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.utils.identity.ManagementServerNode;
 
@@ -77,8 +76,6 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
     private final List<ClusterManagerListener> _listeners = new ArrayList<ClusterManagerListener>();
     private final Map<Long, ManagementServerHostVO> _activePeers = new HashMap<Long, ManagementServerHostVO>();
-    private ConfigValue<Integer> _heartbeatInterval;
-    private ConfigValue<Integer> _heartbeatThreshold;
 
     private final Map<String, ClusterService> _clusterPeers;
 
@@ -354,7 +351,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     public void broadcast(long agentId, String cmds) {
         Date cutTime = DateUtil.currentGMTTime();
 
-        List<ManagementServerHostVO> peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - _heartbeatThreshold.value()));
+        List<ManagementServerHostVO> peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value()));
         for (ManagementServerHostVO peer : peers) {
             String peerName = Long.toString(peer.getMsid());
             if (getSelfPeerName().equals(peerName)) {
@@ -534,7 +531,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         return new Runnable() {
             @Override
             public void run() {
-                Transaction txn = Transaction.open("ClusterHeartBeat");
+                Transaction txn = Transaction.open("ClusterHeartbeat");
                 try {
                     Profiler profiler = new Profiler();
                     Profiler profilerHeartbeatUpdate = new Profiler();
@@ -568,7 +565,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     } finally {
                         profiler.stop();
                         
-                        if (profiler.getDuration() >= _heartbeatInterval.value()) {
+                        if (profiler.getDuration() >= HeartbeatInterval.value()) {
                             if(s_logger.isDebugEnabled())
                                 s_logger.debug("Management server heartbeat takes too long to finish. profiler: " + profiler.toString() +
                                     ", profilerHeartbeatUpdate: " + profilerHeartbeatUpdate.toString() +
@@ -602,7 +599,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
                     invalidHeartbeatConnection();
                 } finally {
                     txn.transitToAutoManagedConnection(Transaction.CLOUD_DB);
-                    txn.close("ClusterHeartBeat");
+                    txn.close("ClusterHeartbeat");
                 }
             }
         };
@@ -623,7 +620,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     private Connection getHeartbeatConnection() throws SQLException {
         if(_heartbeatConnection == null) {
             Connection conn = Transaction.getStandaloneConnectionWithException();
-            _heartbeatConnection = new ConnectionConcierge("ClusterManagerHeartBeat", conn, false);
+            _heartbeatConnection = new ConnectionConcierge("ClusterManagerHeartbeat", conn, false);
         }
 
         return _heartbeatConnection.conn();
@@ -759,7 +756,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         // upon startup, for all inactive management server nodes that we see at startup time, we will send notification also to help upper layer perform
         // missed cleanup
         Date cutTime = DateUtil.currentGMTTime();
-        List<ManagementServerHostVO> inactiveList = _mshostDao.getInactiveList(new Date(cutTime.getTime() - _heartbeatThreshold.value()));
+        List<ManagementServerHostVO> inactiveList = _mshostDao.getInactiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value()));
        
         // We don't have foreign key constraints to enforce the mgmt_server_id integrity in host table, when user manually
         // remove records from mshost table, this will leave orphan mgmt_serve_id reference in host table.
@@ -804,7 +801,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         
         Profiler profilerQueryActiveList = new Profiler();
         profilerQueryActiveList.start();
-        List<ManagementServerHostVO> currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - _heartbeatThreshold.value()));
+        List<ManagementServerHostVO> currentList = _mshostDao.getActiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value()));
         profilerQueryActiveList.stop();
 
         Profiler profilerSyncClusterInfo = new Profiler();
@@ -919,7 +916,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         
         profiler.stop();
         
-        if (profiler.getDuration() >= _heartbeatInterval.value()) {
+        if (profiler.getDuration() >= HeartbeatInterval.value()) {
             if(s_logger.isDebugEnabled())
                 s_logger.debug("Peer scan takes too long to finish. profiler: " + profiler.toString()
                   + ", profilerQueryActiveList: " + profilerQueryActiveList.toString()
@@ -987,7 +984,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
             _mshostPeerDao.clearPeerInfo(_mshostId);
 
             // use seperate thread for heartbeat updates
-            _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(), _heartbeatInterval.value(), _heartbeatInterval.value(), TimeUnit.MILLISECONDS);
+            _heartbeatScheduler.scheduleAtFixedRate(getHeartbeatTask(), HeartbeatInterval.value(), HeartbeatInterval.value(), TimeUnit.MILLISECONDS);
             _notificationExecutor.submit(getNotificationTask());
 
         } catch (Throwable e) {
@@ -1028,20 +1025,12 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
         return true;
     }
 
-    protected final ConfigKey<Integer> HeartBeatInterval = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.interval", "management-server",
-            "1500", "Interval to check for the heart beat between management server nodes", false);
-    protected final ConfigKey<Integer> HeartBeatThreshold = new ConfigKey<Integer>(Integer.class, "cluster.heartbeat.threshold", "management-server",
-            "150000", "Threshold before self-fence the management server", true);
-    
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
         if(s_logger.isInfoEnabled()) {
             s_logger.info("Start configuring cluster manager : " + name);
         }
 
-        _heartbeatInterval = _configDepot.get(HeartBeatInterval);
-        _heartbeatThreshold = _configDepot.get(HeartBeatThreshold);
-
         File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
         Properties dbProps = new Properties();
         try {
@@ -1095,7 +1084,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     public boolean isManagementNodeAlive(long msid) {
         ManagementServerHostVO mshost = _mshostDao.findByMsid(msid);
         if(mshost != null) {
-            if (mshost.getLastUpdateTime().getTime() >= DateUtil.currentGMTTime().getTime() - _heartbeatThreshold.value()) {
+            if (mshost.getLastUpdateTime().getTime() >= DateUtil.currentGMTTime().getTime() - HeartbeatThreshold.value()) {
                 return true;
             }
         }
@@ -1119,7 +1108,7 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
 
     @Override
     public ConfigKey<?>[] getConfigKeys() {
-        return new ConfigKey<?>[] {HeartBeatInterval, HeartBeatThreshold};
+        return new ConfigKey<?>[] {HeartbeatInterval, HeartbeatThreshold};
     }
 
     private boolean pingManagementNode(ManagementServerHostVO mshost) {
@@ -1167,18 +1156,13 @@ public class ClusterManagerImpl extends ManagerBase implements ClusterManager, C
     }
 
 
-    @Override
-    public int getHeartbeatThreshold() {
-        return _heartbeatThreshold.value();
-    }
-
     public int getHeartbeatInterval() {
-        return _heartbeatInterval.value();
+        return HeartbeatInterval.value();
     }
 
     private void checkConflicts() throws ConfigurationException {
         Date cutTime = DateUtil.currentGMTTime();
-        List<ManagementServerHostVO> peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - _heartbeatThreshold.value()));
+        List<ManagementServerHostVO> peers = _mshostDao.getActiveList(new Date(cutTime.getTime() - HeartbeatThreshold.value()));
         for(ManagementServerHostVO peer : peers) {
             String peerIP = peer.getServiceIP().trim();
             if(_clusterNodeIP.equals(peerIP)) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/cluster/src/com/cloud/cluster/ClusterManagerMBeanImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterManagerMBeanImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterManagerMBeanImpl.java
index 7071832..80dcef4 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterManagerMBeanImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterManagerMBeanImpl.java
@@ -24,44 +24,44 @@ import javax.management.StandardMBean;
 import com.cloud.utils.DateUtil;
 
 public class ClusterManagerMBeanImpl extends StandardMBean implements ClusterManagerMBean {
-	private final ClusterManagerImpl _clusterMgr;
-	private final ManagementServerHostVO _mshostVo;
-	
-	public ClusterManagerMBeanImpl(ClusterManagerImpl clusterMgr, ManagementServerHostVO mshostVo) {
-		super(ClusterManagerMBean.class, false);
-		
-		_clusterMgr = clusterMgr;
-		_mshostVo = mshostVo;
-	}
-	
-	@Override
+    private final ClusterManagerImpl _clusterMgr;
+    private final ManagementServerHostVO _mshostVo;
+
+    public ClusterManagerMBeanImpl(ClusterManagerImpl clusterMgr, ManagementServerHostVO mshostVo) {
+        super(ClusterManagerMBean.class, false);
+
+        _clusterMgr = clusterMgr;
+        _mshostVo = mshostVo;
+    }
+
+    @Override
     public long getMsid() {
-		return _mshostVo.getMsid();
-	}
-	
-	@Override
+        return _mshostVo.getMsid();
+    }
+
+    @Override
     public String getLastUpdateTime() {
-		Date date = _mshostVo.getLastUpdateTime();
-		return DateUtil.getDateDisplayString(TimeZone.getDefault(), date);
-	}
-	
-	@Override
+        Date date = _mshostVo.getLastUpdateTime();
+        return DateUtil.getDateDisplayString(TimeZone.getDefault(), date);
+    }
+
+    @Override
     public String getClusterNodeIP() {
-		return _mshostVo.getServiceIP();
-	}
-	
-	@Override
+        return _mshostVo.getServiceIP();
+    }
+
+    @Override
     public String getVersion() {
-		return _mshostVo.getVersion();
-	}
-	
-	@Override
+        return _mshostVo.getVersion();
+    }
+
+    @Override
     public int getHeartbeatInterval() {
-		return _clusterMgr.getHeartbeatInterval();
-	}
-	
-	@Override
+        return _clusterMgr.getHeartbeatInterval();
+    }
+
+    @Override
     public int getHeartbeatThreshold() {
-		return _clusterMgr.getHeartbeatThreshold();
-	}
+        return ClusterManager.HeartbeatThreshold.value();
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/cluster/src/com/cloud/cluster/ClusterServiceAdapter.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterServiceAdapter.java b/framework/cluster/src/com/cloud/cluster/ClusterServiceAdapter.java
index 28e2cab..de55cbd 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterServiceAdapter.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterServiceAdapter.java
@@ -18,10 +18,14 @@ package com.cloud.cluster;
 
 import java.rmi.RemoteException;
 
-import com.cloud.cluster.ClusterService;
+import org.apache.cloudstack.framework.config.ConfigKey;
+
 import com.cloud.utils.component.Adapter;
 
 public interface ClusterServiceAdapter extends Adapter {
+    final ConfigKey<Integer> ClusterMessageTimeOut = new ConfigKey<Integer>(Integer.class, "cluster.message.timeout.seconds", "Advance", "300",
+        "Time (in seconds) to wait before a inter-management server message post times out.", true);
+
 	public ClusterService getPeerService(String strPeer) throws RemoteException;
 	public String getServiceEndpointName(String strPeer);
 	public int getServicePort();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
index 87e92f5..67df946 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletAdapter.java
@@ -24,129 +24,117 @@ import java.rmi.RemoteException;
 import java.util.Map;
 import java.util.Properties;
 
-import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 
 import org.apache.cloudstack.framework.config.ConfigDepot;
-import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigValue;
 
 import com.cloud.cluster.dao.ManagementServerHostDao;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.PropertiesUtil;
 import com.cloud.utils.component.AdapterBase;
 
-@Component
-@Local(value={ClusterServiceAdapter.class})
 public class ClusterServiceServletAdapter extends AdapterBase implements ClusterServiceAdapter {
 
     private static final Logger s_logger = Logger.getLogger(ClusterServiceServletAdapter.class);
     private static final int DEFAULT_SERVICE_PORT = 9090;
     private static final int DEFAULT_REQUEST_TIMEOUT = 300;			// 300 seconds
-    
-    @Inject private ClusterManager _manager;
-    
-    @Inject private ManagementServerHostDao _mshostDao;
+
+    @Inject
+    private ClusterManager _manager;
+
+    @Inject
+    private ManagementServerHostDao _mshostDao;
     @Inject
     protected ConfigDepot _configDepot;
-    
+
     private ClusterServiceServletContainer _servletContainer;
-    
+
     private int _clusterServicePort = DEFAULT_SERVICE_PORT;
-    
-    private ConfigValue<Integer> _clusterRequestTimeoutSeconds;
-    
+
     @Override
-	public ClusterService getPeerService(String strPeer) throws RemoteException {
-    	try {
-    		init();
-    	} catch (ConfigurationException e) {
-    		s_logger.error("Unable to init ClusterServiceServletAdapter");
-    		throw new RemoteException("Unable to init ClusterServiceServletAdapter");
-    	}
-    	
-    	String serviceUrl = getServiceEndpointName(strPeer);
-    	if(serviceUrl == null)
-    		return null;
-    	
-        return new ClusterServiceServletImpl(serviceUrl, _clusterRequestTimeoutSeconds);
-	}
-    
+    public ClusterService getPeerService(String strPeer) throws RemoteException {
+        try {
+            init();
+        } catch (ConfigurationException e) {
+            s_logger.error("Unable to init ClusterServiceServletAdapter");
+            throw new RemoteException("Unable to init ClusterServiceServletAdapter");
+        }
+
+        String serviceUrl = getServiceEndpointName(strPeer);
+        if (serviceUrl == null)
+            return null;
+
+        return new ClusterServiceServletImpl(serviceUrl);
+    }
+
     @Override
-	public String getServiceEndpointName(String strPeer) {
-    	try {
-    		init();
-    	} catch (ConfigurationException e) {
-    		s_logger.error("Unable to init ClusterServiceServletAdapter");
-    		return null;
-    	}
-    	
-    	long msid = Long.parseLong(strPeer);
-    	
-    	ManagementServerHostVO mshost = _mshostDao.findByMsid(msid);
-    	if(mshost == null)
-    		return null;
-    	
-    	return composeEndpointName(mshost.getServiceIP(), mshost.getServicePort());
+    public String getServiceEndpointName(String strPeer) {
+        try {
+            init();
+        } catch (ConfigurationException e) {
+            s_logger.error("Unable to init ClusterServiceServletAdapter");
+            return null;
+        }
+
+        long msid = Long.parseLong(strPeer);
+
+        ManagementServerHostVO mshost = _mshostDao.findByMsid(msid);
+        if (mshost == null)
+            return null;
+
+        return composeEndpointName(mshost.getServiceIP(), mshost.getServicePort());
     }
-    
+
     @Override
-	public int getServicePort() {
-    	return _clusterServicePort;
+    public int getServicePort() {
+        return _clusterServicePort;
     }
-    
+
     private String composeEndpointName(String nodeIP, int port) {
-    	StringBuffer sb = new StringBuffer();
-    	sb.append("http://").append(nodeIP).append(":").append(port).append("/clusterservice");
-    	return sb.toString();
+        StringBuffer sb = new StringBuffer();
+        sb.append("http://").append(nodeIP).append(":").append(port).append("/clusterservice");
+        return sb.toString();
     }
-	
+
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
-    	init();
-    	return true;
+        init();
+        return true;
     }
-    
+
     @Override
     public boolean start() {
-    	_servletContainer = new ClusterServiceServletContainer();
-    	_servletContainer.start(new ClusterServiceServletHttpHandler(_manager), _clusterServicePort);
-    	return true;
+        _servletContainer = new ClusterServiceServletContainer();
+        _servletContainer.start(new ClusterServiceServletHttpHandler(_manager), _clusterServicePort);
+        return true;
     }
-    
+
     @Override
     public boolean stop() {
-    	if(_servletContainer != null)
-    		_servletContainer.stop();
-    	return true;
+        if (_servletContainer != null)
+            _servletContainer.stop();
+        return true;
     }
-    
-    private final ConfigKey<Integer> ClusterMessageTimeOut = new ConfigKey<Integer>(Integer.class, "cluster.message.timeout.seconds", "Advance", "300",
-            "Time (in seconds) to wait before a inter-management server message post times out.", true);
 
     private void init() throws ConfigurationException {
-    	if(_mshostDao != null)
-    		return;
-    	
-        _clusterRequestTimeoutSeconds = _configDepot.get(ClusterMessageTimeOut);
-    	s_logger.info("Configure cluster request time out. timeout: " + _clusterRequestTimeoutSeconds + " seconds");
-        
+        if (_mshostDao != null)
+            return;
+
         File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
         Properties dbProps = new Properties();
         try {
-			dbProps.load(new FileInputStream(dbPropsFile));
-		} catch (FileNotFoundException e) {
+            dbProps.load(new FileInputStream(dbPropsFile));
+        } catch (FileNotFoundException e) {
             throw new ConfigurationException("Unable to find db.properties");
-		} catch (IOException e) {
+        } catch (IOException e) {
             throw new ConfigurationException("Unable to load db.properties content");
-		}
-		
+        }
+
         _clusterServicePort = NumbersUtil.parseInt(dbProps.getProperty("cluster.servlet.port"), DEFAULT_SERVICE_PORT);
-        if(s_logger.isInfoEnabled())
-        	s_logger.info("Cluster servlet port : " + _clusterServicePort);
+        if (s_logger.isInfoEnabled())
+            s_logger.info("Cluster servlet port : " + _clusterServicePort);
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/cluster/src/com/cloud/cluster/ClusterServiceServletImpl.java
----------------------------------------------------------------------
diff --git a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletImpl.java b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletImpl.java
index 2a1d16e..5a26ba4 100644
--- a/framework/cluster/src/com/cloud/cluster/ClusterServiceServletImpl.java
+++ b/framework/cluster/src/com/cloud/cluster/ClusterServiceServletImpl.java
@@ -27,27 +27,23 @@ import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.params.HttpClientParams;
 import org.apache.log4j.Logger;
 
-import org.apache.cloudstack.framework.config.ConfigValue;
-
 public class ClusterServiceServletImpl implements ClusterService {
     private static final long serialVersionUID = 4574025200012566153L;
     private static final Logger s_logger = Logger.getLogger(ClusterServiceServletImpl.class);
-    
+
     private String _serviceUrl;
 
-    private ConfigValue<Integer> _requestTimeoutSeconds;
     protected static HttpClient s_client = null;
-    
+
     public ClusterServiceServletImpl() {
     }
 
-    public ClusterServiceServletImpl(String serviceUrl, ConfigValue<Integer> requestTimeoutSeconds) {
-        s_logger.info("Setup cluster service servlet. service url: " + serviceUrl + ", request timeout: " + requestTimeoutSeconds.value() + " seconds");
-    	
+    public ClusterServiceServletImpl(String serviceUrl) {
+        s_logger.info("Setup cluster service servlet. service url: " + serviceUrl + ", request timeout: " + ClusterServiceAdapter.ClusterMessageTimeOut.value() + " seconds");
+
         _serviceUrl = serviceUrl;
-        _requestTimeoutSeconds = requestTimeoutSeconds;
     }
-    
+
     @Override
     public String execute(ClusterServicePdu pdu) throws RemoteException {
 
@@ -69,7 +65,7 @@ public class ClusterServiceServletImpl implements ClusterService {
 
     @Override
     public boolean ping(String callingPeer) throws RemoteException {
-        if(s_logger.isDebugEnabled()) {
+        if (s_logger.isDebugEnabled()) {
             s_logger.debug("Ping at " + _serviceUrl);
         }
 
@@ -78,9 +74,9 @@ public class ClusterServiceServletImpl implements ClusterService {
 
         method.addParameter("method", Integer.toString(RemoteMethodConstants.METHOD_PING));
         method.addParameter("callingPeer", callingPeer);
-        
-        String returnVal =  executePostMethod(client, method);
-        if("true".equalsIgnoreCase(returnVal)) {
+
+        String returnVal = executePostMethod(client, method);
+        if ("true".equalsIgnoreCase(returnVal)) {
             return true;
         }
         return false;
@@ -92,22 +88,20 @@ public class ClusterServiceServletImpl implements ClusterService {
         try {
             long startTick = System.currentTimeMillis();
             response = client.executeMethod(method);
-            if(response == HttpStatus.SC_OK) {
+            if (response == HttpStatus.SC_OK) {
                 result = method.getResponseBodyAsString();
-                if(s_logger.isDebugEnabled()) {
-                    s_logger.debug("POST " + _serviceUrl + " response :" + result + ", responding time: "
-                            + (System.currentTimeMillis() - startTick) + " ms");
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("POST " + _serviceUrl + " response :" + result + ", responding time: " + (System.currentTimeMillis() - startTick) + " ms");
                 }
             } else {
-                s_logger.error("Invalid response code : " + response + ", from : "
-                        + _serviceUrl + ", method : " + method.getParameter("method")
-                        + " responding time: " + (System.currentTimeMillis() - startTick));
+                s_logger.error("Invalid response code : " + response + ", from : " + _serviceUrl + ", method : " + method.getParameter("method") + " responding time: " +
+                               (System.currentTimeMillis() - startTick));
             }
         } catch (HttpException e) {
             s_logger.error("HttpException from : " + _serviceUrl + ", method : " + method.getParameter("method"));
         } catch (IOException e) {
             s_logger.error("IOException from : " + _serviceUrl + ", method : " + method.getParameter("method"));
-        } catch(Throwable e) {
+        } catch (Throwable e) {
             s_logger.error("Exception from : " + _serviceUrl + ", method : " + method.getParameter("method") + ", exception :", e);
         } finally {
             method.releaseConnection();
@@ -115,34 +109,34 @@ public class ClusterServiceServletImpl implements ClusterService {
 
         return result;
     }
-    
+
     private HttpClient getHttpClient() {
 
-    	if(s_client == null) {
-    		MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
-    		mgr.getParams().setDefaultMaxConnectionsPerHost(4);
-    		
-    		// TODO make it configurable
-    		mgr.getParams().setMaxTotalConnections(1000);
-    		
-	        s_client = new HttpClient(mgr);
-	        HttpClientParams clientParams = new HttpClientParams();
-            clientParams.setSoTimeout(_requestTimeoutSeconds.value() * 1000);
-	        
-	        s_client.setParams(clientParams);
-    	}
-    	return s_client;
+        if (s_client == null) {
+            MultiThreadedHttpConnectionManager mgr = new MultiThreadedHttpConnectionManager();
+            mgr.getParams().setDefaultMaxConnectionsPerHost(4);
+
+            // TODO make it configurable
+            mgr.getParams().setMaxTotalConnections(1000);
+
+            s_client = new HttpClient(mgr);
+            HttpClientParams clientParams = new HttpClientParams();
+            clientParams.setSoTimeout(ClusterServiceAdapter.ClusterMessageTimeOut.value() * 1000);
+
+            s_client.setParams(clientParams);
+        }
+        return s_client;
     }
 
     // for test purpose only
     public static void main(String[] args) {
-/*
-        ClusterServiceServletImpl service = new ClusterServiceServletImpl("http://localhost:9090/clusterservice", 300);
-        try {
-            String result = service.execute("test", 1, "{ p1:v1, p2:v2 }", true);
-            System.out.println(result);
-        } catch (RemoteException e) {
-        }
-*/
+        /*
+                ClusterServiceServletImpl service = new ClusterServiceServletImpl("http://localhost:9090/clusterservice", 300);
+                try {
+                    String result = service.execute("test", 1, "{ p1:v1, p2:v2 }", true);
+                    System.out.println(result);
+                } catch (RemoteException e) {
+                }
+        */
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
index 544f188..2fd6efb 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
@@ -21,18 +21,6 @@ package org.apache.cloudstack.framework.config;
  *
  */
 public interface ConfigDepot {
-    /**
-     * Retrieves the global configuration value for key.
-     * @param key name of the key to retrieve.
-     * @return global configuration value even if the key is scoped
-     */
-    <T> ConfigValue<T> get(ConfigKey<T> key);
-    
-    /**
-     * Retrieves a ConfigValue by its name
-     * @param name name of the config
-     * @return ConfigValue
-     */
-    ConfigValue<?> get(String name);
 
+    ConfigKey<?> get(String paramName);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java
index 3d0884f..0c36d20 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigKey.java
@@ -16,6 +16,11 @@
 // under the License.
 package org.apache.cloudstack.framework.config;
 
+import java.sql.Date;
+
+import org.apache.cloudstack.framework.config.impl.ConfigDepotImpl;
+import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
+
 import com.cloud.utils.exception.CloudRuntimeException;
 
 
@@ -72,6 +77,13 @@ public class ConfigKey<T> {
     private final Scope _scope; // Parameter can be at different levels (Zone/cluster/pool/account), by default every parameter is at global
     private final boolean _isDynamic;
     private final T _multiplier;
+    T _value = null;
+
+    static ConfigDepotImpl s_depot = null;
+
+    static void init(ConfigDepotImpl depot) {
+        s_depot = depot;
+    }
 
     public ConfigKey(String category, Class<T> type, String name, String defaultValue, String description, boolean isDynamic, Scope scope) {
         this(type, name, category, defaultValue, description, isDynamic, scope, null);
@@ -117,4 +129,55 @@ public class ConfigKey<T> {
 
         throw new CloudRuntimeException("Comparing ConfigKey to " + obj.toString());
     }
+
+    public T value() {
+        if (_value == null || isDynamic()) {
+            ConfigurationVO vo = s_depot != null ? s_depot.global().findById(key()) : null;
+            _value = valueOf(vo != null ? vo.getValue() : defaultValue());
+        }
+
+        return _value;
+    }
+
+    public T valueIn(long id) {
+        String value = s_depot != null ? s_depot.scoped(this).getConfigValue(id, this) : null;
+        if (value == null) {
+            return value();
+        } else {
+            return valueOf(value);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    protected T valueOf(String value) {
+        Number multiplier = 1;
+        if (multiplier() != null) {
+            multiplier = (Number)multiplier();
+        }
+        Class<T> type = type();
+        if (type.isAssignableFrom(Boolean.class)) {
+            return (T)Boolean.valueOf(value);
+        } else if (type.isAssignableFrom(Integer.class)) {
+            return (T)new Integer(Integer.parseInt(value) * multiplier.intValue());
+        } else if (type.isAssignableFrom(Long.class)) {
+            return (T)new Long(Long.parseLong(value) * multiplier.longValue());
+        } else if (type.isAssignableFrom(Short.class)) {
+            return (T)new Short(Short.parseShort(value));
+        } else if (type.isAssignableFrom(String.class)) {
+            return (T)value;
+        } else if (type.isAssignableFrom(Float.class)) {
+            return (T)new Float(Float.parseFloat(value) * multiplier.floatValue());
+        } else if (type.isAssignableFrom(Double.class)) {
+            return (T)new Double(Double.parseDouble(value) * multiplier.doubleValue());
+        } else if (type.isAssignableFrom(String.class)) {
+            return (T)value;
+        } else if (type.isAssignableFrom(Date.class)) {
+            return (T)Date.valueOf(value);
+        } else if (type.isAssignableFrom(Character.class)) {
+            return (T)new Character(value.charAt(0));
+        } else {
+            throw new CloudRuntimeException("Unsupported data type for config values: " + type);
+        }
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java b/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
deleted file mode 100644
index 9ba5f86..0000000
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigValue.java
+++ /dev/null
@@ -1,100 +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 org.apache.cloudstack.framework.config;
-
-import java.sql.Date;
-
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
-
-import com.cloud.utils.exception.CloudRuntimeException;
-
-/**
- *  This is a match set to ConfigKey.
- *
- */
-public class ConfigValue<T> {
-
-    ConfigKey<T> _config;
-    ConfigurationDao _dao;
-    T _value;
-    ScopedConfigStorage _storage;
-
-    public ConfigValue(ConfigurationDao entityMgr, ConfigKey<T> config) {
-        _dao = entityMgr;
-        _config = config;
-    }
-
-    public ConfigValue(ConfigurationDao entityMgr, ConfigKey<T> key, ScopedConfigStorage storage) {
-        this(entityMgr, key);
-        _storage = storage;
-    }
-
-    public ConfigKey<T> getConfigKey() {
-        return _config;
-    }
-
-    public T value() {
-        if (_value == null || _config.isDynamic()) {
-            ConfigurationVO vo = _dao.findById(_config.key());
-            _value = valueOf(vo != null ? vo.getValue() : _config.defaultValue());
-        }
-
-        return _value;
-    }
-
-    public T valueIn(long id) {
-        String value = _storage.getConfigValue(id, _config);
-        if (value == null) {
-            return value();
-        } else {
-            return valueOf(value);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    protected T valueOf(String value) {
-        Number multiplier = 1;
-        if (_config.multiplier() != null) {
-            multiplier = (Number)_config.multiplier();
-        }
-        Class<T> type = _config.type();
-        if (type.isAssignableFrom(Boolean.class)) {
-            return (T)Boolean.valueOf(value);
-        } else if (type.isAssignableFrom(Integer.class)) {
-            return (T)new Integer(Integer.parseInt(value) * multiplier.intValue());
-        } else if (type.isAssignableFrom(Long.class)) {
-            return (T)new Long(Long.parseLong(value) * multiplier.longValue());
-        } else if (type.isAssignableFrom(Short.class)) {
-            return (T)new Short(Short.parseShort(value));
-        } else if (type.isAssignableFrom(String.class)) {
-            return (T)value;
-        } else if (type.isAssignableFrom(Float.class)) {
-            return (T)new Float(Float.parseFloat(value) * multiplier.floatValue());
-        } else if (type.isAssignableFrom(Double.class)) {
-            return (T)new Double(Double.parseDouble(value) * multiplier.doubleValue());
-        } else if (type.isAssignableFrom(String.class)) {
-            return (T)value;
-        } else if (type.isAssignableFrom(Date.class)) {
-            return (T)Date.valueOf(value);
-        } else if (type.isAssignableFrom(Character.class)) {
-            return (T)new Character(value.charAt(0));
-        } else {
-            throw new CloudRuntimeException("Unsupported data type for config values: " + type);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8f556e6d/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
----------------------------------------------------------------------
diff --git a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
index c2424fc..0def7f4 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java
@@ -16,12 +16,12 @@
 // under the License.
 package org.apache.cloudstack.framework.config.impl;
 
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 
+import javax.annotation.PostConstruct;
 import javax.inject.Inject;
 
 import org.apache.log4j.Logger;
@@ -29,14 +29,11 @@ import org.apache.log4j.Logger;
 import org.apache.cloudstack.framework.config.ConfigDepot;
 import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
 import org.apache.cloudstack.framework.config.ConfigKey;
-import org.apache.cloudstack.framework.config.ConfigKey.Scope;
-import org.apache.cloudstack.framework.config.ConfigValue;
 import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.ScopedConfigStorage;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 
 import com.cloud.utils.Pair;
-import com.cloud.utils.component.ConfigInjector;
 import com.cloud.utils.component.SystemIntegrityChecker;
 import com.cloud.utils.exception.CloudRuntimeException;
 
@@ -60,14 +57,14 @@ import com.cloud.utils.exception.CloudRuntimeException;
  *   - Figure out the correct categories.
  *
  */
-public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemIntegrityChecker, ConfigInjector {
+public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemIntegrityChecker {
     private final static Logger s_logger = Logger.getLogger(ConfigDepotImpl.class);
     @Inject
     ConfigurationDao   _configDao;
     @Inject
     List<Configurable> _configurables;
     @Inject
-    List<ScopedConfigStorage> _scopedStorage;
+    List<ScopedConfigStorage> _scopedStorages;
 
     HashMap<String, Pair<String, ConfigKey<?>>> _allKeys = new HashMap<String, Pair<String, ConfigKey<?>>>(1007);
 
@@ -75,17 +72,9 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemInt
     }
 
     @Override
-    public <T> ConfigValue<T> get(ConfigKey<T> config) {
-        if (config.scope() == Scope.Global) {
-            return new ConfigValue<T>(_configDao, config);
-        } else {
-            for (ScopedConfigStorage storage : _scopedStorage) {
-                if (storage.getScope() == config.scope()) {
-                    return new ConfigValue<T>(_configDao, config, storage);
-                }
-            }
-            throw new CloudRuntimeException("Unable to find config storage for this scope: " + config.scope());
-        }
+    public ConfigKey<?> get(String key) {
+        Pair<String, ConfigKey<?>> value = _allKeys.get(key);
+        return value != null ? value.second() : null;
     }
 
     @Override
@@ -121,6 +110,7 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemInt
     }
 
     @Override
+    @PostConstruct
     public void check() {
         for (Configurable configurable : _configurables) {
             s_logger.debug("Retrieving keys from " + configurable.getClass().getSimpleName());
@@ -135,24 +125,17 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin, SystemInt
         }
     }
 
-    @Override
-    public void inject(Field field, Object obj, String key) {
-        Pair<String, ConfigKey<?>> configKey = _allKeys.get(key);
-        try {
-            field.set(obj, get(configKey.second()));
-        } catch (IllegalArgumentException e) {
-            throw new CloudRuntimeException("Unable to inject configuration due to ", e);
-        } catch (IllegalAccessException e) {
-            throw new CloudRuntimeException("Unable to inject configuration due to ", e);
-        }
+    public ConfigurationDao global() {
+        return _configDao;
     }
-
-    @Override
-    public ConfigValue<?> get(String name) {
-        Pair<String, ConfigKey<?>> configKey = _allKeys.get(name);
-        if (configKey == null) {
-            throw new CloudRuntimeException("Unable to find a registered config key for " + name);
+    
+    public ScopedConfigStorage scoped(ConfigKey<?> config) {
+        for (ScopedConfigStorage storage : _scopedStorages) {
+            if (storage.getScope() == config.scope()) {
+                return storage;
+            }
         }
-        return get(configKey.second());
+
+        throw new CloudRuntimeException("Unable to find config storage for this scope: " + config.scope() + " for " + config.key());
     }
 }