cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahu...@apache.org
Subject [12/36] Commit to try something on removing getZone
Date Fri, 06 Sep 2013 22:38:42 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/alert/AlertManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/AlertManager.java b/server/src/com/cloud/alert/AlertManager.java
deleted file mode 100755
index b6d005a..0000000
--- a/server/src/com/cloud/alert/AlertManager.java
+++ /dev/null
@@ -1,58 +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.alert;
-
-import com.cloud.capacity.CapacityVO;
-import com.cloud.utils.component.Manager;
-
-public interface AlertManager extends Manager {
-    public static final short ALERT_TYPE_MEMORY = CapacityVO.CAPACITY_TYPE_MEMORY;
-    public static final short ALERT_TYPE_CPU = CapacityVO.CAPACITY_TYPE_CPU;
-    public static final short ALERT_TYPE_STORAGE = CapacityVO.CAPACITY_TYPE_STORAGE;
-    public static final short ALERT_TYPE_STORAGE_ALLOCATED = CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED;
-    public static final short ALERT_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = CapacityVO.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP;
-    public static final short ALERT_TYPE_PRIVATE_IP = CapacityVO.CAPACITY_TYPE_PRIVATE_IP;
-    public static final short ALERT_TYPE_SECONDARY_STORAGE = CapacityVO.CAPACITY_TYPE_SECONDARY_STORAGE;
-    public static final short ALERT_TYPE_HOST = 7;
-    public static final short ALERT_TYPE_USERVM = 8;
-    public static final short ALERT_TYPE_DOMAIN_ROUTER = 9;
-    public static final short ALERT_TYPE_CONSOLE_PROXY = 10;
-    public static final short ALERT_TYPE_ROUTING = 11; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_STORAGE_MISC = 12; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_USAGE_SERVER = 13; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_MANAGMENT_NODE = 14; // lost connection to default route (to the gateway)
-    public static final short ALERT_TYPE_DOMAIN_ROUTER_MIGRATE = 15;
-    public static final short ALERT_TYPE_CONSOLE_PROXY_MIGRATE = 16;
-    public static final short ALERT_TYPE_USERVM_MIGRATE = 17;
-    public static final short ALERT_TYPE_VLAN = 18;
-    public static final short ALERT_TYPE_SSVM = 19;
-    public static final short ALERT_TYPE_USAGE_SERVER_RESULT = 20; // Usage job result
-    public static final short ALERT_TYPE_STORAGE_DELETE = 21;
-    public static final short ALERT_TYPE_UPDATE_RESOURCE_COUNT = 22; // Generated when we fail to update the resource
-    // count
-    public static final short ALERT_TYPE_USAGE_SANITY_RESULT = 23;
-    public static final short ALERT_TYPE_DIRECT_ATTACHED_PUBLIC_IP = 24;
-    public static final short ALERT_TYPE_LOCAL_STORAGE = 25;
-    public static final short ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = 26; // Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only
-
-
-    void clearAlert(short alertType, long dataCenterId, long podId);
-
-    void sendAlert(short alertType, long dataCenterId, Long podId, String subject, String body);
-
-    void recalculateCapacity();
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/alert/AlertManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/alert/AlertManagerImpl.java b/server/src/com/cloud/alert/AlertManagerImpl.java
index 944b250..5494ec1 100755
--- a/server/src/com/cloud/alert/AlertManagerImpl.java
+++ b/server/src/com/cloud/alert/AlertManagerImpl.java
@@ -38,13 +38,20 @@ import javax.mail.URLName;
 import javax.mail.internet.InternetAddress;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
+
+import com.sun.mail.smtp.SMTPMessage;
+import com.sun.mail.smtp.SMTPSSLTransport;
+import com.sun.mail.smtp.SMTPTransport;
+
+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;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
 import com.cloud.alert.dao.AlertDao;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.capacity.Capacity;
@@ -67,25 +74,17 @@ import com.cloud.dc.dao.HostPodDao;
 import com.cloud.event.AlertGenerator;
 import com.cloud.host.Host;
 import com.cloud.host.HostVO;
-import com.cloud.host.dao.HostDao;
 import com.cloud.network.dao.IPAddressDao;
 import com.cloud.org.Grouping.AllocationState;
 import com.cloud.resource.ResourceManager;
-import com.cloud.server.ConfigurationServer;
 import com.cloud.storage.StorageManager;
-import com.cloud.storage.dao.VolumeDao;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.component.ManagerBase;
 import com.cloud.utils.db.DB;
 import com.cloud.utils.db.SearchCriteria;
 
-import com.sun.mail.smtp.SMTPMessage;
-import com.sun.mail.smtp.SMTPSSLTransport;
-import com.sun.mail.smtp.SMTPTransport;
-
-@Component
 @Local(value={AlertManager.class})
-public class AlertManagerImpl extends ManagerBase implements AlertManager {
+public class AlertManagerImpl extends ManagerBase implements AlertManager, Configurable {
     private static final Logger s_logger = Logger.getLogger(AlertManagerImpl.class.getName());
     private static final Logger s_alertsLogger = Logger.getLogger("org.apache.cloudstack.alerts");
 
@@ -96,31 +95,30 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
 
     private EmailAlert _emailAlert;
     @Inject private AlertDao _alertDao;
-    @Inject private HostDao _hostDao;
     @Inject protected StorageManager _storageMgr;
     @Inject protected CapacityManager _capacityMgr;
     @Inject private CapacityDao _capacityDao;
     @Inject private DataCenterDao _dcDao;
     @Inject private HostPodDao _podDao;
     @Inject private ClusterDao _clusterDao;
-    @Inject private VolumeDao _volumeDao;
     @Inject private IPAddressDao _publicIPAddressDao;
     @Inject private DataCenterIpAddressDao _privateIPAddressDao;
     @Inject private PrimaryDataStoreDao _storagePoolDao;
     @Inject private ConfigurationDao _configDao;
     @Inject private ResourceManager _resourceMgr;
     @Inject private ConfigurationManager _configMgr;
-    @Inject ConfigurationServer _configServer;
+    @Inject
+    protected ConfigDepot _configDepot;
+
     private Timer _timer = null;
-    private float _cpuOverProvisioningFactor = 1;
     private long _capacityCheckPeriod = 60L * 60L * 1000L; // one hour by default
-    private double _memoryCapacityThreshold = 0.75;
-    private double _cpuCapacityThreshold = 0.75;
-    private double _storageCapacityThreshold = 0.75;
-    private double _storageAllocCapacityThreshold = 0.75;
+    private ConfigValue<Double> _memoryCapacityThreshold;
+    private ConfigValue<Double> _cpuCapacityThreshold;
+    private ConfigValue<Double> _storageCapacityThreshold;
+    private ConfigValue<Double> _storageAllocCapacityThreshold;
     private double _publicIPCapacityThreshold = 0.75;
     private double _privateIPCapacityThreshold = 0.75;
-    private double _secondaryStorageCapacityThreshold = 0.75; 
+    private double _secondaryStorageCapacityThreshold = 0.75;
     private double _vlanCapacityThreshold = 0.75;
     private double _directNetworkPublicIpCapacityThreshold = 0.75;
     private double _localStorageCapacityThreshold = 0.75;
@@ -152,11 +150,6 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
 
         _emailAlert = new EmailAlert(emailAddresses, smtpHost, smtpPort, useAuth, smtpUsername, smtpPassword, emailSender, smtpDebug);
 
-
-        String storageCapacityThreshold = _configDao.getValue(Config.StorageCapacityThreshold.key());
-        String cpuCapacityThreshold = _configDao.getValue(Config.CPUCapacityThreshold.key());
-        String memoryCapacityThreshold = _configDao.getValue(Config.MemoryCapacityThreshold.key());
-        String storageAllocCapacityThreshold = _configDao.getValue(Config.StorageAllocatedCapacityThreshold.key());
         String publicIPCapacityThreshold = _configDao.getValue(Config.PublicIpCapacityThreshold.key());
         String privateIPCapacityThreshold = _configDao.getValue(Config.PrivateIpCapacityThreshold.key());
         String secondaryStorageCapacityThreshold = _configDao.getValue(Config.SecondaryStorageCapacityThreshold.key());
@@ -164,18 +157,11 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
         String directNetworkPublicIpCapacityThreshold = _configDao.getValue(Config.DirectNetworkPublicIpCapacityThreshold.key());
         String localStorageCapacityThreshold = _configDao.getValue(Config.LocalStorageCapacityThreshold.key());
 
-        if (storageCapacityThreshold != null) {
-            _storageCapacityThreshold = Double.parseDouble(storageCapacityThreshold);
-        }
-        if (storageAllocCapacityThreshold != null) {
-            _storageAllocCapacityThreshold = Double.parseDouble(storageAllocCapacityThreshold);
-        }
-        if (cpuCapacityThreshold != null) {
-            _cpuCapacityThreshold = Double.parseDouble(cpuCapacityThreshold);
-        }
-        if (memoryCapacityThreshold != null) {
-            _memoryCapacityThreshold = Double.parseDouble(memoryCapacityThreshold);
-        }
+        _storageCapacityThreshold = _configDepot.get(StorageCapacityThreshold);
+        _cpuCapacityThreshold = _configDepot.get(CPUCapacityThreshold);
+        _memoryCapacityThreshold = _configDepot.get(MemoryCapacityThreshold);
+        _storageAllocCapacityThreshold = _configDepot.get(StorageAllocatedCapacityThreshold);
+
         if (publicIPCapacityThreshold != null) {
             _publicIPCapacityThreshold = Double.parseDouble(publicIPCapacityThreshold);
         }
@@ -195,10 +181,6 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
             _localStorageCapacityThreshold = Double.parseDouble(localStorageCapacityThreshold);
         }
 
-        _capacityTypeThresholdMap.put(Capacity.CAPACITY_TYPE_STORAGE, _storageCapacityThreshold);
-        _capacityTypeThresholdMap.put(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED, _storageAllocCapacityThreshold);
-        _capacityTypeThresholdMap.put(Capacity.CAPACITY_TYPE_CPU, _cpuCapacityThreshold);
-        _capacityTypeThresholdMap.put(Capacity.CAPACITY_TYPE_MEMORY, _memoryCapacityThreshold);
         _capacityTypeThresholdMap.put(Capacity.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP, _publicIPCapacityThreshold);
         _capacityTypeThresholdMap.put(Capacity.CAPACITY_TYPE_PRIVATE_IP, _privateIPCapacityThreshold);
         _capacityTypeThresholdMap.put(Capacity.CAPACITY_TYPE_SECONDARY_STORAGE, _secondaryStorageCapacityThreshold);
@@ -214,14 +196,6 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
                 _capacityCheckPeriod = Long.parseLong(Config.CapacityCheckPeriod.getDefaultValue());
         }
 
-        String cpuOverProvisioningFactorStr = configs.get("cpu.overprovisioning.factor");
-        if (cpuOverProvisioningFactorStr != null) {
-            _cpuOverProvisioningFactor = NumbersUtil.parseFloat(cpuOverProvisioningFactorStr,1);
-            if(_cpuOverProvisioningFactor < 1){
-                _cpuOverProvisioningFactor = 1;
-            }
-        }
-
         _timer = new Timer("CapacityChecker");
 
         return true;
@@ -336,7 +310,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
         //        than this model right now, so when a VM is started, we update the amount allocated, and when a VM
         //        is stopped we updated the amount allocated, and when VM sync reports a changed state, we update
         //        the amount allocated.  Hopefully it's limited to 3 entry points and will keep the amount allocated
-        //        per host accurate.        
+        //        per host accurate.
 
         try {
 
@@ -347,7 +321,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
 
             // Calculate CPU and RAM capacities
             // 	get all hosts...even if they are not in 'UP' state
-            List<HostVO> hosts = _resourceMgr.listAllNotInMaintenanceHostsInOneZone(Host.Type.Routing, null);	        	        
+            List<HostVO> hosts = _resourceMgr.listAllNotInMaintenanceHostsInOneZone(Host.Type.Routing, null);
             for (HostVO host : hosts) {
                 _capacityMgr.updateCapacityForHost(host);
             }
@@ -377,13 +351,13 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
                 long dcId = datacenter.getId();
 
                 //NOTE
-                //What happens if we have multiple vlans? Dashboard currently shows stats 
+                //What happens if we have multiple vlans? Dashboard currently shows stats
                 //with no filter based on a vlan
                 //ideal way would be to remove out the vlan param, and filter only on dcId
                 //implementing the same
 
                 // Calculate new Public IP capacity for Virtual Network
-                if (datacenter.getNetworkType() == NetworkType.Advanced){        			
+                if (datacenter.getNetworkType() == NetworkType.Advanced){
                     createOrUpdateIpCapacity(dcId, null, CapacityVO.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP, datacenter.getAllocationState());
                 }
 
@@ -394,7 +368,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
                     //Calculate VLAN's capacity
                     createOrUpdateVlanCapacity(dcId, datacenter.getAllocationState());
                 }
-            }        
+            }
 
             if (s_logger.isDebugEnabled()) {
                 s_logger.debug("Done capacity updates for public ip and Vlans");
@@ -415,7 +389,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
                 s_logger.debug("Done recalculating system capacity");
             }
 
