Merge pull request #1776 from priyankparihar/CLOUDSTACK-9603

CLOUDSTACK-9603: 'concurrent.snapshots.threshold.perhost' parameter should not accept String.
This commit is contained in:
Rajani Karuturi 2017-06-06 16:06:17 +05:30 committed by GitHub
commit 2734e9ec94
2 changed files with 16 additions and 0 deletions

View File

@ -752,6 +752,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