Search in sources :

Example 36 with Configuration

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

the class GeoDbSvcStartupTest method setLocalDbCurrentVersion.

private static void setLocalDbCurrentVersion(CoordinatorClient coordinator) throws Exception {
    Configuration config = coordinator.queryConfiguration(coordinator.getSiteId(), Constants.DB_CONFIG, Constants.GLOBAL_ID);
    if (config == null) {
        ConfigurationImpl cfg = new ConfigurationImpl();
        cfg.setId(Constants.GLOBAL_ID);
        cfg.setKind(Constants.DB_CONFIG);
        config = cfg;
    }
    config.setConfig(Constants.SCHEMA_VERSION, DbSvcRunner.SVC_VERSION);
    coordinator.persistServiceConfiguration(coordinator.getSiteId(), config);
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 37 with Configuration

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

the class VdcConfigHelper method updateDbSvcConfig.

public void updateDbSvcConfig(String svcName, String key, String value) {
    String kind = coordinator.getDbConfigPath(svcName);
    try {
        List<Configuration> configs = coordinator.queryAllConfiguration(coordinator.getSiteId(), kind);
        if (configs == null) {
            String errMsg = "No " + svcName + " config found in the current vdc";
            log.error(errMsg);
            throw new IllegalStateException(errMsg);
        }
        for (Configuration config : configs) {
            if (config.getId() == null) {
                // version Znodes, e.g., /config/dbconfig/1.1
                continue;
            }
            if (config.getId().equals(Constants.GLOBAL_ID)) {
                continue;
            }
            config.setConfig(key, value);
            coordinator.persistServiceConfiguration(coordinator.getSiteId(), config);
        }
    } catch (CoordinatorException e) {
        throw new IllegalStateException(e);
    }
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException)

Example 38 with Configuration

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

the class BackupOps method queryBackupOperationStatus.

/**
 * Query backup operation status from ZK
 */
public BackupOperationStatus queryBackupOperationStatus() {
    BackupOperationStatus backupOperationStatus = new BackupOperationStatus();
    Configuration config = coordinatorClient.queryConfiguration(Constants.BACKUP_OPERATION_STATUS, Constants.GLOBAL_ID);
    if (config != null) {
        backupOperationStatus.setLastSuccessfulCreation(getOperationStatus(config, BackupConstants.LAST_SUCCESSFUL_CREATION));
        backupOperationStatus.setLastManualCreation(getOperationStatus(config, BackupConstants.LAST_MANUAL_CREATION));
        backupOperationStatus.setLastScheduledCreation(getOperationStatus(config, BackupConstants.LAST_SCHEDULED_CREATION));
        backupOperationStatus.setLastUpload(getOperationStatus(config, BackupConstants.LAST_UPLOAD));
    }
    log.info("Get backup operation status from ZK: {}", backupOperationStatus);
    return backupOperationStatus;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) BackupOperationStatus(com.emc.vipr.model.sys.backup.BackupOperationStatus)

Example 39 with Configuration

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

the class BackupOps method queryBackupRestoreStatus.

/**
 * Query restore status from ZK
 */
public BackupRestoreStatus queryBackupRestoreStatus(String backupName, boolean isLocal) {
    Configuration cfg = coordinatorClient.queryConfiguration(coordinatorClient.getSiteId(), getBackupConfigKind(isLocal), backupName);
    Map<String, String> allItems = (cfg == null) ? new HashMap<String, String>() : cfg.getAllConfigs(false);
    BackupRestoreStatus restoreStatus = new BackupRestoreStatus(allItems);
    return restoreStatus;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) BackupRestoreStatus(com.emc.vipr.model.sys.backup.BackupRestoreStatus)

Example 40 with Configuration

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

the class StubCoordinatorClientImpl method persistServiceConfiguration.

@Override
public void persistServiceConfiguration(Configuration... config) throws CoordinatorException {
    for (int i = 0; i < config.length; i++) {
        Configuration c = config[i];
        _configMap.put(getKey(c.getKind(), c.getId()), c);
    }
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

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