Search in sources :

Example 6 with CoordinatorClient

use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.

the class VdcConfigUtilTest method setup.

@BeforeClass
public static void setup() {
    CoordinatorClient coordinatorClient = new VdcCoordinatorClient();
    vdcConfigUtil = new VdcConfigUtil(coordinatorClient);
}
Also used : CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient) BeforeClass(org.junit.BeforeClass)

Example 7 with CoordinatorClient

use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.

the class DrInternodeAuthenticator method validateConfiguration.

/**
 * Called by Cassandra startup routine to initialize this instance
 */
@Override
public void validateConfiguration() throws ConfigurationException {
    log.info("Initializing DrInternodeAuthenticator");
    CoordinatorClient coordinatorClient = DbServiceImpl.instance.getCoordinator();
    DrUtil drUtil = new DrUtil(coordinatorClient);
    Site localSite = drUtil.getLocalSite();
    isStandbyDegraded = localSite.getState().equals(SiteState.STANDBY_DEGRADED) || localSite.getState().equals(SiteState.STANDBY_DEGRADING);
    isStandbyPaused = localSite.getState().equals(SiteState.STANDBY_PAUSING) || localSite.getState().equals(SiteState.STANDBY_PAUSED);
    isActiveDegraded = localSite.getState().equals(SiteState.ACTIVE_DEGRADED);
    Collection<String> nodeAddrList = localSite.getHostIPv4AddressMap().values();
    if (!localSite.isUsingIpv4()) {
        nodeAddrList = localSite.getHostIPv6AddressMap().values();
    }
    for (String nodeAddr : nodeAddrList) {
        try {
            localAddresses.add(InetAddress.getByName(nodeAddr));
        } catch (UnknownHostException e) {
            log.error("Invalid IP address {}", nodeAddr);
        }
    }
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) UnknownHostException(java.net.UnknownHostException) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

Example 8 with CoordinatorClient

use of com.emc.storageos.coordinator.client.service.CoordinatorClient 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 9 with CoordinatorClient

use of com.emc.storageos.coordinator.client.service.CoordinatorClient 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)

Example 10 with CoordinatorClient

use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.

the class SetupUtils method isSetupComplete.

public static boolean isSetupComplete() {
    if (StorageOsPlugin.isEnabled()) {
        CoordinatorClient coordinatorClient = StorageOsPlugin.getInstance().getCoordinatorClient();
        Configuration setupConfig = coordinatorClient.queryConfiguration(CONFIG_KIND, CONFIG_ID);
        complete = (setupConfig != null) && StringUtils.equals(setupConfig.getConfig(COMPLETE), Boolean.TRUE.toString());
    } else // In Dev mode we don't have coordinator so assume always setup
    if (Play.mode.isDev()) {
        complete = true;
    } else {
        complete = false;
    }
    return complete;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

Aggregations

CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)49 Test (org.junit.Test)11 Base64TokenEncoder (com.emc.storageos.security.authentication.Base64TokenEncoder)8 TokenKeyGenerator (com.emc.storageos.security.authentication.TokenKeyGenerator)8 TokenMaxLifeValuesHolder (com.emc.storageos.security.authentication.TokenMaxLifeValuesHolder)8 Configuration (com.emc.storageos.coordinator.common.Configuration)7 DbClient (com.emc.storageos.db.client.DbClient)7 CassandraTokenManager (com.emc.storageos.auth.impl.CassandraTokenManager)6 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)6 StorageOSUserDAO (com.emc.storageos.db.client.model.StorageOSUserDAO)6 TokenOnWire (com.emc.storageos.security.authentication.TokenOnWire)6 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)5 URI (java.net.URI)5 Service (com.emc.storageos.coordinator.common.Service)4 InterVDCTokenCacheHelper (com.emc.storageos.security.geo.InterVDCTokenCacheHelper)4 ArrayList (java.util.ArrayList)4 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)3 BaseToken (com.emc.storageos.db.client.model.BaseToken)3 ProxyToken (com.emc.storageos.db.client.model.ProxyToken)3 Token (com.emc.storageos.db.client.model.Token)3