use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class BackupOps method persistCurrentBackupInfo.
public void persistCurrentBackupInfo(String backupName, boolean isLocal) {
ConfigurationImpl config = new ConfigurationImpl();
config.setKind(BackupConstants.PULL_RESTORE_STATUS);
config.setId(Constants.GLOBAL_ID);
config.setConfig(BackupConstants.CURRENT_DOWNLOADING_BACKUP_NAME_KEY, backupName);
config.setConfig(BackupConstants.CURRENT_DOWNLOADING_BACKUP_ISLOCAL_KEY, Boolean.toString(isLocal));
coordinatorClient.persistServiceConfiguration(coordinatorClient.getSiteId(), config);
log.info("Persist current backup info to zk successfully");
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class ComputeImageServerMigrationTest method prepareData.
@Override
protected void prepareData() throws Exception {
log.info("Storing image server info into zk configuration");
Map<String, String> imageServerProps = new HashMap<String, String>();
imageServerProps.put("image_server_address", "10.247.84.185");
imageServerProps.put("image_server_username", "root");
imageServerProps.put("image_server_password", "ChangeMe");
imageServerProps.put("image_server_tftpbootdirectory", "");
imageServerProps.put("image_server_os_network_ip", "12.0.6.10");
imageServerProps.put("image_server_http_port", "");
imageServerProps.put("image_server_image_directory", "");
String str = new PropertyInfoExt(imageServerProps).encodeAsString();
ConfigurationImpl config = new ConfigurationImpl();
config.setKind(PropertyInfoExt.TARGET_PROPERTY);
config.setId(PropertyInfoExt.TARGET_PROPERTY_ID);
config.setConfig(PropertyInfoExt.TARGET_INFO, str);
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
String imageServerIP = _coordinator.getPropertyInfo().getProperty("image_server_address");
if (imageServerIP == null) {
log.info("image server info not saved to ZK db");
}
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class DbServiceImpl method checkVersionedConfiguration.
// check and initialize versioned configuration
private Configuration checkVersionedConfiguration() {
String serviceVersion = _serviceInfo.getVersion();
String dbSchemaVersion = _dbClient.getSchemaVersion();
if (!serviceVersion.equals(dbSchemaVersion)) {
_log.warn("The db service version {} doesn't equals Db schema version {}, " + "set db service version to Db schema version", serviceVersion, dbSchemaVersion);
_serviceInfo.setVersion(dbSchemaVersion);
}
String kind = _coordinator.getVersionedDbConfigPath(_serviceInfo.getName(), _serviceInfo.getVersion());
Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), kind, _serviceInfo.getId());
if (config == null) {
// check if it is upgraded from previous version to yoda - configuration may be stored in
// znode /config
config = _coordinator.queryConfiguration(kind, _serviceInfo.getId());
if (config != null) {
_log.info("Upgrade from pre-2.5 release, move versioned dbconfig to new location");
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
return config;
}
ConfigurationImpl cfg = new ConfigurationImpl();
cfg.setId(_serviceInfo.getId());
cfg.setKind(kind);
// persist configuration
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), cfg);
config = cfg;
}
return config;
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class DbServiceImpl method checkGlobalConfiguration.
// check and initialize global configuration
private Configuration checkGlobalConfiguration() {
String configKind = _coordinator.getDbConfigPath(_serviceInfo.getName());
Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), configKind, Constants.GLOBAL_ID);
if (config == null) {
// check if it is upgraded from previous version to yoda - configuration may be stored in
// znode /config. Since SeedProvider still need access that, so we remove the config
// from global in migration callback after migration is done.
config = _coordinator.queryConfiguration(configKind, Constants.GLOBAL_ID);
if (config != null) {
_log.info("Upgrade from pre-yoda release, move global config to new location");
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
return config;
}
ConfigurationImpl cfg = new ConfigurationImpl();
cfg.setId(Constants.GLOBAL_ID);
cfg.setKind(configKind);
cfg.setConfig(Constants.SCHEMA_VERSION, this._serviceInfo.getVersion());
// persist configuration
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), cfg);
config = cfg;
}
return config;
}
use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl in project coprhd-controller by CoprHD.
the class SchemaUtil method setMigrationCheckpoint.
/**
* Update migration checkpoint to ZK. Assume migration lock is acquired when entering this call.
*
* @param checkpoint
*/
void setMigrationCheckpoint(String checkpoint) {
Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), getDbConfigPath(), Constants.GLOBAL_ID);
_log.debug("setMigrationCheckpoint: target version \"{}\" checkpoint {}", _coordinator.getTargetDbSchemaVersion(), checkpoint);
if (config == null) {
ConfigurationImpl cfg = new ConfigurationImpl();
cfg.setKind(getDbConfigPath());
cfg.setId(Constants.GLOBAL_ID);
config = cfg;
}
config.setConfig(DbConfigConstants.MIGRATION_CHECKPOINT, checkpoint);
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
}
Aggregations