-        } catch (Throwable t) {        	
+        } catch (Throwable t) {
             s_logger.error("Caught exception in recalculating capacity", t);
         }
     }
@@ -439,14 +413,14 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
             CapacityVO newVlanCapacity = new CapacityVO(null, dcId, null, null, allocatedVlans, totalVlans, Capacity.CAPACITY_TYPE_VLAN);
             if (capacityState == AllocationState.Disabled){
                 newVlanCapacity.setCapacityState(CapacityState.Disabled);
-            } 
+            }
             _capacityDao.persist(newVlanCapacity);
-        }else if ( !(capacities.get(0).getUsedCapacity() == allocatedVlans 
+        }else if ( !(capacities.get(0).getUsedCapacity() == allocatedVlans
                 && capacities.get(0).getTotalCapacity() == totalVlans) ){
             CapacityVO capacity = capacities.get(0);
             capacity.setUsedCapacity(allocatedVlans);
             capacity.setTotalCapacity(totalVlans);
-            _capacityDao.update(capacity.getId(), capacity);        	
+            _capacityDao.update(capacity.getId(), capacity);
         }
 
 
@@ -479,9 +453,9 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
             CapacityVO newPublicIPCapacity = new CapacityVO(null, dcId, podId, null, allocatedIPs, totalIPs, capacityType);
             if (capacityState == AllocationState.Disabled){
                 newPublicIPCapacity.setCapacityState(CapacityState.Disabled);
-            }        		
+            }
             _capacityDao.persist(newPublicIPCapacity);
-        }else if ( !(capacities.get(0).getUsedCapacity() == allocatedIPs 
+        }else if ( !(capacities.get(0).getUsedCapacity() == allocatedIPs
                 && capacities.get(0).getTotalCapacity() == totalIPs) ){
             CapacityVO capacity = capacities.get(0);
             capacity.setUsedCapacity(allocatedIPs);
@@ -504,19 +478,6 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
         }
     }
 
