You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2014/01/02 11:55:33 UTC
git commit: updated refs/heads/master to fd0fabd
Updated Branches:
refs/heads/master 619674e21 -> fd0fabd3e
CLOUDSTACK-5551: Search not working for Configuration parameters in (Account/zone/cluster/storage) settings page
Added filters while listing scoped configuration parameters.
Fixed: Some parameters are missing from UI settings tab because of missing scope entry in configuration table.
Signed-off-by: Koushik Das <ko...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/fd0fabd3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/fd0fabd3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/fd0fabd3
Branch: refs/heads/master
Commit: fd0fabd3e24adb6cea4b7ae2fe771f0422b3cd12
Parents: 619674e
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Thu Jan 2 14:12:43 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Thu Jan 2 16:18:21 2014 +0530
----------------------------------------------------------------------
.../framework/config/ConfigDepot.java | 4 +--
.../framework/config/impl/ConfigDepotImpl.java | 20 ++++++------
.../cloud/server/ConfigurationServerImpl.java | 3 +-
.../com/cloud/server/ManagementServerImpl.java | 33 ++++++++++++++------
server/src/com/cloud/vm/UserVmManager.java | 2 +-
5 files changed, 40 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd0fabd3/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 8592745..7df0049 100644
--- a/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
+++ b/framework/config/src/org/apache/cloudstack/framework/config/ConfigDepot.java
@@ -16,7 +16,7 @@
// under the License.
package org.apache.cloudstack.framework.config;
-import java.util.List;
+import java.util.Set;
/**
* ConfigDepot is a repository of configurations.
@@ -26,5 +26,5 @@ public interface ConfigDepot {
ConfigKey<?> get(String paramName);
- List<ConfigKey<?>> getConfigListByScope(String scope);
+ Set<ConfigKey<?>> getConfigListByScope(String scope);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd0fabd3/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 15933de..2f6e524 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
@@ -77,14 +77,14 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
HashMap<String, Pair<String, ConfigKey<?>>> _allKeys = new HashMap<String, Pair<String, ConfigKey<?>>>(1007);
- HashMap<ConfigKey.Scope, List<ConfigKey<?>>> _scopeLevelConfigsMap = new HashMap<ConfigKey.Scope, List<ConfigKey<?>>>();
+ HashMap<ConfigKey.Scope, Set<ConfigKey<?>>> _scopeLevelConfigsMap = new HashMap<ConfigKey.Scope, Set<ConfigKey<?>>>();
public ConfigDepotImpl() {
ConfigKey.init(this);
- _scopeLevelConfigsMap.put(ConfigKey.Scope.Zone, new ArrayList<ConfigKey<?>>());
- _scopeLevelConfigsMap.put(ConfigKey.Scope.Cluster, new ArrayList<ConfigKey<?>>());
- _scopeLevelConfigsMap.put(ConfigKey.Scope.StoragePool, new ArrayList<ConfigKey<?>>());
- _scopeLevelConfigsMap.put(ConfigKey.Scope.Account, new ArrayList<ConfigKey<?>>());
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.Zone, new HashSet<ConfigKey<?>>());
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.Cluster, new HashSet<ConfigKey<?>>());
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.StoragePool, new HashSet<ConfigKey<?>>());
+ _scopeLevelConfigsMap.put(ConfigKey.Scope.Account, new HashSet<ConfigKey<?>>());
}
@Override
@@ -123,16 +123,18 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
_configDao.persist(vo);
} else {
if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(), key.description()) ||
- !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue())) {
+ !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) ||
+ !ObjectUtils.equals(vo.getScope(), key.scope().toString())) {
vo.setDynamic(key.isDynamic());
vo.setDescription(key.description());
vo.setDefaultValue(key.defaultValue());
+ vo.setScope(key.scope().toString());
vo.setUpdated(date);
_configDao.persist(vo);
}
}
- if (key.scope() != ConfigKey.Scope.Global) {
- List<ConfigKey<?>> currentConfigs = _scopeLevelConfigsMap.get(key.scope());
+ if ((key.scope() != null) && (key.scope() != ConfigKey.Scope.Global)) {
+ Set<ConfigKey<?>> currentConfigs = _scopeLevelConfigsMap.get(key.scope());
currentConfigs.add(key);
}
}
@@ -183,7 +185,7 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
}
@Override
- public List<ConfigKey<?>> getConfigListByScope(String scope) {
+ public Set<ConfigKey<?>> getConfigListByScope(String scope) {
return _scopeLevelConfigsMap.get(ConfigKey.Scope.valueOf(scope));
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd0fabd3/server/src/com/cloud/server/ConfigurationServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java
index 6cddc71..b46708d 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -32,6 +32,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.Set;
import java.util.Map;
import java.util.Properties;
import java.util.UUID;
@@ -801,7 +802,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
public List<ConfigurationVO> getConfigListByScope(String scope, Long resourceId) {
// Getting the list of parameters defined at the scope
- List<ConfigKey<?>> configList = _configDepot.getConfigListByScope(scope);
+ Set<ConfigKey<?>> configList = _configDepot.getConfigListByScope(scope);
List<ConfigurationVO> configVOList = new ArrayList<ConfigurationVO>();
for (ConfigKey<?> param : configList) {
ConfigurationVO configVo = _configDao.findByName(param.toString());
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd0fabd3/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java b/server/src/com/cloud/server/ManagementServerImpl.java
index de07a9d..168d83d 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -44,6 +44,7 @@ import javax.naming.ConfigurationException;
import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao;
+import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
@@ -714,6 +715,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Inject
ConfigurationServer _configServer;
@Inject
+ ConfigDepot _configDepot;
+ @Inject
UserVmManager _userVmMgr;
@Inject
VolumeDataFactory _volFactory;
@@ -1649,15 +1652,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
throw new InvalidParameterValueException("cannot handle multiple IDs, provide only one ID corresponding to the scope");
}
- if (scope != null && !scope.isEmpty()) {
- // getting the list of parameters at requested scope
- if (id == null) {
- throw new InvalidParameterValueException("Invalid id null, id is needed corresponding to the scope");
- }
- List<ConfigurationVO> configList = _configServer.getConfigListByScope(scope, id);
- return new Pair<List<? extends Configuration>, Integer>(configList, configList.size());
- }
-
if (keyword != null) {
SearchCriteria<ConfigurationVO> ssc = _configDao.createSearchCriteria();
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
@@ -1681,7 +1675,28 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
// hidden configurations are not displayed using the search API
sc.addAnd("category", SearchCriteria.Op.NEQ, "Hidden");
+ if (scope != null && !scope.isEmpty()) {
+ // getting the list of parameters at requested scope
+ if (id == null) {
+ throw new InvalidParameterValueException("Invalid id null, id is needed corresponding to the scope");
+ }
+ sc.addAnd("scope", SearchCriteria.Op.EQ, scope);
+ }
+
Pair<List<ConfigurationVO>, Integer> result = _configDao.searchAndCount(sc, searchFilter);
+
+ if (scope != null && !scope.isEmpty()) {
+ // Populate values corresponding the resource id
+ List<ConfigurationVO> configVOList = new ArrayList<ConfigurationVO>();
+ for (ConfigurationVO param: result.first()){
+ ConfigurationVO configVo = _configDao.findByName(param.getName());
+ configVo.setValue(_configDepot.get(param.getName()).valueIn(id).toString());
+ configVOList.add(configVo);
+ }
+
+ return new Pair<List<? extends Configuration>, Integer>(configVOList, configVOList.size());
+ }
+
return new Pair<List<? extends Configuration>, Integer>(result.first(), result.second());
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/fd0fabd3/server/src/com/cloud/vm/UserVmManager.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManager.java b/server/src/com/cloud/vm/UserVmManager.java
index 6043491..950e7e3 100755
--- a/server/src/com/cloud/vm/UserVmManager.java
+++ b/server/src/com/cloud/vm/UserVmManager.java
@@ -46,7 +46,7 @@ import com.cloud.utils.Pair;
public interface UserVmManager extends UserVmService {
static final String EnableDynamicallyScaleVmCK = "enable.dynamic.scale.vm";
static final ConfigKey<Boolean> EnableDynamicallyScaleVm = new ConfigKey<Boolean>("Advanced", Boolean.class, EnableDynamicallyScaleVmCK, "false",
- "Enables/Diables dynamically scaling a vm", true, ConfigKey.Scope.Zone);
+ "Enables/Disables dynamically scaling a vm", true, ConfigKey.Scope.Zone);
static final int MAX_USER_DATA_LENGTH_BYTES = 2048;