Search in sources :

Example 11 with ConfigurationImpl

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

the class StorageDriverMetaData method toConfiguration.

// configuration converters
public Configuration toConfiguration() {
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(KIND);
    config.setId(driverName);
    if (driverName != null) {
        config.setConfig(KEY_DRIVER_NAME, driverName);
    }
    if (driverVersion != null) {
        config.setConfig(KEY_DRIVER_VERSION, driverVersion);
    }
    if (storageName != null) {
        config.setConfig(KEY_STORAGE_NAME, storageName);
    }
    if (storageDisplayName != null) {
        config.setConfig(KEY_STORAGE_DISPLAY_NAME, storageDisplayName);
    }
    if (providerName != null) {
        config.setConfig(KEY_PROVIDER_NAME, providerName);
    }
    if (providerDisplayName != null) {
        config.setConfig(KEY_PROVIDER_DISPLAY_NAME, providerDisplayName);
    }
    if (metaType != null) {
        config.setConfig(KEY_META_TYPE, metaType);
    }
    config.setConfig(KEY_ENABLE_SSL, String.valueOf(enableSsl));
    config.setConfig(KEY_SSL_PORT, String.valueOf(sslPort));
    config.setConfig(KEY_NON_SSL_PORT, String.valueOf(nonSslPort));
    config.setConfig(KEY_SUPPORT_AUTOTIER_POLICY, String.valueOf(supportAutoTierPolicy));
    if (driverClassName != null) {
        config.setConfig(KEY_DRIVER_CLASS_NAME, driverClassName);
    }
    if (driverFileName != null) {
        config.setConfig(KEY_DRIVER_FILE_NAME, driverFileName);
    }
    return config;
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 12 with ConfigurationImpl

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

the class DrUtil method setLocalVdcShortId.

/**
 * Update current vdc short id to zk
 *
 * @param vdcShortId
 */
public void setLocalVdcShortId(String vdcShortId) {
    ConfigurationImpl localVdc = new ConfigurationImpl();
    localVdc.setKind(Constants.CONFIG_GEO_LOCAL_VDC_KIND);
    localVdc.setId(Constants.CONFIG_GEO_LOCAL_VDC_ID);
    localVdc.setConfig(Constants.CONFIG_GEO_LOCAL_VDC_SHORT_ID, vdcShortId);
    coordinator.persistServiceConfiguration(localVdc);
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 13 with ConfigurationImpl

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

the class DrUtil method removeSite.

/**
 * Will remove 3 ZNodes:
 *     1. /config/disasterRecoverySites/${vdc_shortid}/${uuid} node
 *     2. /sites/${uuid} node
 *     3. /config/upgradetargetpropertyoverride/${uuid} node
 * @param site
 */
public void removeSite(Site site) {
    coordinator.removeServiceConfiguration(site.toConfiguration());
    coordinator.deletePath(getSitePath(site.getUuid()));
    ConfigurationImpl sitePropsCfg = new ConfigurationImpl();
    sitePropsCfg.setId(site.getUuid());
    sitePropsCfg.setKind(PropertyInfoExt.TARGET_PROPERTY);
    coordinator.removeServiceConfiguration(sitePropsCfg);
    log.info("Removed site {} configuration from ZK", site.getUuid());
}
Also used : ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

Example 14 with ConfigurationImpl

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

the class CoordinatorClientImpl method setNodeDualInetAddressInfo.

/**
 * Set node info to zk so that it can be available for lookup in coordinatorclient.
 *
 * @param nodeId the node_id to be persisted
 * @param addresses A string of ip addresses(v4/v6) with ',' as separator
 */
public void setNodeDualInetAddressInfo(String nodeId, String addresses) {
    // grab a lock and verifyPublishedDualInetAddress first
    InterProcessLock lock = null;
    try {
        lock = getLock(Constants.NODE_DUALINETADDR_CONFIG + nodeId);
        lock.acquire();
        if (!verifyPublishedDualInetAddress(nodeId)) {
            ConfigurationImpl cfg = new ConfigurationImpl();
            cfg.setId(nodeId);
            cfg.setKind(Constants.NODE_DUALINETADDR_CONFIG);
            cfg.setConfig(Constants.CONFIG_DUAL_INETADDRESSES, addresses);
            persistServiceConfiguration(cfg);
        }
    } catch (Exception e) {
        log.warn("Unexpected exception during setNodeDualInetAddressInfo()", e);
    } finally {
        if (lock != null) {
            try {
                lock.release();
            } catch (Exception e) {
                log.warn("Unexpected exception unlocking in setNodeDualInetAddressInfo()", e);
            }
        }
    }
}
Also used : InterProcessLock(org.apache.curator.framework.recipes.locks.InterProcessLock) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Example 15 with ConfigurationImpl

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

the class CoordinatorClientImpl method createSiteSpecificSection.

private void createSiteSpecificSection() throws Exception {
    // create VDC parent ZNode for site config in ZK
    ConfigurationImpl vdcConfig = new ConfigurationImpl();
    vdcConfig.setKind(Site.CONFIG_KIND);
    vdcConfig.setId(vdcShortId);
    persistServiceConfiguration(vdcConfig);
    // insert DR active site info to ZK
    Site site = new Site();
    site.setUuid(getSiteId());
    site.setName("Default Site");
    site.setVdcShortId(vdcShortId);
    site.setSiteShortId(Constants.CONFIG_DR_FIRST_SITE_SHORT_ID);
    site.setState(SiteState.ACTIVE);
    site.setCreationTime(System.currentTimeMillis());
    if (StringUtils.isBlank(vip)) {
        site.setVip(PropertyConstants.IPV4_ADDR_DEFAULT);
    } else {
        site.setVip(vip);
    }
    if (StringUtils.isBlank(vip6)) {
        site.setVip6(PropertyConstants.IPV6_ADDR_DEFAULT);
    } else {
        site.setVip6(DualInetAddress.normalizeInet6Address(vip6));
    }
    site.setNodeCount(getNodeCount());
    Map<String, DualInetAddress> controlNodes = getInetAddessLookupMap().getControllerNodeIPLookupMap();
    Map<String, String> ipv4Addresses = new HashMap<>();
    Map<String, String> ipv6Addresses = new HashMap<>();
    String nodeId;
    int nodeIndex = 1;
    for (Map.Entry<String, DualInetAddress> cnode : controlNodes.entrySet()) {
        nodeId = VDC_NODE_PREFIX + nodeIndex++;
        DualInetAddress addr = cnode.getValue();
        if (addr.hasInet4()) {
            ipv4Addresses.put(nodeId, addr.getInet4());
        } else {
            ipv4Addresses.put(nodeId, PropertyConstants.IPV4_ADDR_DEFAULT);
        }
        if (addr.hasInet6()) {
            ipv6Addresses.put(nodeId, DualInetAddress.normalizeInet6Address(addr.getInet6()));
        } else {
            ipv6Addresses.put(nodeId, PropertyConstants.IPV6_ADDR_DEFAULT);
        }
    }
    site.setHostIPv4AddressMap(ipv4Addresses);
    site.setHostIPv6AddressMap(ipv6Addresses);
    persistServiceConfiguration(site.toConfiguration());
    new DrUtil(this).setLocalVdcShortId(vdcShortId);
    // update Site version in ZK
    SiteInfo siteInfo = new SiteInfo(System.currentTimeMillis(), SiteInfo.NONE);
    setTargetInfo(siteInfo);
    addSite(site.getUuid());
    log.info("Create site specific section for {} successfully", site.getUuid());
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) SiteInfo(com.emc.storageos.coordinator.client.model.SiteInfo) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil) PropertyInfoMapper.decodeFromString(com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap)

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