Search in sources :

Example 11 with Configuration

use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.

the class MigrationHandlerImpl method setDbConfig.

/**
 * Checks and registers db configuration information
 */
private void setDbConfig(String name) {
    Configuration config = coordinator.queryConfiguration(coordinator.getSiteId(), coordinator.getVersionedDbConfigPath(service.getName(), service.getVersion()), service.getId());
    if (config != null) {
        if (config.getConfig(name) == null) {
            config.setConfig(name, Boolean.TRUE.toString());
            coordinator.persistServiceConfiguration(coordinator.getSiteId(), config);
        }
    } else {
        throw new IllegalStateException("unexpected error, configuration is null");
    }
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 12 with Configuration

use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.

the class SchemaUtil method setMigrationStatus.

void setMigrationStatus(MigrationStatus status) {
    Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), getDbConfigPath(), Constants.GLOBAL_ID);
    _log.debug("setMigrationStatus: target version \"{}\" status {}", _coordinator.getTargetDbSchemaVersion(), status.name());
    if (config == null) {
        ConfigurationImpl cfg = new ConfigurationImpl();
        cfg.setKind(getDbConfigPath());
        cfg.setId(Constants.GLOBAL_ID);
        config = cfg;
    }
    config.setConfig(Constants.MIGRATION_STATUS, status.name());
    _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 13 with Configuration

use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.

the class LocalToGeoMigrationDoneCleanup method processZKFlagCleanup.

private void processZKFlagCleanup() {
    Configuration config = coordinatorClient.queryConfiguration(coordinatorClient.getSiteId(), DB_CONFIG, GLOBAL_ID);
    if (config.getConfig(LOCAL_TO_GEO_DONE) != null) {
        log.info("Flag {} found in ZooKeeper. Removing...", LOCAL_TO_GEO_DONE);
        config.removeConfig(LOCAL_TO_GEO_DONE);
        coordinatorClient.persistServiceConfiguration(coordinatorClient.getSiteId(), config);
        log.info("Flag {} removed from ZooKeeper", LOCAL_TO_GEO_DONE);
    } else {
        log.info("Flag {} not found in ZooKeeper.", LOCAL_TO_GEO_DONE);
    }
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 14 with Configuration

use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.

the class DbMigrationCheckpointTest method resetMigrationStatus.

/**
 * reset migration status
 *
 * @param version
 */
private void resetMigrationStatus(String version) {
    CoordinatorClient coordinator = getCoordinator();
    Configuration config = coordinator.queryConfiguration(coordinator.getSiteId(), coordinator.getVersionedDbConfigPath(Constants.DBSVC_NAME, version), Constants.GLOBAL_ID);
    Assert.assertNotNull(config);
    log.info("setMigrationStatus: target version \"{}\" status {}", version, MigrationStatus.RUNNING);
    config.setConfig(Constants.MIGRATION_STATUS, MigrationStatus.RUNNING.name());
    coordinator.persistServiceConfiguration(coordinator.getSiteId(), config);
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

Example 15 with Configuration

use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.

the class DbMigrationCheckpointTest method getCheckpoint.

private String getCheckpoint(String version) {
    CoordinatorClient coordinator = getCoordinator();
    Configuration config = coordinator.queryConfiguration(coordinator.getSiteId(), coordinator.getVersionedDbConfigPath(Constants.DBSVC_NAME, version), Constants.GLOBAL_ID);
    Assert.assertNotNull(config);
    return config.getConfig(DbConfigConstants.MIGRATION_CHECKPOINT);
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

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