cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/master-6-17-stable to 3c214ab
Date Mon, 24 Jun 2013 14:29:44 GMT
Updated Branches:
  refs/heads/master-6-17-stable 0d841971b -> 3c214aba9


CLOUDSTACK-2916: admin is not able to login through UI after setting GP "cluster.cpu.allocated.capacity.notificationthreshold"
to some string
CLOUDSTACK-2457:  No check for input values,special character,-ive values can be assigne to
GLobal parameter "cluster.cpu.allocated.capacity.disablethreshold"

Added validation for float values and checking limit for weight based parameters by creating
a set of parameters.
Signed off by : nitin mehta<nitin.mehta@citrix.com>


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

Branch: refs/heads/master-6-17-stable
Commit: 3c214aba97fc5e7507fe2e175f5f7a0f745557fe
Parents: 0d84197
Author: Harikrishna Patnala <harikrishna.patnala@citrix.com>
Authored: Mon Jun 24 19:57:29 2013 +0530
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Mon Jun 24 19:59:17 2013 +0530

----------------------------------------------------------------------
 .../configuration/ConfigurationManagerImpl.java | 36 ++++++++++++++++++++
 test/integration/smoke/test_scale_vm.py         | 13 +++++--
 2 files changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3c214aba/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
index 60e23e5..9c5f135 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -323,6 +323,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
     private int _maxVolumeSizeInGb = Integer.parseInt(Config.MaxVolumeSize.getDefaultValue());
     private long _defaultPageSize = Long.parseLong(Config.DefaultPageSize.getDefaultValue());
     protected Set<String> configValuesForValidation;
+    private Set<String> weightBasedParametersForValidation;
 
     @Override
     public boolean configure(final String name, final Map<String, Object> params) throws
ConfigurationException {
@@ -335,6 +336,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
         	Long.parseLong(Config.DefaultPageSize.getDefaultValue()));
 
         populateConfigValuesForValidationSet();
+        weightBasedParametersForValidation();
         return true;
     }
 
@@ -360,6 +362,28 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
         configValuesForValidation.add("incorrect.login.attempts.allowed");
     }
 
+    private void weightBasedParametersForValidation() {
+        weightBasedParametersForValidation = new HashSet<String>();
+        weightBasedParametersForValidation.add(Config.CPUCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.StorageAllocatedCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.StorageCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.MemoryCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.PublicIpCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.PrivateIpCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.SecondaryStorageCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.VlanCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.DirectNetworkPublicIpCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.LocalStorageCapacityThreshold.key());
+        weightBasedParametersForValidation.add(Config.StorageAllocatedCapacityDisableThreshold.key());
+        weightBasedParametersForValidation.add(Config.StorageCapacityDisableThreshold.key());
+        weightBasedParametersForValidation.add(Config.CPUCapacityDisableThreshold.key());
+        weightBasedParametersForValidation.add(Config.MemoryCapacityDisableThreshold.key());
+        weightBasedParametersForValidation.add(Config.AgentLoadThreshold.key());
+        weightBasedParametersForValidation.add(Config.VmUserDispersionWeight.key());
+
+
+    }
+
     @Override
     public boolean start() {
 
@@ -692,6 +716,18 @@ public class ConfigurationManagerImpl extends ManagerBase implements
Configurati
             }
         }
 
+        if (type.equals(Float.class)) {
+            try {
+                Float val = Float.parseFloat(value);
+                if (weightBasedParametersForValidation.contains(name) && (val <
0f || val > 1f)) {
+                    throw new InvalidParameterValueException("Please enter a value between
0 and 1 for the configuration parameter: "+ name);
+                }
+            } catch (NumberFormatException e) {
+                s_logger.error("There was an error trying to parse the float value for:"
+ name);
+                throw new InvalidParameterValueException("There was an error trying to parse
the float value for:" + name);
+            }
+        }
+
         String range = c.getRange();
         if (range == null) {
             return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3c214aba/test/integration/smoke/test_scale_vm.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_scale_vm.py b/test/integration/smoke/test_scale_vm.py
index fa2418b..e79e126 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -145,7 +145,7 @@ class TestScaleVm(cloudstackTestCase):
         #how does it work ??
         cls._cleanup = [
                         cls.small_offering,
-                        cls.account
+                        #cls.account
                         ]
 
     @classmethod
@@ -173,9 +173,10 @@ class TestScaleVm(cloudstackTestCase):
         
       
       
-        self.debug("Scaling VM-ID: %s to service offering: %s" % (
+        self.debug("Scaling VM-ID: %s to service offering: %s and state %s" % (
                                         self.virtual_machine.id,
-                                        self.big_offering.id
+                                        self.big_offering.id,
+					self.virtual_machine.state
                                         ))
         
         cmd = scaleVirtualMachine.scaleVirtualMachineCmd()
@@ -207,6 +208,12 @@ class TestScaleVm(cloudstackTestCase):
                         "Check virtual machine ID of scaled VM"
                         )
 
+        self.debug("Scaling VM-ID: %s from service offering: %s to new service offering %s
and the response says %s" % (
+                                        self.virtual_machine.id,
+					self.virtual_machine.serviceofferingid,
+                                        self.big_offering.id,
+					vm_response.serviceofferingid
+                                        ))
         self.assertEqual(
                         vm_response.serviceofferingid,
                         self.big_offering.id,


Mime
View raw message