Search in sources :

Example 1 with VdcNodeCheckResponse

use of com.emc.storageos.geomodel.VdcNodeCheckResponse 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)

Example 2 with VdcNodeCheckResponse

use of com.emc.storageos.geomodel.VdcNodeCheckResponse in project coprhd-controller by CoprHD.

the class ConnectVdcTaskOp method checkNodeConnectivity.

private boolean checkNodeConnectivity(VdcPreCheckResponse vdcBeingAdded) {
    // check to make sure the current vdc can connect to all nodes on the vdc being added
    if (!helper.areNodesReachable(vdcBeingAdded.getShortId(), vdcBeingAdded.getHostIPv4AddressesMap(), vdcBeingAdded.getHostIPv6AddressesMap(), false)) {
        errMsg = String.format("Current vdc, %s, cannot reach all nodes of vdc being added", myVdc.getLabel());
        log.error(errMsg);
        return false;
    }
    // check to make sure the vdc being added can connect to the current and all other vdc's
    log.info("sending node check request to vdc: {}", vdcInfo.getProperty(GeoServiceJob.OPERATED_VDC_ID));
    VdcNodeCheckResponse vdcResp = sendVdcNodeCheckRequest(vdcInfo, connectedVdc);
    if (!vdcResp.isNodesReachable()) {
        errMsg = "vdc to be added cannot connect to all nodes of at least one of the vdcs in the federation";
        log.error(errMsg);
        return false;
    }
    // check to make sure the vdc being added can connect to the current and all other vdc's
    List<VdcConfig> vdcConfigs = new ArrayList<VdcConfig>();
    vdcConfigs.add(mergeVdcInfo(vdcBeingAdded));
    for (VirtualDataCenter other : connectedVdc) {
        if (other.getShortId().equals(myVdc.getShortId())) {
            continue;
        }
        log.info("sending node check request to vdc: {}", other.getShortId());
        vdcResp = sendVdcNodeCheckRequest(GeoServiceHelper.getVDCInfo(other), vdcConfigs);
        if (!vdcResp.isNodesReachable()) {
            errMsg = String.format("vdc, %s, cannot connect to all nodes of the vdc being added", other.getLabel());
            log.error(errMsg);
            return false;
        }
    }
    errMsg = checkNetworkTopology(vdcBeingAdded);
    if (errMsg != null && errMsg.length() > 0) {
        return false;
    }
    return true;
}
Also used : VdcNodeCheckResponse(com.emc.storageos.geomodel.VdcNodeCheckResponse) VdcConfig(com.emc.storageos.geomodel.VdcConfig) ArrayList(java.util.ArrayList) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Example 3 with VdcNodeCheckResponse

use of com.emc.storageos.geomodel.VdcNodeCheckResponse in project coprhd-controller by CoprHD.

the class VdcConfigService method toVdcNodeCheckResponse.

/**
 * @param from
 * @param areNodesReachable
 * @return
 */
private VdcNodeCheckResponse toVdcNodeCheckResponse(VirtualDataCenter from, boolean areNodesReachable) {
    VdcNodeCheckResponse to = new VdcNodeCheckResponse();
    to.setId(from.getId());
    to.setShortId(from.getShortId());
    to.setNodesReachable(areNodesReachable);
    return to;
}
Also used : VdcNodeCheckResponse(com.emc.storageos.geomodel.VdcNodeCheckResponse)

Aggregations

VdcNodeCheckResponse (com.emc.storageos.geomodel.VdcNodeCheckResponse)3 VirtualDataCenter (com.emc.storageos.db.client.model.VirtualDataCenter)2 ArrayList (java.util.ArrayList)2 VdcConfig (com.emc.storageos.geomodel.VdcConfig)1 FatalGeoException (com.emc.storageos.security.geo.exceptions.FatalGeoException)1 GeoException (com.emc.storageos.security.geo.exceptions.GeoException)1