CLOUDSTACK-7219: Fix NPE, log warning when config item is missing from scope

- Cherry picked from Daan's fix 63fbd16dd11388bd93cdbec4ea7fe6de37aa7fc5
- Added another check if configDepot returned null
- Removed developer prefill values

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 188924751ed87a01541a094e03e958cd8d01653b)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2014-10-02 11:58:20 +02:00
parent 3fddfe0e10
commit 71a0148565
2 changed files with 12 additions and 19 deletions

View File

@ -62,22 +62,6 @@ INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
VALUES ('Advanced', 'DEFAULT', 'management-server',
'expunge.interval', '60');
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
VALUES ('Advanced', 'DEFAULT', 'management-server',
'cluster.cpu.allocated.capacity.disablethreshold', '0.95');
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
VALUES ('Advanced', 'DEFAULT', 'management-server',
'cluster.memory.allocated.capacity.disablethreshold ', '0.95');
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
VALUES ('Advanced', 'DEFAULT', 'management-server',
'pool.storage.allocated.capacity.disablethreshold ', '0.95');
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
VALUES ('Advanced', 'DEFAULT', 'management-server',
'pool.storage.capacity.disablethreshold ', '0.95');
-- Add developer configuration entry; allows management server to be run as a user other than "cloud"
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
VALUES ('Advanced', 'DEFAULT', 'management-server',

View File

@ -1709,9 +1709,18 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
List<ConfigurationVO> configVOList = new ArrayList<ConfigurationVO>();
for (ConfigurationVO param : result.first()) {
ConfigurationVO configVo = _configDao.findByName(param.getName());
configVo.setValue(_configDepot.get(param.getName()).valueIn(id).toString());
configVOList.add(configVo);
}
if (configVo != null) {
ConfigKey<?> key = _configDepot.get(param.getName());
if (key != null) {
configVo.setValue(key.valueIn(id).toString());
configVOList.add(configVo);
} else {
s_logger.warn("ConfigDepot could not find parameter " + param.getName() + " for scope " + scope);
}
} else {
s_logger.warn("Configuration item " + param.getName() + " not found in " + scope);
}
}
return new Pair<List<? extends Configuration>, Integer>(configVOList, configVOList.size());
}