You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ni...@apache.org on 2013/06/24 16:30:22 UTC
git commit: updated refs/heads/master to f7b1d3d
Updated Branches:
refs/heads/master da0006618 -> f7b1d3d8d
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<ni...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f7b1d3d8
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f7b1d3d8
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f7b1d3d8
Branch: refs/heads/master
Commit: f7b1d3d8d5be58a8032fc79eec4dd5711226b93a
Parents: da00066
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Mon Jun 24 19:57:29 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Mon Jun 24 20:00:09 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/f7b1d3d8/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 89a640d..704162e 100755
--- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
+++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java
@@ -324,6 +324,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 {
@@ -336,6 +337,7 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
Long.parseLong(Config.DefaultPageSize.getDefaultValue()));
populateConfigValuesForValidationSet();
+ weightBasedParametersForValidation();
return true;
}
@@ -361,6 +363,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() {
@@ -733,6 +757,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/f7b1d3d8/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 b23ddd1..fd8d61e 100644
--- a/test/integration/smoke/test_scale_vm.py
+++ b/test/integration/smoke/test_scale_vm.py
@@ -142,7 +142,7 @@ class TestScaleVm(cloudstackTestCase):
#how does it work ??
cls._cleanup = [
cls.small_offering,
- cls.account
+ #cls.account
]
@classmethod
@@ -170,9 +170,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()
@@ -204,6 +205,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,