private void overProvisioningFactorsForValidation() { overprovisioningFactorsForValidation = new HashSet<String>(); overprovisioningFactorsForValidation.add(CapacityManager.MemOverprovisioningFactor.key()); overprovisioningFactorsForValidation.add(CapacityManager.CpuOverprovisioningFactor.key()); overprovisioningFactorsForValidation.add(CapacityManager.StorageOverprovisioningFactor.key()); }
@Override public <T> void set(ConfigKey<T> key, T value) { _configDao.update(key.key(), value.toString()); }
public List<String> getGatewaySystemIds() { String gatewaySystemIds = String.valueOf(_configDao.getValue(NuageVspManager.NuageVspConfigGateway.key())); if (!Strings.isNullOrEmpty(gatewaySystemIds)) { return Lists.newArrayList(gatewaySystemIds.split(",")); } return Lists.newArrayList(); }
private org.apache.cloudstack.agent.lb.IndirectAgentLBAlgorithm getAgentMSLBAlgorithm() { final String algorithm = getLBAlgorithmName(); if (algorithmMap.containsKey(algorithm)) { return algorithmMap.get(algorithm); } throw new CloudRuntimeException(String.format("Algorithm configured for '%s' not found, valid values are: %s", IndirectAgentLBAlgorithm.key(), algorithmMap.keySet())); }
@Override public boolean start() { final int netGcInterval = NumbersUtil.parseInt(_configDao.getValue(NetworkGcInterval.key()), 60); s_logger.info("Network Manager will run the NetworkGarbageCollector every '" + netGcInterval + "' seconds."); _executor.scheduleWithFixedDelay(new NetworkGarbageCollector(), netGcInterval, netGcInterval, TimeUnit.SECONDS); return true; }
@Override public String getConfigValue(long id, ConfigKey<?> key) { AccountDetailVO vo = findDetail(id, key.key()); return vo == null ? null : vo.getValue(); } }
@Override public String getConfigValue(long id, ConfigKey<?> key) { DomainDetailVO vo = findDetail(id, key.key()); return vo == null ? null : vo.getValue(); } }
@Override public String getConfigValue(long id, ConfigKey<?> key) { StoragePoolDetailVO vo = findDetail(id, key.key()); return vo == null ? null : vo.getValue(); }
@Override public String getConfigValue(long id, ConfigKey<?> key) { ClusterDetailsVO vo = findDetail(id, key.key()); return vo == null ? null : vo.getValue(); }
@Override public String getConfigValue(long id, ConfigKey<?> key) { ResourceDetail vo = findDetail(id, key.key()); return vo == null ? null : vo.getValue(); }
@Override public String getConfigValue(long id, ConfigKey<?> key) { ImageStoreDetailVO vo = findDetail(id, key.key()); return vo == null ? null : vo.getValue(); }
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { super.configure(name, params); Map<String, String> configs = _configDao.getConfiguration(params); if (params != null) { mergeConfigs(configs, params); } String period_str = configs.get(QuotaConfig.QuotaStatementPeriod.key()); int period = period_str == null ? 1 : Integer.parseInt(period_str); QuotaStatementPeriods _period = QuotaStatementPeriods.values()[period]; return true; }
public ScopedConfigStorage findScopedConfigStorage(ConfigKey<?> config) { for (ScopedConfigStorage storage : _scopedStorages) { if (storage.getScope() == config.scope()) { return storage; } } throw new CloudRuntimeException("Unable to find config storage for this scope: " + config.scope() + " for " + config.key()); }
@Override public String getEncryptionIV() { String value = EncryptionIV.value(); if (value == null) { _configDao.getValueAndInitIfNotExist(EncryptionIV.key(), EncryptionIV.category(), getBase64EncodedRandomKey(128), EncryptionIV.description()); } return EncryptionIV.value(); }
@Override public String getEncryptionKey() { String value = EncryptionKey.value(); if (value == null) { _configDao.getValueAndInitIfNotExist(EncryptionKey.key(), EncryptionKey.category(), getBase64EncodedRandomKey(128), EncryptionKey.description()); } return EncryptionKey.value(); }
@Override public String getHashKey() { String value = HashKey.value(); if (value == null) { _configDao.getValueAndInitIfNotExist(HashKey.key(), HashKey.category(), getBase64EncodedRandomKey(128), HashKey.description()); } return HashKey.value(); }
@Override @DB public void resetEncryptionKeyIV() { SearchBuilder<ConfigurationVO> sb = _configDao.createSearchBuilder(); sb.and("name1", sb.entity().getName(), SearchCriteria.Op.EQ); sb.or("name2", sb.entity().getName(), SearchCriteria.Op.EQ); sb.done(); SearchCriteria<ConfigurationVO> sc = sb.create(); sc.setParameters("name1", EncryptionKey.key()); sc.setParameters("name2", EncryptionIV.key()); _configDao.expunge(sc); }
@Test public void testExecuteForRestrictedCfg() { updateCfgCmd._configService = configService; updateCfgCmd.setCfgName(RoleService.EnableDynamicApiChecker.key()); try { updateCfgCmd.execute(); } catch (ServerApiException exception) { Assert.assertEquals("Restricted configuration update not allowed", exception.getDescription()); } }
public T value() { if (_value == null || isDynamic()) { ConfigurationVO vo = s_depot != null ? s_depot.global().findById(key()) : null; final String value = (vo != null && vo.getValue() != null) ? vo.getValue() : defaultValue(); _value = ((value == null) ? (T)defaultValue() : valueOf(value)); } return _value; }
public ConfigurationVO(String component, ConfigKey<?> key) { this(key.category(), "DEFAULT", component, key.key(), key.defaultValue(), key.description()); defaultValue = key.defaultValue(); dynamic = key.isDynamic(); scope = key.scope() != null ? key.scope().toString() : null; }