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:15:10 UTC
git commit: updated refs/heads/4.3 to bae5be7
Updated Branches:
refs/heads/4.3 b763e4987 -> bae5be7f4
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.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/bae5be7f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/bae5be7f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/bae5be7f
Branch: refs/heads/4.3
Commit: bae5be7f4edad6954e5c3ccef5b70803aa8df141
Parents: b763e49
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Thu Jan 2 15:39:11 2014 +0530
Committer: Koushik Das <ko...@apache.org>
Committed: Thu Jan 2 15:43:47 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/bae5be7f/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 22452b9..6dd1360 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/bae5be7f/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 305d286..4cefdaf 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
@@ -76,14 +76,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 {
} 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/bae5be7f/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 4020926..7c6743a 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;
@@ -772,7 +773,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/bae5be7f/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 e98c97a..d81e847 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -42,6 +42,7 @@ import javax.crypto.spec.SecretKeySpec;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
+import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger;
@@ -713,6 +714,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Inject
ConfigurationServer _configServer;
@Inject
+ ConfigDepot _configDepot;
+ @Inject
UserVmManager _userVmMgr;
@Inject
VolumeDataFactory _volFactory;
@@ -1680,15 +1683,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 + "%");
@@ -1712,7 +1706,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/bae5be7f/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 1592910..85322f2 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;