Search in sources :

Example 11 with CoordinatorClient

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

the class SetupUtils method markSetupComplete.

public static void markSetupComplete() {
    if (complete) {
        return;
    }
    if (StorageOsPlugin.isEnabled()) {
        CoordinatorClient coordinatorClient = StorageOsPlugin.getInstance().getCoordinatorClient();
        ConfigurationImpl config = new ConfigurationImpl();
        config.setKind(CONFIG_KIND);
        config.setId(CONFIG_ID);
        config.setConfig(COMPLETE, Boolean.TRUE.toString());
        coordinatorClient.persistServiceConfiguration(config);
        complete = true;
    } else if (Play.mode.isDev()) {
        complete = true;
    }
}
Also used : CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 12 with CoordinatorClient

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

the class StorageOsPlugin method onApplicationStart.

/**
 * Called at application start (and at each reloading) Time to start stateful things.
 */
@Override
public void onApplicationStart() {
    // NOSONAR
    instance = this;
    // ("Suppressing Sonar violation of Lazy initialization of static fields should be synchronized for field instance")
    if (!isEnabled()) {
        return;
    }
    try {
        Logger.info("Connecting to Coordinator Service");
        // To using Spring profile feature
        context = new GenericXmlApplicationContext();
        context.getEnvironment().setActiveProfiles(System.getProperty("buildType"));
        context.load(getContextFiles());
        context.refresh();
        Logger.info("Connected to Coordinator Service");
        zkConnection = getBean("zkconn", ZkConnection.class);
        coordinatorClient = getBean("coordinator", CoordinatorClient.class);
        encryptionProvider = getBean("encryptionProvider", EncryptionProvider.class);
        authSvcEndPointLocator = getBean("authSvcEndpointLocator", AuthSvcEndPointLocator.class);
        Validator.setAuthSvcEndPointLocator(authSvcEndPointLocator);
        Validator.setCoordinator(coordinatorClient);
        // need reference to local-security-conf.xml to load this
        Validator.setStorageOSUserRepository(null);
        coordinatorClient.start();
        encryptionProvider.start();
        Logger.info("Started ViPR connection, version: %s", version);
        KeyStoreExporter keystoreExporter = getBean("keystoreExporter", KeyStoreExporter.class);
        keystoreExporter.export();
        // register node listener for catalog acl change
        coordinatorClient.addNodeListener(new CatalogAclListener());
        Logger.info("added CatalogAclListener");
    } catch (Exception e) {
        Logger.error(e, "Error initializing ViPR Connection");
        shutdown();
    }
}
Also used : AuthSvcEndPointLocator(com.emc.storageos.security.authentication.AuthSvcEndPointLocator) KeyStoreExporter(com.emc.storageos.security.keystore.KeyStoreExporter) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient) CatalogAclListener(controllers.util.CatalogAclListener) EncryptionProvider(com.emc.storageos.db.client.model.EncryptionProvider) GenericXmlApplicationContext(org.springframework.context.support.GenericXmlApplicationContext) ZkConnection(com.emc.storageos.coordinator.common.impl.ZkConnection)

Example 13 with CoordinatorClient

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

the class Maintenance method getClusterStateFromCoordinator.

private static ClusterInfo getClusterStateFromCoordinator() {
    if (StorageOsPlugin.isEnabled()) {
        CoordinatorClient coordinatorClient = StorageOsPlugin.getInstance().getCoordinatorClient();
        ClusterInfo.ClusterState clusterState = coordinatorClient.getControlNodesState();
        if (clusterState != null) {
            ClusterInfo clusterInfo = new ClusterInfo();
            clusterInfo.setCurrentState(clusterState.toString());
            return clusterInfo;
        }
    }
    return null;
}
Also used : ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

Example 14 with CoordinatorClient

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

the class DrZkHealthMonitor method start.

@Override
public void start() {
    CoordinatorClient coordinator = getCoordinator().getCoordinatorClient();
    String barrierPath = String.format("%s/%s%s", ZkPath.SITES, coordinator.getSiteId(), DR_SWITCH_TO_ZK_OBSERVER_BARRIER);
    switchToZkObserverBarrier = coordinator.getDistributedDoubleBarrier(barrierPath, coordinatorExt.getNodeCount());
    super.start();
}
Also used : CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient)

Example 15 with CoordinatorClient

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

the class SchedulerConfig method getSofttwareWithRetry.

private void getSofttwareWithRetry() throws Exception, InterruptedException {
    int retryTimes = 0;
    RepositoryInfo targetInfo = null;
    CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
    while (retryTimes <= MAX_VERSION_RETRY_TIMES) {
        retryTimes++;
        targetInfo = coordinatorClient.getTargetInfo(RepositoryInfo.class);
        if (targetInfo == null) {
            log.info("can't get version, try {} seconds later", MAX_VERSION_RETRY_INTERVAL / 1000);
            Thread.sleep(MAX_VERSION_RETRY_INTERVAL);
            continue;
        }
        this.softwareVersion = targetInfo.getCurrentVersion().toString();
        log.info("Version: {}", softwareVersion);
        break;
    }
    if (targetInfo == null) {
        throw new Exception("Can't get version information from coordinator client");
    }
}
Also used : RepositoryInfo(com.emc.storageos.coordinator.client.model.RepositoryInfo) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint)

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