Search in sources :

Example 36 with Site

use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.

the class AbstractVdcTaskOp method isTargetVdcReachable.

/**
 * Make sure the vdc is reachable from any of the
 * connected VDCs
 */
protected boolean isTargetVdcReachable(int nodeCheckTimeout_ms) {
    log.info("Checking to see if the vdc {} is reachable from connected VDCs", operatedVdc.getShortId());
    // Go through the connected list
    for (VirtualDataCenter vdc : connectedVdc) {
        if (vdc.getConnectionStatus() == VirtualDataCenter.ConnectionStatus.DISCONNECTED) {
            // skip the disconnected VDC
            continue;
        }
        if (vdc.getId().equals(operatedVdc.getId())) {
            // skip the VDC to be disconnected
            continue;
        }
        if (vdc.getLocal()) {
            Site activeSite = drUtil.getActiveSite(operatedVdc.getShortId());
            if (helper.areNodesReachable(vdc.getShortId(), activeSite.getHostIPv4AddressMap(), activeSite.getHostIPv6AddressMap(), true)) {
                return true;
            }
            continue;
        }
        // non-local vdcs
        VdcPreCheckParam2 checkParam2 = new VdcPreCheckParam2();
        checkParam2.setConfigChangeType(VdcConfig.ConfigChangeType.DISCONNECT_VDC);
        List<URI> vdcIds = new ArrayList(1);
        vdcIds.add(operatedVdc.getId());
        checkParam2.setVdcIds(vdcIds);
        checkParam2.setIsAllNotReachable(true);
        try {
            VdcPreCheckResponse2 resp2 = sendVdcPrecheckRequest2(vdc, checkParam2, nodeCheckTimeout_ms);
            if (!resp2.getIsAllNodesNotReachable()) {
                errMsg = String.format("The vdc %s to be disconnected is still reachable from %s", operatedVdc.getShortId(), vdc.getShortId());
                log.error(errMsg);
                return true;
            }
        } catch (Exception e) {
            log.error("Failed to check the operatedVdc {} on the vdc {} e=", new Object[] { operatedVdc.getShortId(), vdc.getShortId(), e });
            continue;
        }
    }
    return false;
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter) ArrayList(java.util.ArrayList) VdcPreCheckResponse2(com.emc.storageos.geomodel.VdcPreCheckResponse2) VdcPreCheckParam2(com.emc.storageos.geomodel.VdcPreCheckParam2) URI(java.net.URI) KeyStoreException(java.security.KeyStoreException) GeoException(com.emc.storageos.security.geo.exceptions.GeoException) CertificateException(java.security.cert.CertificateException) FatalGeoException(com.emc.storageos.security.geo.exceptions.FatalGeoException)

Example 37 with Site

use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.

the class InternalDbClient method queryHostIPAddressesMap.

public Map<String, String> queryHostIPAddressesMap(VirtualDataCenter vdc) {
    Site activeSite = drUtil.getActiveSite(vdc.getShortId());
    Map<String, String> hostIPv4AddressMap = activeSite.getHostIPv4AddressMap();
    if (hostIPv4AddressMap != null && !hostIPv4AddressMap.isEmpty() && activeSite.isUsingIpv4()) {
        return hostIPv4AddressMap;
    }
    return activeSite.getHostIPv6AddressMap();
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site)

Example 38 with Site

use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.

the class BackupOps method getNodesInfo.

public Map<String, URI> getNodesInfo() throws URISyntaxException {
    List<Service> services = coordinatorClient.locateAllServices(((CoordinatorClientImpl) coordinatorClient).getSysSvcName(), ((CoordinatorClientImpl) coordinatorClient).getSysSvcVersion(), null, null);
    // get URL schema and port
    Service svc = services.get(0);
    URI uri = svc.getEndpoint();
    int port = uri.getPort();
    String scheme = uri.getScheme();
    DrUtil util = new DrUtil();
    util.setCoordinator(coordinatorClient);
    Site localSite = util.getLocalSite();
    Map<String, String> addresses = localSite.getHostIPv4AddressMap();
    if (!localSite.isUsingIpv4()) {
        addresses = localSite.getHostIPv6AddressMap();
    }
    Map<String, URI> nodesInfo = new HashMap();
    for (Map.Entry<String, String> addr : addresses.entrySet()) {
        String nodeUri = scheme + "://" + addr.getValue() + ":" + port + "/";
        nodesInfo.put(addr.getKey(), new URI(nodeUri));
    }
    return nodesInfo;
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil) Service(com.emc.storageos.coordinator.common.Service) URI(java.net.URI) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)

Example 39 with Site

use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.

the class DbManager method checkAndSetIncrementalSyncing.

private void checkAndSetIncrementalSyncing(InetAddress endpoint) {
    Site site = getSite(endpoint);
    if (site == null) {
        log.info("Unknown site for {}. Skip HandoffLogDetector", endpoint);
        return;
    }
    log.info("Node {} in site {} comes online", endpoint, site.getUuid());
    if (site.getState() == SiteState.STANDBY_SYNCED) {
        SiteMonitorResult monitorResult = drUtil.getCoordinator().getTargetInfo(site.getUuid(), SiteMonitorResult.class);
        if (monitorResult == null || monitorResult.getDbQuorumLostSince() == 0) {
            log.info("No db quorum lost on standby site. Skip this node up event on {} ", endpoint);
            return;
        }
        if (hasPendingHintedHandoff(endpoint)) {
            log.info("Hinted handoff logs detected. Change site {} state to STANDBY_INCR_SYNCING", site.getUuid());
            site.setState(SiteState.STANDBY_INCR_SYNCING);
            drUtil.getCoordinator().persistServiceConfiguration(site.toConfiguration());
        }
    } else {
        log.info("Skip hinted handoff logs detector for {} due to site state is {}. ", endpoint, site.getState());
    }
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) SiteMonitorResult(com.emc.storageos.coordinator.client.model.SiteMonitorResult)

Example 40 with Site

use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.

the class DbRebuildRunnable method purgeOldDataRevision.

private void purgeOldDataRevision(DrUtil drUtil) {
    try {
        coordinator.startTransaction();
        log.info("Purge old data revisions after resync data from active site");
        long vdcTargetVersion = DrUtil.newVdcConfigVersion();
        String localSiteId = drUtil.getLocalSite().getUuid();
        for (Site site : drUtil.listSites()) {
            drUtil.updateVdcTargetVersion(site.getUuid(), SiteInfo.DR_OP_PURGE_DATA_REVISION, vdcTargetVersion, localSiteId, localSiteId);
        }
        coordinator.commitTransaction();
    } catch (Exception e) {
        log.warn("Failed to purge old data revision on local", e);
        coordinator.discardTransaction();
    }
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException)

Aggregations

Site (com.emc.storageos.coordinator.client.model.Site)79 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)21 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)21 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)20 UnknownHostException (java.net.UnknownHostException)18 Produces (javax.ws.rs.Produces)17 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)16 Path (javax.ws.rs.Path)15 ZkPath (com.emc.storageos.coordinator.common.impl.ZkPath)14 ArrayList (java.util.ArrayList)14 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)11 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)11 InterProcessLock (org.apache.curator.framework.recipes.locks.InterProcessLock)11 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)10 POST (javax.ws.rs.POST)10 SiteState (com.emc.storageos.coordinator.client.model.SiteState)9 Configuration (com.emc.storageos.coordinator.common.Configuration)8 VirtualDataCenter (com.emc.storageos.db.client.model.VirtualDataCenter)8 Consumes (javax.ws.rs.Consumes)8 ClusterInfo (com.emc.vipr.model.sys.ClusterInfo)6