use of com.emc.storageos.geomodel.VdcPreCheckParam2 in project coprhd-controller by CoprHD.
the class AbstractVdcTaskOp method notifyPrecheckFailed.
protected void notifyPrecheckFailed() {
if (operatedVdc == null) {
return;
}
for (VirtualDataCenter vdc : connectedVdc) {
if (operatedVdc.getId().equals(vdc.getId()) || myVdcId.equals(vdc.getId().toString())) {
// Don't check on the vdc to be disconnected and myself
continue;
}
try {
// BZ
// TODO need to have a different REST call to modify state of a remote VDC; PrecheckRequest2 should be used to check remote
// VDC.
// TODO need to have a different locking mecanism to set lock against concurrent VDC operations.
VdcPreCheckParam2 param = new VdcPreCheckParam2();
param.setConfigChangeType(changeType());
List<URI> ids = new ArrayList(1);
ids.add(operatedVdc.getId());
param.setVdcIds(ids);
param.setPrecheckFailed(true);
param.setDefaultVdcState(operatedVdcStatus.toString());
sendVdcPrecheckRequest2(vdc, param, DEFAULT_NODE_CHECK_TIMEOUT);
} catch (Exception ex) {
log.error("Failed to notify vdc : {} that recheckFaled ", vdc.getShortId());
}
}
}
use of com.emc.storageos.geomodel.VdcPreCheckParam2 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;
}
use of com.emc.storageos.geomodel.VdcPreCheckParam2 in project coprhd-controller by CoprHD.
the class ReconnectVdcTaskOp method checkReconnectingVdc.
private void checkReconnectingVdc() {
VdcPreCheckParam2 param = new VdcPreCheckParam2();
param.setConfigChangeType(changeType());
Map<String, List<String>> blackLists = dbClient.getBlacklist();
List<String> blackList = new ArrayList();
Collection<List<String>> lists = blackLists.values();
for (List<String> list : lists) {
blackList = list;
// since all lists are same, so we only need the first one
break;
}
param.setBlackList(blackList);
List<String> whiteList = getWhiteList();
param.setWhiteList(whiteList);
List<URI> ids = new ArrayList(1);
ids.add(myVdc.getId());
param.setVdcIds(ids);
log.info("checkReconnectingVdc param={}", param);
VdcPreCheckResponse2 resp2 = null;
try {
resp2 = sendVdcPrecheckRequest2(operatedVdc, param, NODE_CHECK_TIMEOUT);
} catch (Exception ex) {
log.error("Precheck the reconnected vdc {} failed: {}", operatedVdc.getShortId(), ex);
throw ex;
}
if (resp2.getCompatible() == false) {
log.error("Precheck the reconnected vdc {} failed", operatedVdc.getShortId());
throw GeoException.fatals.reconnectVdcIncompatible();
}
log.info("The precheck reconnect vdc {} is passed", operatedVdc.getShortId());
}
use of com.emc.storageos.geomodel.VdcPreCheckParam2 in project coprhd-controller by CoprHD.
the class DisconnectVdcTaskOp method checkDisconnectingConcurrency.
private void checkDisconnectingConcurrency() {
// Reject the disconnect request if there is any vdc that is under disconnecting
// check local db first
VirtualDataCenter disconnectingVdc = helper.getDisconnectingVdc();
if (disconnectingVdc != null) {
log.error("There is already a VDC {} under disconnecting", disconnectingVdc.getId());
throw GeoException.fatals.disconnectVdcConcurrentCheckFail(disconnectingVdc.getLabel());
}
for (VirtualDataCenter vdc : connectedVdc) {
if (operatedVdc.getId().equals(vdc.getId()) || myVdcId.equals(vdc.getId().toString())) {
// Don't check on the vdc to be disconnected and myself
continue;
}
VdcPreCheckParam2 param = new VdcPreCheckParam2();
param.setConfigChangeType(changeType());
List<URI> vdcIds = new ArrayList(2);
vdcIds.add(operatedVdc.getId());
vdcIds.add(myVdc.getId());
param.setVdcIds(vdcIds);
log.info("'disconnect vdc' precheck2 paramerte={}", param);
VdcPreCheckResponse2 resp2 = null;
try {
resp2 = sendVdcPrecheckRequest2(vdc, param, DEFAULT_NODE_CHECK_TIMEOUT);
} catch (Exception ex) {
log.error("Precheck the reconnected vdc {} failed: {}", operatedVdc.getShortId(), ex);
notifyPrecheckFailed();
throw ex;
}
if (resp2.getId() != null) {
log.error("There is already a VDC {} under disconnecting", disconnectingVdc);
notifyPrecheckFailed();
throw GeoException.fatals.disconnectVdcConcurrentCheckFail(disconnectingVdc.getLabel());
}
if (resp2.getCompatible() == false) {
log.error("The local vdc {} has been disconnected", myVdcId);
throw GeoException.fatals.disconnectVdcInvalidStatus(myVdc.getLabel());
}
}
}
Aggregations