Search in sources :

Example 46 with Configuration

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);
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 47 with Configuration

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);
    }
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 48 with Configuration

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");
    }
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 49 with Configuration

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;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 50 with Configuration

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;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) MigrationStatus(com.emc.storageos.coordinator.client.model.MigrationStatus)

Aggregations

Configuration (com.emc.storageos.coordinator.common.Configuration)87 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)16 InterProcessLock (org.apache.curator.framework.recipes.locks.InterProcessLock)11 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)9 IOException (java.io.IOException)9 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)8 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)8 Site (com.emc.storageos.coordinator.client.model.Site)7 UnknownHostException (java.net.UnknownHostException)7 KeeperException (org.apache.zookeeper.KeeperException)7 PropertyInfoMapper.decodeFromString (com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString)6 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 Test (org.junit.Test)6 Matchers.anyString (org.mockito.Matchers.anyString)3 MigrationStatus (com.emc.storageos.coordinator.client.model.MigrationStatus)2 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)2 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)2 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)2 SiteConfigRestRep (com.emc.storageos.model.dr.SiteConfigRestRep)2