Search in sources :

Example 6 with ConfigurationImpl

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

the class EncryptionProviderImpl method persistKey.

/**
 * Persists key to coordinator
 *
 * @throws Exception
 */
private void persistKey(SecretKey key) throws Exception {
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(CONFIG_KIND);
    config.setId(_encryptId);
    config.setConfig(CONFIG_KIND, new String(Base64.encodeBase64(key.getEncoded()), UTF_8));
    _coordinator.persistServiceConfiguration(config);
    _key = key;
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 7 with ConfigurationImpl

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

the class InitialSetupDeprecationCallback method process.

/**
 * If the InitialSetup CF singleton exists and has the 'complete' attribute set,
 * set the corresponding configuration fields in ZK, then remove the CF row
 */
@Override
public void process() throws MigrationCallbackException {
    DbClient dbClient = this.getDbClient();
    InitialSetup initialSetup = dbClient.queryObject(InitialSetup.class, InitialSetup.SINGLETON_ID);
    if ((initialSetup != null) && (BooleanUtils.isTrue(initialSetup.getComplete()))) {
        log.info("Migrating InitialSetup CF into Coordinator");
        ConfigurationImpl config = new ConfigurationImpl();
        config.setKind(CONFIG_KIND);
        config.setId(CONFIG_ID);
        config.setConfig(COMPLETE, Boolean.TRUE.toString());
        coordinatorClient.persistServiceConfiguration(config);
        dbClient.removeObject(initialSetup);
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) InitialSetup(com.emc.storageos.db.client.model.uimodels.InitialSetup) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 8 with ConfigurationImpl

use of com.emc.storageos.coordinator.common.impl.ConfigurationImpl 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 9 with ConfigurationImpl

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

the class DbOfflineEventInfo method toConfiguration.

public Configuration toConfiguration(String configId) {
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(Constants.DB_DOWNTIME_TRACKER_CONFIG);
    config.setId(configId);
    log.info("Set DB offline event info to ZK config: {}", eventInfo);
    for (Map.Entry<String, Long> entry : eventInfo.entrySet()) {
        config.setConfig(entry.getKey(), (entry.getValue() == null) ? null : String.valueOf(entry.getValue()));
    }
    return config;
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 10 with ConfigurationImpl

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

the class Site method toConfiguration.

public Configuration toConfiguration() {
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(String.format("%s/%s", CONFIG_KIND, vdcShortId));
    config.setId(uuid);
    if (name != null) {
        config.setConfig(KEY_NAME, name);
    }
    if (description != null) {
        config.setConfig(KEY_DESCRIPTION, description);
    }
    if (vip != null) {
        config.setConfig(KEY_VIP, vip);
    }
    if (vip6 != null) {
        config.setConfig(KEY_VIP6, vip6);
    }
    if (siteShortId != null) {
        config.setConfig(KEY_SITE_SHORTID, this.siteShortId);
    }
    config.setConfig(KEY_CREATIONTIME, String.valueOf(creationTime));
    if (lastStateUpdateTime != 0L) {
        config.setConfig(KEY_LASTSTATEUPDATETIME, String.valueOf(lastStateUpdateTime));
    }
    if (lastLostQuorumTime != 0L) {
        config.setConfig(KEY_LAST_LOST_QUORUM_TIME, String.valueOf(lastLostQuorumTime));
    }
    if (lastState != null) {
        config.setConfig(KEY_LASTSTATE, String.valueOf(lastState));
    }
    if (state != null) {
        config.setConfig(KEY_SITE_STATE, String.valueOf(state));
    }
    config.setConfig(KEY_NODECOUNT, String.valueOf(nodeCount));
    treeMapSorter.clear();
    treeMapSorter.putAll(this.hostIPv4AddressMap);
    config.setConfig(KEY_NODESADDR, StringUtil.join(treeMapSorter.values(), ","));
    treeMapSorter.clear();
    treeMapSorter.putAll(this.hostIPv6AddressMap);
    config.setConfig(KEY_NODESADDR6, StringUtil.join(treeMapSorter.values(), ","));
    return config;
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Aggregations

ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)51 Configuration (com.emc.storageos.coordinator.common.Configuration)16 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)8 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)6 IOException (java.io.IOException)6 InterProcessLock (org.apache.curator.framework.recipes.locks.InterProcessLock)6 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)5 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)5 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)5 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)4 Site (com.emc.storageos.coordinator.client.model.Site)4 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)4 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)4 HashMap (java.util.HashMap)4 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)3 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)3 Map (java.util.Map)3 CoordinatorClassInfo (com.emc.storageos.coordinator.client.model.CoordinatorClassInfo)2 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)2 PropertyInfoMapper.decodeFromString (com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString)2