CLOUDSTACK-9603: concurrent.snapshots.threshold.perhost does not validate value given.

This commit is contained in:
Priyank Parihar 2016-09-06 23:11:06 +05:30
parent cd68e99148
commit f2a159fb5d
2 changed files with 16 additions and 0 deletions

View File

@ -749,6 +749,9 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati
} else if (type.equals(Float.class)) {
errMsg = "There was error in trying to parse value: " + value + ". Please enter a valid float value for parameter " + name;
Float.parseFloat(value);
} else if (type.equals(Long.class)) {
errMsg = "There was error in trying to parse value: " + value + ". Please enter a valid long value for parameter " + name;
Long.parseLong(value);
}
} catch (final Exception e) {
// catching generic exception as some throws NullPointerException and some throws NumberFormatExcpeion

View File

@ -297,3 +297,16 @@ class TestConcurrentSnapshotLimit(cloudstackTestCase):
more than concurrent.snapshots.threshold.perhost\
value successfully created")
return
@attr(tags=["advanced", "basic"], required_hardware="false")
def test_03_concurrent_snapshot_global_value_assignment(self):
""" Test verifies that exception is raised if string value is assigned to
concurrent.snapshots.threshold.perhost parameter.
"""
with self.assertRaises(Exception):
Configurations.update(
self.apiclient,
"concurrent.snapshots.threshold.perhost",
"String"
)
return