Search in sources :

Example 76 with Site

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

the class ConnectVdcTaskOp method postCheck.

private void postCheck() {
    log.info("vdc config info already synced to all connected vdc, start post check");
    if (myVdc == null) {
        getMyVdcId();
    }
    // step 4: wait for the gossip status
    dbClient.waitAllSitesDbStable();
    // reload operated vdc from db
    operatedVdc = dbClient.queryObject(VirtualDataCenter.class, operatedVdc.getId());
    Site activeSite = drUtil.getActiveSite(operatedVdc.getShortId());
    // check if network strategy updated successfully
    dbClient.waitDbRingRebuildDone(operatedVdc.getShortId(), activeSite.getNodeCount());
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Example 77 with Site

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

the class InternalDbClient method waitAllSitesDbStable.

/**
 * Waits for the db instances joined in all sites
 */
public void waitAllSitesDbStable() {
    String prefix = "Waiting for DB cluster become stable on all sites ...";
    log.info(prefix);
    DbJmxClient geoInstance = getJmxClient(LOCALHOST);
    // Loop all VDC
    List<URI> vdcIdIter = queryByType(VirtualDataCenter.class, true);
    for (URI vdcId : vdcIdIter) {
        log.info("loop db status check on {}", vdcId.toString());
        VirtualDataCenter vdc = queryObject(VirtualDataCenter.class, vdcId);
        // filter out vdcs that are not connected in geo
        if (!shouldCheckDbStatus(vdc)) {
            log.error("ignore vdc for db status check {}", vdcId);
            continue;
        }
        if (vdc.getConnectionStatus() != ConnectionStatus.DISCONNECTED) {
            Site activeSite = drUtil.getActiveSite(vdc.getShortId());
            // short Id
            waitDbNodesStable(geoInstance, vdc.getShortId(), activeSite.getNodeCount());
        }
    }
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter) URI(java.net.URI)

Example 78 with Site

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

the class VdcConfigHelper method toConfigParam.

/**
 * Build VdcConfig for a vdc for SyncVdcConfig call
 *
 * @param vdc
 * @return
 */
public VdcConfig toConfigParam(VirtualDataCenter vdc) {
    log.info("copy {} to the sync config param", vdc.getShortId());
    VdcConfig vdcConfig = new VdcConfig();
    Site activeSite = drUtil.getActiveSite(vdc.getShortId());
    vdcConfig.setId(vdc.getId());
    vdcConfig.setShortId(vdc.getShortId());
    vdcConfig.setSecretKey(vdc.getSecretKey());
    if ((vdc.getLabel() != null) && (!vdc.getLabel().isEmpty())) {
        vdcConfig.setName(vdc.getLabel());
    }
    if ((vdc.getDescription() != null) && (!vdc.getDescription().isEmpty())) {
        vdcConfig.setDescription(vdc.getDescription());
    }
    if (activeSite.getVipEndPoint() != null) {
        vdcConfig.setApiEndpoint(activeSite.getVipEndPoint());
    }
    vdcConfig.setHostCount(activeSite.getNodeCount());
    HashMap<String, String> ipv4AddrMap = new HashMap<String, String>(activeSite.getHostIPv4AddressMap());
    vdcConfig.setHostIPv4AddressesMap(ipv4AddrMap);
    HashMap<String, String> ipv6AddrMap = new HashMap<String, String>(activeSite.getHostIPv6AddressMap());
    vdcConfig.setHostIPv6AddressesMap(ipv6AddrMap);
    vdcConfig.setVersion(vdc.getVersion());
    vdcConfig.setConnectionStatus(vdc.getConnectionStatus().toString());
    vdcConfig.setRepStatus(vdc.getRepStatus().toString());
    vdcConfig.setGeoCommandEndpoint(vdc.getGeoCommandEndpoint());
    vdcConfig.setGeoDataEndpoint(vdc.getGeoDataEndpoint());
    vdcConfig.setActiveSiteId(activeSite.getUuid());
    return vdcConfig;
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) HashMap(java.util.HashMap) VdcConfig(com.emc.storageos.geomodel.VdcConfig)

Example 79 with Site

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

the class VdcConfigHelper method sendVdcNodeCheckRequest.

/**
 * Send node check request to target vdc.
 *
 * @param sendToVdc vdc to send msg to
 * @param vdcsToCheck list of vdc's with nodes to check
 * @return
 * @throws Exception
 */
public VdcNodeCheckResponse sendVdcNodeCheckRequest(VirtualDataCenter sendToVdc, Collection<VirtualDataCenter> vdcsToCheck) {
    List<VdcConfig> virtualDataCenters = new ArrayList<VdcConfig>();
    for (VirtualDataCenter vdc : vdcsToCheck) {
        VdcConfig vdcConfig = new VdcConfig();
        vdcConfig.setId(vdc.getId());
        vdcConfig.setShortId(vdc.getShortId());
        Site activeSite = drUtil.getActiveSite(vdc.getShortId());
        if (activeSite.getHostIPv4AddressMap() != null && !activeSite.getHostIPv4AddressMap().isEmpty() && activeSite.isUsingIpv4()) {
            HashMap<String, String> addressMap = new HashMap<String, String>(activeSite.getHostIPv4AddressMap());
            vdcConfig.setHostIPv4AddressesMap(addressMap);
        } else if (activeSite.getHostIPv6AddressMap() != null && !activeSite.getHostIPv6AddressMap().isEmpty()) {
            HashMap<String, String> addressMap = new HashMap<String, String>(activeSite.getHostIPv6AddressMap());
            vdcConfig.setHostIPv6AddressesMap(addressMap);
        } else {
            throw new IllegalStateException("Cannot perform node reachable check on vdc " + vdc.getShortId() + " no nodes were found on VirtualDataCenter object");
        }
        virtualDataCenters.add(vdcConfig);
    }
    return sendVdcNodeCheckRequest(sendToVdc, virtualDataCenters);
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) HashMap(java.util.HashMap) VdcConfig(com.emc.storageos.geomodel.VdcConfig) ArrayList(java.util.ArrayList) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

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