You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2014/11/24 19:26:02 UTC

[06/13] git commit: updated refs/heads/4.3 to 15ded4f

CLOUDSTACK-5992: default values of configuraiton parameters in configuration table are set NULL on fresh setup Some configuration parameters have Component names different from fresh and upgrade setup

Signed-off-by: Rajani Karuturi <ra...@gmail.com>
(cherry picked from commit 5d389b1a711bff0a2c7959a824e28d54b56f9e89)
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>

Conflicts:
	framework/config/src/org/apache/cloudstack/framework/config/impl/ConfigDepotImpl.java


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

Branch: refs/heads/4.3
Commit: 122332b3266339fd257d787635413e3ab3445642
Parents: e25690c
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Thu Jan 30 17:14:27 2014 +0530
Committer: Rohit Yadav <ro...@shapeblue.com>
Committed: Mon Nov 24 21:13:14 2014 +0530

----------------------------------------------------------------------
 .../framework/config/impl/ConfigDepotImpl.java  | 24 ++++++++++++++++++++
 .../cloud/server/ConfigurationServerImpl.java   |  1 +
 2 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/122332b3/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 4cefdaf..25c5d50 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
@@ -142,6 +142,30 @@ public class ConfigDepotImpl implements ConfigDepot, ConfigDepotAdmin {
         _configured.add(configurable);
     }
 
+    private void createOrupdateConfigObject(Date date, String componentName, ConfigKey<?> key, String value) {
+        ConfigurationVO vo = _configDao.findById(key.key());
+        if (vo == null) {
+            vo = new ConfigurationVO(componentName, key);
+            vo.setUpdated(date);
+            if (value != null) {
+                vo.setValue(value);
+            }
+            _configDao.persist(vo);
+        } else {
+            if (vo.isDynamic() != key.isDynamic() || !ObjectUtils.equals(vo.getDescription(), key.description()) || !ObjectUtils.equals(vo.getDefaultValue(), key.defaultValue()) ||
+                !ObjectUtils.equals(vo.getScope(), key.scope().toString()) ||
+                !ObjectUtils.equals(vo.getComponent(), componentName)) {
+                vo.setDynamic(key.isDynamic());
+                vo.setDescription(key.description());
+                vo.setDefaultValue(key.defaultValue());
+                vo.setScope(key.scope().toString());
+                vo.setComponent(componentName);
+                vo.setUpdated(date);
+                _configDao.persist(vo);
+            }
+        }
+    }
+
     @Override
     public void populateConfiguration(Configurable configurable) {
         populateConfiguration(new Date(), configurable);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/122332b3/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 7c6743a..c204b4d 100755
--- a/server/src/com/cloud/server/ConfigurationServerImpl.java
+++ b/server/src/com/cloud/server/ConfigurationServerImpl.java
@@ -193,6 +193,7 @@ public class ConfigurationServerImpl extends ManagerBase implements Configuratio
                     value = ("Hidden".equals(category) || "Secure".equals(category)) ? DBEncryptionUtil.encrypt(value) : value;
                     String description = c.getDescription();
                     ConfigurationVO configVO = new ConfigurationVO(category, instance, component, name, value, description);
+                    configVO.setDefaultValue(value);
                     _configDao.persist(configVO);
                 }
             }