use of com.emc.storageos.coordinator.common.Configuration 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);
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class SchemaUtil method removeMigrationCheckpoint.
/**
* Remove migration checkpoint from ZK. Assume migration lock is acquired when entering this call.
*/
void removeMigrationCheckpoint() {
Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), getDbConfigPath(), Constants.GLOBAL_ID);
_log.debug("removeMigrationCheckpoint: target version \"{}\"", _coordinator.getTargetDbSchemaVersion());
if (config != null) {
config.removeConfig(DbConfigConstants.MIGRATION_CHECKPOINT);
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
}
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class SchemaUtil method setCurrentVersion.
void setCurrentVersion(String currentVersion) {
String configKind = _coordinator.getDbConfigPath(_service.getName());
Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), configKind, Constants.GLOBAL_ID);
if (config != null) {
config.setConfig(Constants.SCHEMA_VERSION, currentVersion);
_coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
} else {
// we are expecting this to exist, because its initialized from checkGlobalConfiguration
throw new IllegalStateException("unexpected error, db global configuration is null");
}
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class SchemaUtil method getMigrationCheckpoint.
/**
* Get migration check point from ZK. Db migration is supposed to start from this point.
*/
String getMigrationCheckpoint() {
Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), getDbConfigPath(), Constants.GLOBAL_ID);
_log.debug("getMigrationCheckpoint: target version \"{}\"", _coordinator.getTargetDbSchemaVersion());
if (config != null) {
String checkpoint = config.getConfig(DbConfigConstants.MIGRATION_CHECKPOINT);
return checkpoint;
}
return null;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class StubCoordinatorClientImpl method getMigrationStatus.
@Override
public MigrationStatus getMigrationStatus() {
Configuration config = queryConfiguration(getVersionedDbConfigPath(Constants.DBSVC_NAME, getTargetDbSchemaVersion()), GLOBAL_ID);
if (config == null || config.getConfig(MIGRATION_STATUS) == null) {
return null;
}
MigrationStatus status = MigrationStatus.valueOf(config.getConfig(MIGRATION_STATUS));
return status;
}
Aggregations