use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class GeoDbSvcStartupTest method setLocalDbCurrentVersion.
private static void setLocalDbCurrentVersion(CoordinatorClient coordinator) throws Exception {
Configuration config = coordinator.queryConfiguration(coordinator.getSiteId(), Constants.DB_CONFIG, Constants.GLOBAL_ID);
if (config == null) {
ConfigurationImpl cfg = new ConfigurationImpl();
cfg.setId(Constants.GLOBAL_ID);
cfg.setKind(Constants.DB_CONFIG);
config = cfg;
}
config.setConfig(Constants.SCHEMA_VERSION, DbSvcRunner.SVC_VERSION);
coordinator.persistServiceConfiguration(coordinator.getSiteId(), config);
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class VdcConfigHelper method updateDbSvcConfig.
public void updateDbSvcConfig(String svcName, String key, String value) {
String kind = coordinator.getDbConfigPath(svcName);
try {
List<Configuration> configs = coordinator.queryAllConfiguration(coordinator.getSiteId(), kind);
if (configs == null) {
String errMsg = "No " + svcName + " config found in the current vdc";
log.error(errMsg);
throw new IllegalStateException(errMsg);
}
for (Configuration config : configs) {
if (config.getId() == null) {
// version Znodes, e.g., /config/dbconfig/1.1
continue;
}
if (config.getId().equals(Constants.GLOBAL_ID)) {
continue;
}
config.setConfig(key, value);
coordinator.persistServiceConfiguration(coordinator.getSiteId(), config);
}
} catch (CoordinatorException e) {
throw new IllegalStateException(e);
}
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class BackupOps method queryBackupOperationStatus.
/**
* Query backup operation status from ZK
*/
public BackupOperationStatus queryBackupOperationStatus() {
BackupOperationStatus backupOperationStatus = new BackupOperationStatus();
Configuration config = coordinatorClient.queryConfiguration(Constants.BACKUP_OPERATION_STATUS, Constants.GLOBAL_ID);
if (config != null) {
backupOperationStatus.setLastSuccessfulCreation(getOperationStatus(config, BackupConstants.LAST_SUCCESSFUL_CREATION));
backupOperationStatus.setLastManualCreation(getOperationStatus(config, BackupConstants.LAST_MANUAL_CREATION));
backupOperationStatus.setLastScheduledCreation(getOperationStatus(config, BackupConstants.LAST_SCHEDULED_CREATION));
backupOperationStatus.setLastUpload(getOperationStatus(config, BackupConstants.LAST_UPLOAD));
}
log.info("Get backup operation status from ZK: {}", backupOperationStatus);
return backupOperationStatus;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class BackupOps method queryBackupRestoreStatus.
/**
* Query restore status from ZK
*/
public BackupRestoreStatus queryBackupRestoreStatus(String backupName, boolean isLocal) {
Configuration cfg = coordinatorClient.queryConfiguration(coordinatorClient.getSiteId(), getBackupConfigKind(isLocal), backupName);
Map<String, String> allItems = (cfg == null) ? new HashMap<String, String>() : cfg.getAllConfigs(false);
BackupRestoreStatus restoreStatus = new BackupRestoreStatus(allItems);
return restoreStatus;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class StubCoordinatorClientImpl method persistServiceConfiguration.
@Override
public void persistServiceConfiguration(Configuration... config) throws CoordinatorException {
for (int i = 0; i < config.length; i++) {
Configuration c = config[i];
_configMap.put(getKey(c.getKind(), c.getId()), c);
}
}
Aggregations