Search in sources :

Example 46 with ConfigurationImpl

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

the class CoordinatorClientImpl method setTargetInfo.

/**
 * Update target info(for specific site) to ZK
 *
 * @param info
 * @throws CoordinatorException
 */
public void setTargetInfo(String siteId, final CoordinatorSerializable info) throws CoordinatorException {
    final CoordinatorClassInfo coordinatorInfo = info.getCoordinatorClassInfo();
    String id = coordinatorInfo.id;
    String kind = coordinatorInfo.kind;
    ConfigurationImpl cfg = new ConfigurationImpl();
    cfg.setId(id);
    cfg.setKind(kind);
    cfg.setConfig(TARGET_INFO, info.encodeAsString());
    persistServiceConfiguration(siteId, cfg);
    if (siteId == null) {
        log.info("Target info set: {} for local site", info);
    } else {
        log.info("Target info set: {} for site {}", info, siteId);
    }
}
Also used : CoordinatorClassInfo(com.emc.storageos.coordinator.client.model.CoordinatorClassInfo) PropertyInfoMapper.decodeFromString(com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 47 with ConfigurationImpl

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

the class VdcConfigHelper method setGeoEncryptionKey.

public void setGeoEncryptionKey(String geoEncryptionKey) {
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(ENCRYPTION_CONFIG_KIND);
    config.setId(ENCRYPTION_CONFIG_ID);
    config.setConfig(ENCRYPTION_CONFIG_KIND, geoEncryptionKey);
    coordinator.persistServiceConfiguration(config);
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 48 with ConfigurationImpl

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

the class BackupOps method persistBackupOperationStatus.

/**
 * Records backup operation status to ZK
 */
public void persistBackupOperationStatus(BackupOperationStatus backupOperationStatus) {
    if (backupOperationStatus == null) {
        log.warn("Backup operation status is empty, no need persisting");
        return;
    }
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(Constants.BACKUP_OPERATION_STATUS);
    config.setId(Constants.GLOBAL_ID);
    log.info("Persisting backup operation status to zk");
    setOperationStatus(config, BackupConstants.LAST_SUCCESSFUL_CREATION, backupOperationStatus.getLastSuccessfulCreation());
    setOperationStatus(config, BackupConstants.LAST_MANUAL_CREATION, backupOperationStatus.getLastManualCreation());
    setOperationStatus(config, BackupConstants.LAST_SCHEDULED_CREATION, backupOperationStatus.getLastScheduledCreation());
    setOperationStatus(config, BackupConstants.LAST_UPLOAD, backupOperationStatus.getLastUpload());
    coordinatorClient.persistServiceConfiguration(config);
    log.info("Persist backup operation status to zk successfully: {}", backupOperationStatus);
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 49 with ConfigurationImpl

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

the class BackupOps method persistBackupRestoreStatus.

public void persistBackupRestoreStatus(BackupRestoreStatus status, boolean isLocal, boolean doLog) {
    if (doLog) {
        log.info("Persist backup restore status {}", status);
    }
    Map<String, String> allItems = status.toMap();
    ConfigurationImpl config = new ConfigurationImpl();
    String backupName = status.getBackupName();
    config.setKind(getBackupConfigKind(isLocal));
    config.setId(backupName);
    for (Map.Entry<String, String> entry : allItems.entrySet()) {
        config.setConfig(entry.getKey(), entry.getValue());
    }
    coordinatorClient.persistServiceConfiguration(coordinatorClient.getSiteId(), config);
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)

Example 50 with ConfigurationImpl

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

the class LoggingMBean method persistLogLevel.

private void persistLogLevel(String level, int expirInMin, String scope) {
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(_logName);
    config.setId(_hostId);
    long expiration = System.currentTimeMillis() + expirInMin * 60 * 1000;
    String configStr = level + LOG_LEVEL_DELIMITER + String.valueOf(expiration) + LOG_LEVEL_DELIMITER + scope;
    config.setConfig(LOG_LEVEL_CONFIG, configStr);
    try {
        _log.info("Persisting log level configuration");
        _coordinator.persistServiceConfiguration(config);
        _log.info("Persist log level configuration succeed");
    } catch (CoordinatorException e) {
        _log.error("Exception persisting log level config {}:", configStr, e);
        return;
    }
}
Also used : CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) 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