Search in sources :

Example 21 with Configuration

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

the class DrPostFailoverHandler method isCompleted.

/**
 * Check if current handler is completed.
 *
 * @return true for completed. Otherwise false
 */
protected boolean isCompleted() {
    Configuration config = coordinator.queryConfiguration(CONFIG_KIND, CONFIG_ID);
    String value = config.getConfig(name);
    if (value != null && Status.COMPLETED.toString().equals(value)) {
        return true;
    }
    return false;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 22 with Configuration

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

the class DrPostFailoverHandler method isAllHandlersCompleted.

/**
 * Check if all handlers are completed.
 *
 * @return
 */
protected boolean isAllHandlersCompleted() {
    Configuration config = coordinator.queryConfiguration(CONFIG_KIND, CONFIG_ID);
    Map<String, String> allHandlers = config.getAllConfigs(true);
    for (String key : allHandlers.keySet()) {
        String status = allHandlers.get(key);
        if (!Status.COMPLETED.toString().equals(status)) {
            return false;
        }
    }
    return true;
}
Also used : Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 23 with Configuration

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

the class DrUtil method getVdcSiteMap.

/**
 * Get a map of all sites of all vdcs.
 * The keys are VDC short ids, the values are lists of sites within each vdc
 *
 * @return map of vdc -> list of sites
 */
public Map<String, List<Site>> getVdcSiteMap() {
    Map<String, List<Site>> vdcSiteMap = new HashMap<>();
    for (Configuration vdcConfig : coordinator.queryAllConfiguration(Site.CONFIG_KIND)) {
        String siteKind = String.format("%s/%s", Site.CONFIG_KIND, vdcConfig.getId());
        List<Site> sites = new ArrayList<>();
        for (Configuration siteConfig : coordinator.queryAllConfiguration(siteKind)) {
            sites.add(new Site(siteConfig));
        }
        if (sites.size() > 0) {
            vdcSiteMap.put(vdcConfig.getId(), sites);
        }
    }
    return vdcSiteMap;
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) Configuration(com.emc.storageos.coordinator.common.Configuration) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 24 with Configuration

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

the class DrUtil method getSiteFromLocalVdc.

/**
 * Load site information from local vdc
 *
 * @param siteId
 * @return
 */
public Site getSiteFromLocalVdc(String siteId) {
    String siteKind = String.format("%s/%s", Site.CONFIG_KIND, getLocalVdcShortId());
    Configuration config = coordinator.queryConfiguration(siteKind, siteId);
    if (config != null) {
        return new Site(config);
    }
    throw CoordinatorException.retryables.cannotFindSite(siteId);
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) Configuration(com.emc.storageos.coordinator.common.Configuration)

Example 25 with Configuration

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

the class CoordinatorClientImpl method verifyPublishedDualInetAddress.

/**
 * Returns true is found published DualInetAddress for this node, and it matches with current
 * configured
 *
 * @param nodeId
 * @return
 */
private boolean verifyPublishedDualInetAddress(String nodeId) {
    DualInetAddress dualAddress = null;
    Configuration config = queryConfiguration(Constants.NODE_DUALINETADDR_CONFIG, nodeId);
    if (config != null) {
        dualAddress = parseInetAddressConfig(config);
    }
    if ((dualAddress != null) && dualAddress.equals(inetAddressLookupMap.getDualInetAddress())) {
        return true;
    }
    return false;
}
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