Search in sources :

Example 26 with ConfigurationImpl

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

the class BackupOps method persistCurrentBackupInfo.

public void persistCurrentBackupInfo(String backupName, boolean isLocal) {
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(BackupConstants.PULL_RESTORE_STATUS);
    config.setId(Constants.GLOBAL_ID);
    config.setConfig(BackupConstants.CURRENT_DOWNLOADING_BACKUP_NAME_KEY, backupName);
    config.setConfig(BackupConstants.CURRENT_DOWNLOADING_BACKUP_ISLOCAL_KEY, Boolean.toString(isLocal));
    coordinatorClient.persistServiceConfiguration(coordinatorClient.getSiteId(), config);
    log.info("Persist current backup info to zk successfully");
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 27 with ConfigurationImpl

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

the class ComputeImageServerMigrationTest method prepareData.

@Override
protected void prepareData() throws Exception {
    log.info("Storing image server info into zk configuration");
    Map<String, String> imageServerProps = new HashMap<String, String>();
    imageServerProps.put("image_server_address", "10.247.84.185");
    imageServerProps.put("image_server_username", "root");
    imageServerProps.put("image_server_password", "ChangeMe");
    imageServerProps.put("image_server_tftpbootdirectory", "");
    imageServerProps.put("image_server_os_network_ip", "12.0.6.10");
    imageServerProps.put("image_server_http_port", "");
    imageServerProps.put("image_server_image_directory", "");
    String str = new PropertyInfoExt(imageServerProps).encodeAsString();
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(PropertyInfoExt.TARGET_PROPERTY);
    config.setId(PropertyInfoExt.TARGET_PROPERTY_ID);
    config.setConfig(PropertyInfoExt.TARGET_INFO, str);
    _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
    String imageServerIP = _coordinator.getPropertyInfo().getProperty("image_server_address");
    if (imageServerIP == null) {
        log.info("image server info not saved to ZK db");
    }
}
Also used : HashMap(java.util.HashMap) PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 28 with ConfigurationImpl

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

the class DbServiceImpl method checkVersionedConfiguration.

// check and initialize versioned configuration
private Configuration checkVersionedConfiguration() {
    String serviceVersion = _serviceInfo.getVersion();
    String dbSchemaVersion = _dbClient.getSchemaVersion();
    if (!serviceVersion.equals(dbSchemaVersion)) {
        _log.warn("The db service version {} doesn't equals Db schema version {}, " + "set db service version to Db schema version", serviceVersion, dbSchemaVersion);
        _serviceInfo.setVersion(dbSchemaVersion);
    }
    String kind = _coordinator.getVersionedDbConfigPath(_serviceInfo.getName(), _serviceInfo.getVersion());
    Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), kind, _serviceInfo.getId());
    if (config == null) {
        // check if it is upgraded from previous version to yoda - configuration may be stored in
        // znode /config
        config = _coordinator.queryConfiguration(kind, _serviceInfo.getId());
        if (config != null) {
            _log.info("Upgrade from pre-2.5 release, move versioned dbconfig to new location");
            _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
            return config;
        }
        ConfigurationImpl cfg = new ConfigurationImpl();
        cfg.setId(_serviceInfo.getId());
        cfg.setKind(kind);
        // persist configuration
        _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), cfg);
        config = cfg;
    }
    return config;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 29 with ConfigurationImpl

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

the class DbServiceImpl method checkGlobalConfiguration.

// check and initialize global configuration
private Configuration checkGlobalConfiguration() {
    String configKind = _coordinator.getDbConfigPath(_serviceInfo.getName());
    Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), configKind, Constants.GLOBAL_ID);
    if (config == null) {
        // check if it is upgraded from previous version to yoda - configuration may be stored in
        // znode /config. Since SeedProvider still need access that, so we remove the config
        // from global in migration callback after migration is done.
        config = _coordinator.queryConfiguration(configKind, Constants.GLOBAL_ID);
        if (config != null) {
            _log.info("Upgrade from pre-yoda release, move global config to new location");
            _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
            return config;
        }
        ConfigurationImpl cfg = new ConfigurationImpl();
        cfg.setId(Constants.GLOBAL_ID);
        cfg.setKind(configKind);
        cfg.setConfig(Constants.SCHEMA_VERSION, this._serviceInfo.getVersion());
        // persist configuration
        _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), cfg);
        config = cfg;
    }
    return config;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 30 with ConfigurationImpl

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

the class SchemaUtil method setMigrationCheckpoint.

/**
 * Update migration checkpoint to ZK. Assume migration lock is acquired when entering this call.
 *
 * @param checkpoint
 */
void setMigrationCheckpoint(String checkpoint) {
    Configuration config = _coordinator.queryConfiguration(_coordinator.getSiteId(), getDbConfigPath(), Constants.GLOBAL_ID);
    _log.debug("setMigrationCheckpoint: target version \"{}\" checkpoint {}", _coordinator.getTargetDbSchemaVersion(), checkpoint);
    if (config == null) {
        ConfigurationImpl cfg = new ConfigurationImpl();
        cfg.setKind(getDbConfigPath());
        cfg.setId(Constants.GLOBAL_ID);
        config = cfg;
    }
    config.setConfig(DbConfigConstants.MIGRATION_CHECKPOINT, checkpoint);
    _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration) 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