-    private float getOverProvisioningFactor(long clusterId, short capacityType) {
-        float overProvisioinigFactor = 1f;
-        switch (capacityType) {
-            case Capacity.CAPACITY_TYPE_CPU:
-                overProvisioinigFactor = Float.parseFloat(_configServer.getConfigValue(Config.CPUOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), clusterId));
-                break;
-            case Capacity.CAPACITY_TYPE_MEMORY:
-                overProvisioinigFactor = Float.parseFloat(_configServer.getConfigValue(Config.MemOverprovisioningFactor.key(), Config.ConfigurationParameterScope.cluster.toString(), clusterId));
-                break;
-        }
-        return overProvisioinigFactor;
-    }
-
     public void checkForAlerts(){
 
         recalculateCapacity();
@@ -531,9 +492,9 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
         List<ClusterVO> clusterList = _clusterDao.listAll();
         List<HostPodVO> podList = _podDao.listAll();
         //Get capacity types at different levels
-        List<Short> dataCenterCapacityTypes = getCapacityTypesAtZoneLevel();         
-        List<Short> podCapacityTypes = getCapacityTypesAtPodLevel();        
-        List<Short> clusterCapacityTypes = getCapacityTypesAtClusterLevel();        
+        List<Short> dataCenterCapacityTypes = getCapacityTypesAtZoneLevel();
+        List<Short> podCapacityTypes = getCapacityTypesAtPodLevel();
+        List<Short> clusterCapacityTypes = getCapacityTypesAtClusterLevel();
 
         // Generate Alerts for Zone Level capacities
         for(DataCenterVO dc : dataCenterList){
@@ -547,7 +508,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
                 if (capacity == null || capacity.size() == 0){
                     continue;
                 }
-                double totalCapacity = capacity.get(0).getTotalCapacity(); 
+                double totalCapacity = capacity.get(0).getTotalCapacity();
                 double usedCapacity =  capacity.get(0).getUsedCapacity();
                 if (totalCapacity != 0 && usedCapacity/totalCapacity > _capacityTypeThresholdMap.get(capacityType)){
                     generateEmailAlert(dc, null, null, totalCapacity, usedCapacity, capacityType);
@@ -562,10 +523,10 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
                 if (capacity == null || capacity.size() == 0){
                     continue;
                 }
-                double totalCapacity = capacity.get(0).getTotalCapacity(); 
+                double totalCapacity = capacity.get(0).getTotalCapacity();
                 double usedCapacity =  capacity.get(0).getUsedCapacity();
                 if (totalCapacity != 0 && usedCapacity/totalCapacity > _capacityTypeThresholdMap.get(capacityType)){
-                    generateEmailAlert(ApiDBUtils.findZoneById(pod.getDataCenterId()), pod, null, 
+                    generateEmailAlert(ApiDBUtils.findZoneById(pod.getDataCenterId()), pod, null,
                             totalCapacity, usedCapacity, capacityType);
                 }
             }
@@ -582,16 +543,16 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
                 switch (capacityType) {
                     case Capacity.CAPACITY_TYPE_STORAGE:
                         capacity.add(getUsedStats(capacityType, cluster.getDataCenterId(), cluster.getPodId(), cluster.getId()));
-                        threshold = Double.parseDouble(_configServer.getConfigValue(Config.StorageCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
+                        threshold = _storageCapacityThreshold.valueIn(cluster.getId());
                         break;
                     case Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED:
-                        threshold = Double.parseDouble(_configServer.getConfigValue(Config.StorageAllocatedCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
+                        threshold = _storageAllocCapacityThreshold.valueIn(cluster.getId());
                         break;
                     case Capacity.CAPACITY_TYPE_CPU:
-                        threshold = Double.parseDouble(_configServer.getConfigValue(Config.CPUCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
+                        threshold = _cpuCapacityThreshold.valueIn(cluster.getId());
                         break;
                     case Capacity.CAPACITY_TYPE_MEMORY:
-                        threshold = Double.parseDouble(_configServer.getConfigValue(Config.MemoryCapacityThreshold.key(), Config.ConfigurationParameterScope.cluster.toString(), cluster.getId()));
+                        threshold = _memoryCapacityThreshold.valueIn(cluster.getId());
                         break;
                     default:
                         threshold = _capacityTypeThresholdMap.get(capacityType);
@@ -619,7 +580,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
             capacity = _storageMgr.getStoragePoolUsedStats(null, clusterId, podId, zoneId);
         }
         if (capacity != null){
-            return new SummedCapacity(capacity.getUsedCapacity(), 0, capacity.getTotalCapacity(), capacityType, clusterId, podId);	
+            return new SummedCapacity(capacity.getUsedCapacity(), 0, capacity.getTotalCapacity(), capacityType, clusterId, podId);
         }else{
             return null;
         }
@@ -676,8 +637,8 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
             alertType = ALERT_TYPE_LOCAL_STORAGE;
             break;
 
-            //Pod Level    
-        case CapacityVO.CAPACITY_TYPE_PRIVATE_IP:        	
+            //Pod Level
+        case CapacityVO.CAPACITY_TYPE_PRIVATE_IP:
             msgSubject = "System Alert: Number of unallocated private IPs is low in pod " +pod.getName()+ " of availability zone " + dc.getName();
             totalStr = Double.toString(totalCapacity);
             usedStr = Double.toString(usedCapacity);
@@ -686,7 +647,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
             break;
 
             //Zone Level
-        case CapacityVO.CAPACITY_TYPE_SECONDARY_STORAGE:        	
+        case CapacityVO.CAPACITY_TYPE_SECONDARY_STORAGE:
             msgSubject = "System Alert: Low Available Secondary Storage in availability zone " + dc.getName();
             totalStr = formatBytesToMegabytes(totalCapacity);
             usedStr = formatBytesToMegabytes(usedCapacity);
@@ -723,7 +684,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
             }
             _emailAlert.sendAlert(alertType, dc.getId(), podId, clusterId, msgSubject, msgContent);
         } catch (Exception ex) {
-            s_logger.error("Exception in CapacityChecker", ex);        
+            s_logger.error("Exception in CapacityChecker", ex);
         }
     }
 
@@ -741,7 +702,7 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
     private List<Short> getCapacityTypesAtPodLevel(){
 
         List<Short> podCapacityTypes = new ArrayList<Short>();
-        podCapacityTypes.add(Capacity.CAPACITY_TYPE_PRIVATE_IP);    	
+        podCapacityTypes.add(Capacity.CAPACITY_TYPE_PRIVATE_IP);
         return podCapacityTypes;
 
     }
@@ -897,4 +858,14 @@ public class AlertManagerImpl extends ManagerBase implements AlertManager {
         double megaBytes = (bytes / (1024 * 1024));
         return _dfWhole.format(megaBytes);
     }
+
+    @Override
+    public String getConfigComponentName() {
+        return AlertManager.class.getSimpleName();
+    }
+
+    @Override
+    public ConfigKey<?>[] getConfigKeys() {
+        return new ConfigKey<?>[] {CPUCapacityThreshold, MemoryCapacityThreshold, StorageAllocatedCapacityThreshold, StorageCapacityThreshold};
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/api/ApiDBUtils.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiDBUtils.java b/server/src/com/cloud/api/ApiDBUtils.java
index 7e36f75..6539289 100755
--- a/server/src/com/cloud/api/ApiDBUtils.java
+++ b/server/src/com/cloud/api/ApiDBUtils.java
@@ -103,6 +103,7 @@ import com.cloud.api.query.vo.TemplateJoinVO;
 import com.cloud.api.query.vo.UserAccountJoinVO;
 import com.cloud.api.query.vo.UserVmJoinVO;
 import com.cloud.api.query.vo.VolumeJoinVO;
+import com.cloud.capacity.CapacityManager;
 import com.cloud.capacity.CapacityVO;
 import com.cloud.capacity.dao.CapacityDao;
 import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity;
@@ -1047,7 +1048,7 @@ public class ApiDBUtils {
     }
 
     public static float getCpuOverprovisioningFactor() {
-        String opFactor = _configDao.getValue(Config.CPUOverprovisioningFactor.key());
+        String opFactor = _configDao.getValue(CapacityManager.CpuOverprovisioningFactorCK);
         float cpuOverprovisioningFactor = NumbersUtil.parseFloat(opFactor, 1);
         return cpuOverprovisioningFactor;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 8d01274..1ad0eab 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -842,7 +842,6 @@ public class ApiResponseHelper implements ResponseGenerator {
     public static List<CapacityResponse> getDataCenterCapacityResponse(Long zoneId) {
         List<SummedCapacity> capacities = ApiDBUtils.getCapacityByClusterPodZone(zoneId, null, null);
         Set<CapacityResponse> capacityResponses = new HashSet<CapacityResponse>();
-        float cpuOverprovisioningFactor = ApiDBUtils.getCpuOverprovisioningFactor();
 
         for (SummedCapacity capacity : capacities) {
             CapacityResponse capacityResponse = new CapacityResponse();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/capacity/CapacityManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManager.java b/server/src/com/cloud/capacity/CapacityManager.java
deleted file mode 100755
index ded1f80..0000000
--- a/server/src/com/cloud/capacity/CapacityManager.java
+++ /dev/null
@@ -1,59 +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.capacity;
-
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-
-import com.cloud.host.Host;
-import com.cloud.storage.VMTemplateVO;
-import com.cloud.utils.component.Manager;
-import com.cloud.vm.VirtualMachine;
-
-/**
- * Capacity Manager manages the different capacities
- * available within the Cloud Stack.
- *
- */
-public interface CapacityManager extends Manager {
-    public boolean releaseVmCapacity(VirtualMachine vm, boolean moveFromReserved, boolean moveToReservered, Long hostId);
-
-    void allocateVmCapacity(VirtualMachine vm, boolean fromLastHost);
-    
-    /**
-     * @param hostId Id of the host to check capacity
-     * @param cpu required CPU
-     * @param ram required RAM
-     * @param cpuOverprovisioningFactor factor to apply to the actual host cpu
-     */
-    boolean checkIfHostHasCapacity(long hostId, Integer cpu, long ram, boolean checkFromReservedCapacity, float cpuOverprovisioningFactor, float memoryOvercommitRatio, boolean considerReservedCapacity);
-
-	void updateCapacityForHost(Host host);
-    
-	/**
-     * @param pool storage pool
-     * @param templateForVmCreation template that will be used for vm creation
-     * @return total allocated capacity for the storage pool
-     */
-    long getAllocatedPoolCapacity(StoragePoolVO pool, VMTemplateVO templateForVmCreation);
-    
-    /**
-     * Check if specified host's running VM count has reach hypervisor limit
-     * @param host the host to be checked
-     * @return true if the count of host's running VMs >= hypervisor limit
-     */
-    boolean checkIfHostReachMaxGuestLimit(Host host);
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/capacity/CapacityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/capacity/CapacityManagerImpl.java b/server/src/com/cloud/capacity/CapacityManagerImpl.java
index f4bc62d..348021c 100755
--- a/server/src/com/cloud/capacity/CapacityManagerImpl.java
+++ b/server/src/com/cloud/capacity/CapacityManagerImpl.java
@@ -28,8 +28,9 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
 
+import org.apache.cloudstack.framework.config.ConfigKey;
+import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.framework.messagebus.MessageBus;
 import org.apache.cloudstack.framework.messagebus.PublishScope;
@@ -71,7 +72,6 @@ import com.cloud.storage.VMTemplateVO;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VMTemplatePoolDao;
 import com.cloud.storage.dao.VolumeDao;
-import com.cloud.uservm.UserVm;
 import com.cloud.utils.DateUtil;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
@@ -83,27 +83,18 @@ import com.cloud.utils.db.Transaction;
 import com.cloud.utils.fsm.StateListener;
 import com.cloud.vm.UserVmDetailVO;
 import com.cloud.vm.UserVmVO;
-import com.cloud.vm.UserVmDetailVO;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.Event;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.UserVmDetailsDao;
-import com.cloud.vm.dao.UserVmDetailsDao;
 import com.cloud.vm.dao.VMInstanceDao;
-import com.cloud.vm.snapshot.VMSnapshot;
-import com.cloud.vm.snapshot.VMSnapshotVO;
 import com.cloud.vm.snapshot.dao.VMSnapshotDao;
 
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-@Component
 @Local(value = CapacityManager.class)
-public class CapacityManagerImpl extends ManagerBase implements CapacityManager, StateListener<State, VirtualMachine.Event, VirtualMachine>, Listener, ResourceListener {
+public class CapacityManagerImpl extends ManagerBase implements CapacityManager, StateListener<State, VirtualMachine.Event, VirtualMachine>, Listener, ResourceListener,
+        Configurable {
     private static final Logger s_logger = Logger.getLogger(CapacityManagerImpl.class);
     @Inject
     CapacityDao _capacityDao;
@@ -932,4 +923,14 @@ public class CapacityManagerImpl extends ManagerBase implements CapacityManager,
         }
         return false;
     }
+
+    @Override
+    public String getConfigComponentName() {
+        return CapacityManager.class.getSimpleName();
+    }
+
+    @Override
+    public ConfigKey<?>[] getConfigKeys() {
+        return new ConfigKey<?>[] {CpuOverprovisioningFactor, MemOverprovisioningFactor};
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/cluster/ClusteredAgentRebalanceService.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/cluster/ClusteredAgentRebalanceService.java b/server/src/com/cloud/cluster/ClusteredAgentRebalanceService.java
deleted file mode 100644
index ed52eb1..0000000
--- a/server/src/com/cloud/cluster/ClusteredAgentRebalanceService.java
+++ /dev/null
@@ -1,30 +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.cluster;
-
-import com.cloud.exception.AgentUnavailableException;
-import com.cloud.exception.OperationTimedoutException;
-import com.cloud.host.Status.Event;
-
-public interface ClusteredAgentRebalanceService {
-    public static final int DEFAULT_TRANSFER_CHECK_INTERVAL = 10000;
-
-    void scheduleRebalanceAgents();
-
-    boolean executeRebalanceRequest(long agentId, long currentOwnerId, long futureOwnerId, Event event) throws AgentUnavailableException, OperationTimedoutException;
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/cluster/agentlb/AgentLoadBalancerPlanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/cluster/agentlb/AgentLoadBalancerPlanner.java b/server/src/com/cloud/cluster/agentlb/AgentLoadBalancerPlanner.java
deleted file mode 100644
index 5a65250..0000000
--- a/server/src/com/cloud/cluster/agentlb/AgentLoadBalancerPlanner.java
+++ /dev/null
@@ -1,29 +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.cluster.agentlb;
-
-import java.util.List;
-
-import com.cloud.host.HostVO;
-import com.cloud.utils.component.Adapter;
-
-
-public interface AgentLoadBalancerPlanner extends Adapter{
-    
-    List<HostVO> getHostsToRebalance(long msId, int avLoad);
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java b/server/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java
deleted file mode 100755
index 535ba07..0000000
--- a/server/src/com/cloud/cluster/agentlb/ClusterBasedAgentLoadBalancerPlanner.java
+++ /dev/null
@@ -1,150 +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.cluster.agentlb;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.ejb.Local;
-import javax.inject.Inject;
-import javax.naming.ConfigurationException;
-
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-import com.cloud.host.Host;
-import com.cloud.host.HostVO;
-import com.cloud.host.Status;
-import com.cloud.host.dao.HostDao;
-import com.cloud.utils.component.AdapterBase;
-import com.cloud.utils.db.SearchCriteria2;
-import com.cloud.utils.db.SearchCriteria.Op;
-import com.cloud.utils.db.SearchCriteriaService;
-
-@Component
-@Local(value=AgentLoadBalancerPlanner.class)
-public class ClusterBasedAgentLoadBalancerPlanner extends AdapterBase implements AgentLoadBalancerPlanner{
-    private static final Logger s_logger = Logger.getLogger(AgentLoadBalancerPlanner.class);
-    
-    @Inject HostDao _hostDao = null;
-    
-    @Override
-    public List<HostVO> getHostsToRebalance(long msId, int avLoad) {
-    	SearchCriteriaService<HostVO, HostVO> sc = SearchCriteria2.create(HostVO.class);
-    	sc.addAnd(sc.getEntity().getType(), Op.EQ, Host.Type.Routing);
-    	sc.addAnd(sc.getEntity().getManagementServerId(), Op.EQ, msId);
-        List<HostVO> allHosts = sc.list();
- 
-        if (allHosts.size() <= avLoad) {
-            s_logger.debug("Agent load = " + allHosts.size() + " for management server " + msId + " doesn't exceed average system agent load = " + avLoad + "; so it doesn't participate in agent rebalancing process");
-            return null;
-        }
-        
-        sc = SearchCriteria2.create(HostVO.class);
-        sc.addAnd(sc.getEntity().getManagementServerId(), Op.EQ, msId);
-        sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
-        List<HostVO> directHosts = sc.list();
-        
-        if (directHosts.isEmpty()) {
-            s_logger.debug("No direct agents in status " + Status.Up + " exist for the management server " + msId + "; so it doesn't participate in agent rebalancing process");
-            return null;
-        } 
-        
-       
-        Map<Long, List<HostVO>> hostToClusterMap = new HashMap<Long, List<HostVO>>();
-        
-        for (HostVO directHost : directHosts) {
-            Long clusterId = directHost.getClusterId();
-            List<HostVO> directHostsPerCluster = null;
-            if (!hostToClusterMap.containsKey(clusterId)) {
-                directHostsPerCluster = new ArrayList<HostVO>();
-            } else {
-                directHostsPerCluster = hostToClusterMap.get(clusterId);
-            }
-            directHostsPerCluster.add(directHost);
-            hostToClusterMap.put(clusterId, directHostsPerCluster);
-        }
-        
-        hostToClusterMap = sortByClusterSize(hostToClusterMap);
-        
-        int hostsToGive = allHosts.size() - avLoad;
-        int hostsLeftToGive = hostsToGive;
-        int hostsLeft = directHosts.size();
-        List<HostVO> hostsToReturn = new ArrayList<HostVO>();
-        
-        s_logger.debug("Management server " + msId + " can give away " + hostsToGive + " as it currently owns " + allHosts.size() + 
-                " and the average agent load in the system is " + avLoad + "; finalyzing list of hosts to give away...");
-        for (Long cluster : hostToClusterMap.keySet()) {
-            List<HostVO> hostsInCluster = hostToClusterMap.get(cluster);
-            hostsLeft = hostsLeft - hostsInCluster.size();
-            if (hostsToReturn.size() < hostsToGive) {
-                s_logger.debug("Trying cluster id=" + cluster);
-                
-                if (hostsInCluster.size() > hostsLeftToGive) {
-                    s_logger.debug("Skipping cluster id=" + cluster + " as it has more hosts than we need: " + hostsInCluster.size() + " vs " + hostsLeftToGive);
-                    if (hostsLeft >= hostsLeftToGive) {
-                        continue;
-                    } else {
-                        break;
-                    }  
-                } else {
-                    s_logger.debug("Taking all " + hostsInCluster.size() + " hosts: " + hostsInCluster + " from cluster id=" + cluster);
-                    hostsToReturn.addAll(hostsInCluster);
-                    hostsLeftToGive = hostsLeftToGive - hostsInCluster.size();
-                }
-            } else {
-                break;
-            }
-        }
-        
-        s_logger.debug("Management server " + msId + " is ready to give away " + hostsToReturn.size() + " hosts");
-        return hostsToReturn;
-    }
-    
-    public static LinkedHashMap<Long, List<HostVO>> sortByClusterSize(final Map<Long, List<HostVO>> hostToClusterMap) {
-        List<Long> keys = new ArrayList<Long>();
-        keys.addAll(hostToClusterMap.keySet());
-        Collections.sort(keys, new Comparator<Long>() {
-            @Override
-            public int compare(Long o1, Long o2) {
-                List<HostVO> v1 = hostToClusterMap.get(o1);
-                List<HostVO> v2 = hostToClusterMap.get(o2);
-                if (v1 == null) {
-                    return (v2 == null) ? 0 : 1;
-                }
-                
-                if (v1.size() < v2.size()) {
-                    return 1;
-                } else {
-                    return 0;
-                }
-            }
-        });
-        
-        LinkedHashMap<Long, List<HostVO>> sortedMap = new LinkedHashMap<Long, List<HostVO>>();
-        for (Long key : keys) {
-            sortedMap.put(key, hostToClusterMap.get(key));
-        }
-        return sortedMap;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/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 f7c5992..cde8b03 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -23,6 +23,7 @@ import java.util.StringTokenizer;
 
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.framework.config.ConfigKey;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.consoleproxy.ConsoleProxyManager;
@@ -50,25 +51,21 @@ public enum Config {
 	AlertSMTPUseAuth("Alert", ManagementServer.class, String.class, "alert.smtp.useAuth", null, "If true, use SMTP authentication when sending emails.", null),
 	AlertSMTPUsername("Alert", ManagementServer.class, String.class, "alert.smtp.username", null, "Username for SMTP authentication (applies only if alert.smtp.useAuth is true).", null),
 	CapacityCheckPeriod("Alert", ManagementServer.class, Integer.class, "capacity.check.period", "300000", "The interval in milliseconds between capacity checks", null),
-	StorageAllocatedCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.storage.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of allocated storage utilization above which alerts will be sent about low storage available.", null, ConfigurationParameterScope.cluster.toString()),
-	StorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.storage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of storage utilization above which alerts will be sent about low storage available.", null, ConfigurationParameterScope.cluster.toString()),
-	CPUCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of cpu utilization above which alerts will be sent about low cpu available.", null, ConfigurationParameterScope.cluster.toString()),
-	MemoryCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of memory utilization above which alerts will be sent about low memory available.", null, ConfigurationParameterScope.cluster.toString()),
 	PublicIpCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.virtualnetwork.publicip.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of public IP address space utilization above which alerts will be sent.", null),
 	PrivateIpCapacityThreshold("Alert", ManagementServer.class, Float.class, "pod.privateip.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of private IP address space utilization above which alerts will be sent.", null),
 	SecondaryStorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.secstorage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of secondary storage utilization above which alerts will be sent about low storage available.", null),
 	VlanCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.vlan.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of Zone Vlan utilization above which alerts will be sent about low number of Zone Vlans.", null),
 	DirectNetworkPublicIpCapacityThreshold("Alert", ManagementServer.class, Float.class, "zone.directnetwork.publicip.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of Direct Network Public Ip Utilization above which alerts will be sent about low number of direct network public ips.", null),
 	LocalStorageCapacityThreshold("Alert", ManagementServer.class, Float.class, "cluster.localStorage.capacity.notificationthreshold", "0.75", "Percentage (as a value between 0 and 1) of local storage utilization above which alerts will be sent about low local storage available.", null),
-	StorageAllocatedCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for low allocated storage available.", null, ConfigurationParameterScope.zone.toString()),
-	StorageCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of storage utilization above which allocators will disable using the pool for low storage available.", null, ConfigurationParameterScope.zone.toString()),
-	CPUCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigurationParameterScope.cluster.toString()),
-	MemoryCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigurationParameterScope.cluster.toString()),
+	StorageAllocatedCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of allocated storage utilization above which allocators will disable using the pool for low allocated storage available.", null, ConfigKey.Scope.Zone.toString()),
+	StorageCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "pool.storage.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of storage utilization above which allocators will disable using the pool for low storage available.", null, ConfigKey.Scope.Zone.toString()),
+	CPUCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.cpu.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigKey.Scope.Cluster.toString()),
+	MemoryCapacityDisableThreshold("Alert", ManagementServer.class, Float.class, "cluster.memory.allocated.capacity.disablethreshold", "0.85", "Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.", null, ConfigKey.Scope.Cluster.toString()),
 
 
 	// Storage
 
-	StorageOverprovisioningFactor("Storage", StoragePoolAllocator.class, String.class, "storage.overprovisioning.factor", "2", "Used for storage overprovisioning calculation; available storage will be (actualStorageSize * storage.overprovisioning.factor)", null, ConfigurationParameterScope.zone.toString()),
+	StorageOverprovisioningFactor("Storage", StoragePoolAllocator.class, String.class, "storage.overprovisioning.factor", "2", "Used for storage overprovisioning calculation; available storage will be (actualStorageSize * storage.overprovisioning.factor)", null, ConfigKey.Scope.Zone.toString()),
 	StorageStatsInterval("Storage", ManagementServer.class, String.class, "storage.stats.interval", "60000", "The interval (in milliseconds) when storage stats (per host) are retrieved from agents.", null),
 	MaxVolumeSize("Storage", ManagementServer.class, Integer.class, "storage.max.volume.size", "2000", "The maximum size for a volume (in GB).", null),
     StorageCacheReplacementLRUTimeInterval("Storage", ManagementServer.class, Integer.class, "storage.cache.replacement.lru.interval", "30", "time interval for unused data on cache storage (in days).", null),
@@ -96,13 +93,10 @@ public enum Config {
 
 	GuestVlanBits("Network", ManagementServer.class, Integer.class, "guest.vlan.bits", "12", "The number of bits to reserve for the VLAN identifier in the guest subnet.", null),
 	//MulticastThrottlingRate("Network", ManagementServer.class, Integer.class, "multicast.throttling.rate", "10", "Default multicast rate in megabits per second allowed.", null),
-	NetworkThrottlingRate("Network", ManagementServer.class, Integer.class, "network.throttling.rate", "200", "Default data transfer rate in megabits per second allowed in network.", null, ConfigurationParameterScope.zone.toString()),
-	GuestDomainSuffix("Network", AgentManager.class, String.class, "guest.domain.suffix", "cloud.internal", "Default domain name for vms inside virtualized networks fronted by router", null, ConfigurationParameterScope.zone.toString()),
 	DirectNetworkNoDefaultRoute("Network", ManagementServer.class, Boolean.class, "direct.network.no.default.route", "false", "Direct Network Dhcp Server should not send a default route", "true/false"),
 	OvsTunnelNetwork("Network", ManagementServer.class, Boolean.class, "sdn.ovs.controller", "false", "Enable/Disable Open vSwitch SDN controller for L2-in-L3 overlay networks", null),
 	OvsTunnelNetworkDefaultLabel("Network", ManagementServer.class, String.class, "sdn.ovs.controller.default.label", "cloud-public", "Default network label to be used when fetching interface for GRE endpoints", null),
 	VmNetworkThrottlingRate("Network", ManagementServer.class, Integer.class, "vm.network.throttling.rate", "200", "Default data transfer rate in megabits per second allowed in User vm's default network.", null),
-	NetworkLockTimeout("Network", ManagementServer.class, Integer.class, "network.lock.timeout", "600", "Lock wait timeout (seconds) while implementing network", null),
 
 	SecurityGroupWorkCleanupInterval("Network", ManagementServer.class, Integer.class, "network.securitygroups.work.cleanup.interval", "120", "Time interval (seconds) in which finished work is cleaned up from the work table", null),
 	SecurityGroupWorkerThreads("Network", ManagementServer.class, Integer.class, "network.securitygroups.workers.pool.size", "50", "Number of worker threads processing the security group update work queue", null),
@@ -115,7 +109,6 @@ public enum Config {
 
 	//VPN
 	RemoteAccessVpnPskLength("Network", AgentManager.class, Integer.class, "remote.access.vpn.psk.length", "24", "The length of the ipsec preshared key (minimum 8, maximum 256)", null),
-	RemoteAccessVpnClientIpRange("Network", AgentManager.class, String.class, "remote.access.vpn.client.iprange", "10.1.2.1-10.1.2.8", "The range of ips to be allocated to remote access vpn clients. The first ip in the range is used by the VPN server", null, ConfigurationParameterScope.account.toString()),
 	RemoteAccessVpnUserLimit("Network", AgentManager.class, String.class, "remote.access.vpn.user.limit", "8", "The maximum number of VPN users that can be created per account", null),
 	Site2SiteVpnConnectionPerVpnGatewayLimit("Network", ManagementServer.class, Integer.class, "site2site.vpn.vpngateway.connection.limit", "4", "The maximum number of VPN connection per VPN gateway", null),
 	Site2SiteVpnSubnetsPerCustomerGatewayLimit("Network", ManagementServer.class, Integer.class, "site2site.vpn.customergateway.subnets.limit", "10", "The maximum number of subnets per customer gateway", null),
@@ -151,7 +144,6 @@ public enum Config {
     JobCancelThresholdMinutes("Advanced", ManagementServer.class, String.class, "job.cancel.threshold.minutes", "60", "Time (in minutes) for async-jobs to be forcely cancelled if it has been in process for long", null),
     EventPurgeInterval("Advanced", ManagementServer.class, Integer.class, "event.purge.interval", "86400", "The interval (in seconds) to wait before running the event purge thread", null),
 	AccountCleanupInterval("Advanced", ManagementServer.class, Integer.class, "account.cleanup.interval", "86400", "The interval (in seconds) between cleanup for removed accounts", null),
-	AllowPublicUserTemplates("Advanced", ManagementServer.class, Integer.class, "allow.public.user.templates", "true", "If false, users will not be able to create public templates.", null, ConfigurationParameterScope.account.toString()),
 	InstanceName("Advanced", AgentManager.class, String.class, "instance.name", "VM", "Name of the deployment instance.", "instanceName"),
 	ExpungeDelay("Advanced", UserVmManager.class, Integer.class, "expunge.delay", "86400", "Determines how long (in seconds) to wait before actually expunging destroyed vm. The default value = the default value of expunge.interval", null),
 	ExpungeInterval("Advanced", UserVmManager.class, Integer.class, "expunge.interval", "86400", "The interval (in seconds) to wait before running the expunge thread.", null),
@@ -164,29 +156,20 @@ 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),
-    ClusterDeltaSyncInterval("Advanced", AgentManager.class, Integer.class, "sync.interval", "60", "Cluster Delta sync interval in seconds", null),
 	RouterCpuMHz("Advanced", NetworkOrchestrationService.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", NetworkOrchestrationService.class, Integer.class, "router.stats.interval", "300", "Interval (in seconds) to report router statistics.", null),
 	ExternalNetworkStatsInterval("Advanced", NetworkOrchestrationService.class, Integer.class, "external.network.stats.interval", "300", "Interval (in seconds) to report external network statistics.", null),
 	RouterCheckInterval("Advanced", NetworkOrchestrationService.class, Integer.class, "router.check.interval", "30", "Interval (in seconds) to report redundant router status.", null),
 	RouterCheckPoolSize("Advanced", NetworkOrchestrationService.class, Integer.class, "router.check.poolsize", "10", "Numbers of threads using to check redundant router status.", null),
-    RouterTemplateXen("Advanced", NetworkOrchestrationService.class, String.class, "router.template.xen", "SystemVM Template (XenServer)", "Name of the default router template on Xenserver.", null, ConfigurationParameterScope.zone.toString()),
-    RouterTemplateKVM("Advanced", NetworkOrchestrationService.class, String.class, "router.template.kvm", "SystemVM Template (KVM)", "Name of the default router template on KVM.", null, ConfigurationParameterScope.zone.toString()),
-    RouterTemplateVmware("Advanced", NetworkOrchestrationService.class, String.class, "router.template.vmware", "SystemVM Template (vSphere)", "Name of the default router template on Vmware.", null, ConfigurationParameterScope.zone.toString()),
-    RouterTemplateHyperv("Advanced", NetworkOrchestrationService.class, String.class, "router.template.hyperv", "SystemVM Template (HyperV)", "Name of the default router template on Hyperv.", null, ConfigurationParameterScope.zone.toString()),
-    RouterTemplateLXC("Advanced", NetworkOrchestrationService.class, String.class, "router.template.lxc", "SystemVM Template (LXC)", "Name of the default router template on LXC.", null, ConfigurationParameterScope.zone.toString()),
     RouterExtraPublicNics("Advanced", NetworkOrchestrationService.class, Integer.class, "router.extra.public.nics", "2", "specify extra public nics used for virtual router(up to 5)", "0-5"),
-	StartRetry("Advanced", AgentManager.class, Integer.class, "start.retry", "10", "Number of times to retry create and start commands", null),
-    EnableDynamicallyScaleVm("Advanced", ManagementServer.class, Boolean.class, "enable.dynamic.scale.vm", "false", "Enables/Diables dynamically scaling a vm", null, ConfigurationParameterScope.zone.toString()),
     ScaleRetry("Advanced", ManagementServer.class, Integer.class, "scale.retry", "2", "Number of times to retry scaling up the vm", null),
     StopRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "stop.retry.interval", "600", "Time in seconds between retries to stop or destroy a vm" , null),
 	StorageCleanupInterval("Advanced", StorageManager.class, Integer.class, "storage.cleanup.interval", "86400", "The interval (in seconds) to wait before running the storage cleanup thread.", null),
 	StorageCleanupEnabled("Advanced", StorageManager.class, Boolean.class, "storage.cleanup.enabled", "true", "Enables/disables the storage cleanup thread.", null),
 	UpdateWait("Advanced", AgentManager.class, Integer.class, "update.wait", "600", "Time to wait (in seconds) before alerting on a updating agent", null),
-	Wait("Advanced", AgentManager.class, Integer.class, "wait", "1800", "Time in seconds to wait for control commands to return", null),
 	XapiWait("Advanced", AgentManager.class, Integer.class, "xapiwait", "600", "Time (in seconds) to wait for XAPI to return", null),
-	MigrateWait("Advanced", AgentManager.class, Integer.class, "migratewait", "3600", "Time (in seconds) to wait for VM migrate finish", null),
+    MigrateWait("Advanced", AgentManager.class, Integer.class, "migratewait", "3600", "Time (in seconds) to wait for VM migrate finish", null),
 	HAWorkers("Advanced", AgentManager.class, Integer.class, "ha.workers", "5", "Number of ha worker threads.", null),
 	MountParent("Advanced", ManagementServer.class, String.class, "mount.parent", "/var/cloudstack/mnt", "The mount point on the Management Server for Secondary Storage.", null),
 //	UpgradeURL("Advanced", ManagementServer.class, String.class, "upgrade.url", "http://example.com:8080/client/agent/update.zip", "The upgrade URL is the URL of the management server that agents will connect to in order to automatically upgrade.", null),
@@ -194,8 +177,6 @@ public enum Config {
     SystemVMAutoReserveCapacity("Advanced", ManagementServer.class, Boolean.class, "system.vm.auto.reserve.capacity", "true", "Indicates whether or not to automatically reserver system VM standby capacity.", null),
 	SystemVMDefaultHypervisor("Advanced", ManagementServer.class, String.class, "system.vm.default.hypervisor", null, "Hypervisor type used to create system vm", null),
     SystemVMRandomPassword("Advanced", ManagementServer.class, Boolean.class, "system.vm.random.password", "false", "Randomize system vm password the first time management server starts", null),
-	CPUOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "cpu.overprovisioning.factor", "1", "Used for CPU overprovisioning calculation; available CPU will be (actualCpuCapacity * cpu.overprovisioning.factor)", null, ConfigurationParameterScope.cluster.toString()),
-	MemOverprovisioningFactor("Advanced", ManagementServer.class, String.class, "mem.overprovisioning.factor", "1", "Used for memory overprovisioning calculation", null, ConfigurationParameterScope.cluster.toString()),
 	LinkLocalIpNums("Advanced", ManagementServer.class, Integer.class, "linkLocalIp.nums", "10", "The number of link local ip that needed by domR(in power of 2)", null),
 	HypervisorList("Advanced", ManagementServer.class, String.class, "hypervisor.list", HypervisorType.Hyperv + "," + HypervisorType.KVM + "," + HypervisorType.XenServer + "," + HypervisorType.VMware + "," + HypervisorType.BareMetal + "," + HypervisorType.Ovm + "," + HypervisorType.LXC, "The list of hypervisors that this deployment will use.", "hypervisorList"),
 	ManagementHostIPAdr("Advanced", ManagementServer.class, String.class, "host", "localhost", "The ip address of management server", null),
@@ -213,15 +194,6 @@ public enum Config {
     AlertPurgeInterval("Advanced", ManagementServer.class, Integer.class, "alert.purge.interval", "86400", "The interval (in seconds) to wait before running the alert purge thread", null),
     AlertPurgeDelay("Advanced", ManagementServer.class, Integer.class, "alert.purge.delay", "0", "Alerts older than specified number days will be purged. Set this value to 0 to never delete alerts", null),
     HostReservationReleasePeriod("Advanced", ManagementServer.class, Integer.class, "host.reservation.release.period", "300000", "The interval in milliseconds between host reservation release checks", null),
-    UseSystemPublicIps("Advanced", ManagementServer.class, Boolean.class, "use.system.public.ips", "true",
-            "If true, when account has dedicated public ip range(s), once the ips dedicated to the account have been" +
-            " consumed ips will be acquired from the system pool",
-            null, ConfigurationParameterScope.account.toString()),
-    UseSystemGuestVlans("Advanced", ManagementServer.class, Boolean.class, "use.system.guest.vlans", "true",
-                "If true, when account has dedicated guest vlan range(s), once the vlans dedicated to the account have been" +
-                " consumed vlans will be allocated from the system pool",
-                null, ConfigurationParameterScope.account.toString()),
-
     // LB HealthCheck Interval.
     LBHealthCheck("Advanced", ManagementServer.class, String.class, "healthcheck.update.interval", "600",
             "Time Interval to fetch the LB health check states (in sec)", null),
@@ -235,7 +207,6 @@ public enum Config {
 	VmStatsInterval("Advanced", ManagementServer.class, Integer.class, "vm.stats.interval", "60000", "The interval (in milliseconds) when vm stats are retrieved from agents.", null),
 	VmDiskStatsInterval("Advanced", ManagementServer.class, Integer.class, "vm.disk.stats.interval", "0", "Interval (in seconds) to report vm disk statistics.", null),
 	VmTransitionWaitInterval("Advanced", ManagementServer.class, Integer.class, "vm.tranisition.wait.interval", "3600", "Time (in seconds) to wait before taking over a VM in transition state", null),
-	VmDestroyForcestop("Advanced", ManagementServer.class, Boolean.class, "vm.destroy.forcestop", "false", "On destroy, force-stop takes this value ", null),
         VmDiskThrottlingIopsReadRate("Advanced", ManagementServer.class, Integer.class, "vm.disk.throttling.iops_read_rate", "0", "Default disk I/O read rate in requests per second allowed in User vm's disk.", null),
         VmDiskThrottlingIopsWriteRate("Advanced", ManagementServer.class, Integer.class, "vm.disk.throttling.iops_write_rate", "0", "Default disk I/O writerate in requests per second allowed in User vm's disk.", null),
         VmDiskThrottlingBytesReadRate("Advanced", ManagementServer.class, Integer.class, "vm.disk.throttling.bytes_read_rate", "0", "Default disk I/O read rate in bytes per second allowed in User vm's disk.", null),
@@ -328,12 +299,6 @@ public enum Config {
 	EncryptionIV("Hidden", ManagementServer.class, String.class, "security.encryption.iv", null, "base64 encoded IV data", null),
 	RouterRamSize("Hidden", NetworkOrchestrationService.class, Integer.class, "router.ram.size", "128", "Default RAM for router VM (in MB).", null),
 
-	VmOpWaitInterval("Advanced", ManagementServer.class, Integer.class, "vm.op.wait.interval", "120", "Time (in seconds) to wait before checking if a previous operation has succeeded", null),
-	VmOpLockStateRetry("Advanced", ManagementServer.class, Integer.class, "vm.op.lock.state.retry", "5", "Times to retry locking the state of a VM for operations", "-1 means try forever"),
-	VmOpCleanupInterval("Advanced", ManagementServer.class, Long.class, "vm.op.cleanup.interval", "86400", "Interval to run the thread that cleans up the vm operations (in seconds)", "Seconds"),
-	VmOpCleanupWait("Advanced", ManagementServer.class, Long.class, "vm.op.cleanup.wait", "3600", "Time (in seconds) to wait before cleanuping up any vm work items", "Seconds"),
-	VmOpCancelInterval("Advanced", ManagementServer.class, Long.class, "vm.op.cancel.interval", "3600", "Time (in seconds) to wait before cancelling a operation", "Seconds"),
-
 	DefaultPageSize("Advanced", ManagementServer.class, Long.class, "default.page.size", "500", "Default page size for API list* commands", null),
 
 	TaskCleanupRetryInterval("Advanced", ManagementServer.class, Integer.class, "task.cleanup.retry.interval", "600", "Time (in seconds) to wait before retrying cleanup of tasks if the cleanup failed previously.  0 means to never retry.", "Seconds"),
@@ -355,7 +320,6 @@ public enum Config {
 
 	//disabling lb as cluster sync does not work with distributed cluster
 	SubDomainNetworkAccess("Advanced", NetworkOrchestrationService.class, Boolean.class, "allow.subdomain.network.access", "true", "Allow subdomains to use networks dedicated to their parent domain(s)", null),
-	UseExternalDnsServers("Advanced", NetworkOrchestrationService.class, Boolean.class, "use.external.dns", "false", "Bypass internal dns, use external dns1 and dns2", null, ConfigurationParameterScope.zone.toString()),
 	EncodeApiResponse("Advanced", ManagementServer.class, Boolean.class, "encode.api.response", "false", "Do URL encoding for the api response, false by default", null),
 	DnsBasicZoneUpdates("Advanced", NetworkOrchestrationService.class, String.class, "network.dns.basiczone.updates", "all", "This parameter can take 2 values: all (default) and pod. It defines if DHCP/DNS requests have to be send to all dhcp servers in cloudstack, or only to the one in the same pod", "all,pod"),
 
@@ -436,8 +400,7 @@ public enum Config {
     CloudDnsName("Advanced", ManagementServer.class, String.class, "cloud.dns.name", null, "DNS name of the cloud for the GSLB service", null),
 
     BlacklistedRoutes("Advanced", VpcManager.class, String.class, "blacklisted.routes", null, "Routes that are blacklisted, can not be used for Static Routes creation for the VPC Private Gateway",
-	           "routes", ConfigurationParameterScope.zone.toString()),
-
+	           "routes", ConfigKey.Scope.Zone.toString()),
     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),
@@ -455,21 +418,13 @@ public enum Config {
     private final String _range;
     private final String _scope; // Parameter can be at different levels (Zone/cluster/pool/account), by default every parameter is at global
 
-    public static enum ConfigurationParameterScope {
-        global,
-        zone,
-        cluster,
-        storagepool,
-        account
-    }
-
     private static final HashMap<String, List<Config>> _scopeLevelConfigsMap = new HashMap<String, List<Config>>();
     static {
-        _scopeLevelConfigsMap.put(ConfigurationParameterScope.zone.toString(), new ArrayList<Config>());
-        _scopeLevelConfigsMap.put(ConfigurationParameterScope.cluster.toString(), new ArrayList<Config>());
-        _scopeLevelConfigsMap.put(ConfigurationParameterScope.storagepool.toString(), new ArrayList<Config>());
-        _scopeLevelConfigsMap.put(ConfigurationParameterScope.account.toString(), new ArrayList<Config>());
-        _scopeLevelConfigsMap.put(ConfigurationParameterScope.global.toString(), new ArrayList<Config>());
+        _scopeLevelConfigsMap.put(ConfigKey.Scope.Zone.toString(), new ArrayList<Config>());
+        _scopeLevelConfigsMap.put(ConfigKey.Scope.Cluster.toString(), new ArrayList<Config>());
+        _scopeLevelConfigsMap.put(ConfigKey.Scope.StoragePool.toString(), new ArrayList<Config>());
+        _scopeLevelConfigsMap.put(ConfigKey.Scope.Account.toString(), new ArrayList<Config>());
+        _scopeLevelConfigsMap.put(ConfigKey.Scope.Global.toString(), new ArrayList<Config>());
 
         for (Config c : Config.values()) {
             //Creating group of parameters per each level (zone/cluster/pool/account)
@@ -517,7 +472,7 @@ public enum Config {
     	_defaultValue = defaultValue;
     	_description = description;
     	_range = range;
-        _scope = ConfigurationParameterScope.global.toString();
+        _scope = ConfigKey.Scope.Global.toString();
     }
     private Config(String category, Class<?> componentClass, Class<?> type, String name, String defaultValue, String description, String range, String scope) {
         _category = category;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/435e74e9/server/src/com/cloud/configuration/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManager.java b/server/src/com/cloud/configuration/ConfigurationManager.java
deleted file mode 100755
index 6e76b6f..0000000
--- a/server/src/com/cloud/configuration/ConfigurationManager.java
+++ /dev/null
@@ -1,242 +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.configuration;
-
-import java.util.Map;
-import java.util.Set;
-
-import com.cloud.dc.ClusterVO;
-import com.cloud.dc.DataCenter;
-import com.cloud.dc.DataCenter.NetworkType;
-import com.cloud.dc.DataCenterVO;
-import com.cloud.dc.HostPodVO;
-import com.cloud.dc.Pod;
-import com.cloud.dc.Vlan;
-import com.cloud.exception.ConcurrentOperationException;
-import com.cloud.exception.InsufficientCapacityException;
-import com.cloud.exception.InvalidParameterValueException;
-import com.cloud.network.Network;
-import com.cloud.network.Network.Capability;
-import com.cloud.network.Network.Provider;
-import com.cloud.network.Network.Service;
-import com.cloud.network.Networks.TrafficType;
-import com.cloud.offering.DiskOffering;
-import com.cloud.offering.NetworkOffering;
-import com.cloud.offering.NetworkOffering.Availability;
-import com.cloud.offerings.NetworkOfferingVO;
-import com.cloud.org.Grouping.AllocationState;
-import com.cloud.service.ServiceOfferingVO;
-import com.cloud.storage.DiskOfferingVO;
-import com.cloud.user.Account;
-import com.cloud.vm.VirtualMachine;
-
-/**
- * ConfigurationManager handles adding pods/zones, changing IP ranges, enabling external firewalls, and editing
- * configuration values
- * 
- */
-public interface ConfigurationManager {
-    /**
-     * @param offering
-     * @return
-     */
-    boolean isOfferingForVpc(NetworkOffering offering);
-
-    Integer getNetworkOfferingNetworkRate(long networkOfferingId, Long dataCenterId);
-
-    Integer getServiceOfferingNetworkRate(long serviceOfferingId, Long dataCenterId);
-
-    /**
-     * Updates a configuration entry with a new value
-     * 
-     * @param userId
-     * @param name
-     * @param value
-     */
-    String updateConfiguration(long userId, String name, String category, String value, String scope, Long id);
-
-    /**
-     * Creates a new service offering
-     * 
-     * @param name
-     * @param cpu
-     * @param ramSize
-     * @param speed
-     * @param displayText
-     * @param localStorageRequired
-     * @param offerHA
-     * @param domainId
-     * @param volatileVm
-     * @param hostTag
-     * @param networkRate
-     *            TODO
-     * @param id
-     * @param useVirtualNetwork
-     * @param deploymentPlanner
-     * @param details
-     * @param bytesReadRate
-     * @param bytesWriteRate
-     * @param iopsReadRate
-     * @param iopsWriteRate
-     * @return ID
-     */
-    ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
-            boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag, Integer networkRate, String deploymentPlanner, Map<String, String> details,
-            Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate);
-
-    /**
-     * Creates a new disk offering
-     * 
-     * @param domainId
-     * @param name
-     * @param description
-     * @param numGibibytes
-     * @param tags
-     * @param isCustomized
-     * @param localStorageRequired
-     * @param isDisplayOfferingEnabled
-     * @param isCustomizedIops (is admin allowing users to set custom iops?)
-     * @param minIops
-     * @param maxIops
-     * @param bytesReadRate
-     * @param bytesWriteRate
-     * @param iopsReadRate
-     * @param iopsWriteRate
-     * @return newly created disk offering
-     */
-    DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized,
-    		boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops,
-    		Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate);
-
-    /**
-     * Creates a new pod
-     * 
-     * @param userId
-     * @param podName
-     * @param zoneId
-     * @param gateway
-     * @param cidr
-     * @param startIp
-     * @param endIp
-     * @param allocationState
-     * @param skipGatewayOverlapCheck
-     *            (true if it is ok to not validate that gateway IP address overlap with Start/End IP of the POD)
-     * @return Pod
-     */
-    HostPodVO createPod(long userId, String podName, long zoneId, String gateway, String cidr, String startIp, String endIp, String allocationState, boolean skipGatewayOverlapCheck);
-
-    /**
-     * Creates a new zone
-     * 
-     * @param userId
-     * @param zoneName
-     * @param dns1
-     * @param dns2
-     * @param internalDns1
-     * @param internalDns2
-     * @param guestCidr
-     * @param zoneType
-     * @param allocationState
-     * @param networkDomain
-     *            TODO
-     * @param isSecurityGroupEnabled
-     *            TODO
-     * @param ip6Dns1 TODO
-     * @param ip6Dns2 TODO
-     * @return
-     * @throws
-     * @throws
-     */
-    DataCenterVO createZone(long userId, String zoneName, String dns1, String dns2, String internalDns1, String internalDns2, String guestCidr, String domain, Long domainId, NetworkType zoneType, String allocationState,
-            String networkDomain, boolean isSecurityGroupEnabled, boolean isLocalStorageEnabled, String ip6Dns1, String ip6Dns2);
-
-    /**
-     * Deletes a VLAN from the database, along with all of its IP addresses. Will not delete VLANs that have allocated
-     * IP addresses.
-     * 
-     * @param userId
-     * @param vlanDbId
-     * @param caller TODO
-     * @return success/failure
-     */
-    boolean deleteVlanAndPublicIpRange(long userId, long vlanDbId, Account caller);
-
-    void checkZoneAccess(Account caller, DataCenter zone);
-
-    void checkDiskOfferingAccess(Account caller, DiskOffering dof);
-
-    /**
-     * Creates a new network offering
-     * @param name
-     * @param displayText
-     * @param trafficType
-     * @param tags
-     * @param specifyVlan
-     * @param networkRate
-     *            TODO
-     * @param serviceProviderMap
-     *            TODO
-     * @param isDefault
-     *            TODO
-     * @param type
-     *            TODO
-     * @param systemOnly
-     *            TODO
-     * @param serviceOfferingId
-     * @param conserveMode
-     *            ;
-     * @param specifyIpRanges
-     *            TODO
-     * @param isPersistent
-     *            ;
-     * @param details TODO
-     * @param id
-     * @return network offering object
-     */
-
-    NetworkOfferingVO createNetworkOffering(String name, String displayText, TrafficType trafficType, String tags, boolean specifyVlan, Availability availability, Integer networkRate, Map<Service, Set<Provider>> serviceProviderMap,
-            boolean isDefault, Network.GuestType type, boolean systemOnly, Long serviceOfferingId, boolean conserveMode, Map<Service, Map<Capability, String>> serviceCapabilityMap,
-            boolean specifyIpRanges, boolean isPersistent, Map<NetworkOffering.Detail,String> details, boolean egressDefaultPolicy, Integer maxconn);
-
-    Vlan createVlanAndPublicIpRange(long zoneId, long networkId, long physicalNetworkId, boolean forVirtualNetwork, Long podId, String startIP, String endIP, String vlanGateway, String vlanNetmask, String vlanId, Account vlanOwner, String startIPv6, String endIPv6, String vlanIp6Gateway, String vlanIp6Cidr) throws InsufficientCapacityException, ConcurrentOperationException, InvalidParameterValueException;
-
-    void createDefaultSystemNetworks(long zoneId) throws ConcurrentOperationException;
-
-    boolean releaseAccountSpecificVirtualRanges(long accountId);
-
-    /**
-     * Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system.
-     * 
-     * @param id
-     * @param name
-     * @param startIp
-     * @param endIp
-     * @param gateway
-     * @param netmask
-     * @param allocationState
-     * @return Pod
-     * @throws
-     * @throws
-     */
-    Pod editPod(long id, String name, String startIp, String endIp, String gateway, String netmask, String allocationStateStr);
-
-    void checkPodCidrSubnets(long zoneId, Long podIdToBeSkipped, String cidr);
-
-	AllocationState findPodAllocationState(HostPodVO pod);
-
-	AllocationState findClusterAllocationState(ClusterVO cluster);
-}


Mime
View raw message