Search in sources :

Example 26 with VirtualDataCenter

use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.

the class AbstractVdcTaskOp method buildConfigParam.

/**
 * Build parameter for SyncVdcConfig call
 *
 * @param vdcList
 * @return
 */
protected VdcConfigSyncParam buildConfigParam(List<VirtualDataCenter> vdcList) {
    VdcConfigSyncParam syncParam = new VdcConfigSyncParam();
    syncParam.setVdcConfigVersion(DrUtil.newVdcConfigVersion());
    syncParam.setIpsecKey(ipsecConfig.getPreSharedKeyFromZK());
    for (VirtualDataCenter vdc : vdcList) {
        syncParam.getVirtualDataCenters().add(helper.toConfigParam(vdc));
    }
    syncParam.setConfigChangeType(changeType().toString());
    return syncParam;
}
Also used : VdcConfigSyncParam(com.emc.storageos.geomodel.VdcConfigSyncParam) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Example 27 with VirtualDataCenter

use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.

the class AbstractVdcTaskOp method sendPostCheckMsg.

protected void sendPostCheckMsg(List<VirtualDataCenter> vdcList, VdcPostCheckParam checkParam) {
    for (VirtualDataCenter vdc : vdcList) {
        sendPostCheckMsg(checkParam, vdc);
    }
    checkParam.setFresher(false);
    // notify local vdc to do post steps either
    helper.syncVdcConfigPostSteps(checkParam);
}
Also used : VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Example 28 with VirtualDataCenter

use of com.emc.storageos.db.client.model.VirtualDataCenter 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 29 with VirtualDataCenter

use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.

the class AbstractVdcTaskOp method isVdcVersion20.

/**
 * For disconnect and reconnect operations, every living connected vdc's version should at least 2.1 or higher.
 */
protected boolean isVdcVersion20() {
    log.info("Checking to see if every living vdc's version is 2.0");
    // get geoClientCache to get the version for each vdc
    for (VirtualDataCenter vdc : connectedVdc) {
        if (vdc.getId().equals(operatedVdc.getId())) {
            continue;
        }
        if (vdc.getConnectionStatus() == VirtualDataCenter.ConnectionStatus.CONNECTED) {
            String viPRVersion = helper.getViPRVersion(vdc.getShortId());
            if (viPRVersion.startsWith(VIPR_INVALID_VERSION_PREFIX)) {
                errMsg = String.format("The vipr version for vdc %s is 2.0", vdc.getLabel());
                log.info("The vipr version for vdc {} is 2.0", vdc.getShortId());
                return true;
            }
        }
    }
    return false;
}
Also used : VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Example 30 with VirtualDataCenter

use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.

the class AbstractVdcTaskOp method isAllConnectedVdcReachableWith.

/**
 * Make sure all the connected(the status is connected, not the connectedVdc instance in this class ) vdc is
 * reachable by the targetVdc, there are two usages here:
 * 1. verify if the operatedVdc is back online and reachble with other connected vdcs,
 * 2. verify current vdc is reachable with other connected vdcs.
 */
protected boolean isAllConnectedVdcReachableWith(VirtualDataCenter targetVdc) {
    log.info("Checking to see if the vdc {} is reachable with other connected VDCs", targetVdc.getShortId());
    // Go through the connected list
    for (VirtualDataCenter vdc : connectedVdc) {
        // Don't need to check if the target vdc is reachable with itself
        if (vdc.getId().equals(targetVdc.getId())) {
            continue;
        }
        VdcNodeCheckResponse resp = null;
        List<VirtualDataCenter> vdcs = new ArrayList(1);
        vdcs.add(targetVdc);
        try {
            // vdcResp = sendVdcCheckRequest(vdc, operatedVdc);
            resp = helper.sendVdcNodeCheckRequest(vdc, vdcs);
            if (!resp.isNodesReachable()) {
                log.error("the vdc {} can not be reached by target Vdc {}", vdc.getShortId(), targetVdc.getShortId());
                errMsg = String.format("The Vdc %s can not be reached by target Vdc %s", vdc.getId().toString(), targetVdc.getId().toString());
                return false;
            }
        } catch (GeoException e) {
            errMsg = e.getMessage();
            return false;
        } catch (IllegalStateException e) {
            errMsg = e.getMessage();
            return false;
        }
    }
    return true;
}
Also used : VdcNodeCheckResponse(com.emc.storageos.geomodel.VdcNodeCheckResponse) GeoException(com.emc.storageos.security.geo.exceptions.GeoException) FatalGeoException(com.emc.storageos.security.geo.exceptions.FatalGeoException) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter) ArrayList(java.util.ArrayList)

Aggregations

VirtualDataCenter (com.emc.storageos.db.client.model.VirtualDataCenter)80 URI (java.net.URI)47 ArrayList (java.util.ArrayList)20 VdcConfig (com.emc.storageos.geomodel.VdcConfig)14 GeoException (com.emc.storageos.security.geo.exceptions.GeoException)13 Test (org.junit.Test)10 Site (com.emc.storageos.coordinator.client.model.Site)7 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)7 VdcConfigSyncParam (com.emc.storageos.geomodel.VdcConfigSyncParam)7 FatalGeoException (com.emc.storageos.security.geo.exceptions.FatalGeoException)7 NamedURI (com.emc.storageos.db.client.model.NamedURI)6 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)5 Produces (javax.ws.rs.Produces)5 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)4 DataObject (com.emc.storageos.db.client.model.DataObject)4 TestGeoObject (com.emc.storageos.db.client.model.TestGeoObject)4 ConnectionException (com.netflix.astyanax.connectionpool.exceptions.ConnectionException)4 KeyStoreException (java.security.KeyStoreException)4 POST (javax.ws.rs.POST)4 Path (javax.ws.rs.Path)4