use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.
the class VdcConfigHelper method areNodesReachable.
/**
* tries to connect to each node in each vdc
*
* @param vdcId - the Id of the target VDC
* @return true if all nodes of the target Vdc is reachable
*/
public boolean areNodesReachable(URI vdcId) {
if (vdcId == null) {
throw new IllegalArgumentException("The target Vdc short ID should not be null or empty");
}
VirtualDataCenter vdc = dbClient.queryObject(VirtualDataCenter.class, vdcId);
Site activeSite = drUtil.getActiveSite(vdc.getShortId());
if (areNodesReachable(vdc.getShortId(), activeSite.getHostIPv4AddressMap(), activeSite.getHostIPv6AddressMap(), false)) {
return true;
}
return false;
}
use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.
the class VdcConfigHelper method getDisconnectedVirtualDataCenter.
private VirtualDataCenter getDisconnectedVirtualDataCenter(VdcPostCheckParam checkParam) {
List<URI> vdcIds = checkParam.getVdcList();
if (vdcIds.size() != 1) {
String errMsg = String.format("There are more than one disconnected VDCs:%s", vdcIds.toString());
throw new IllegalArgumentException(errMsg);
}
URI vdcId = vdcIds.get(0);
VirtualDataCenter disconnectedVdc = dbClient.queryObject(VirtualDataCenter.class, vdcId);
if (disconnectedVdc == null) {
throw GeoException.fatals.disconnectVdcFailed(vdcId, new Exception("The disconnected vdc can't be found"));
}
return disconnectedVdc;
}
use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.
the class VdcConfigHelper method addVdcToCassandraStrategyOptions.
public void addVdcToCassandraStrategyOptions(List<VdcConfig> vdcConfigs, VirtualDataCenter vdc, boolean wait) throws Exception {
log.info("add vdc {} to strategy options");
for (VdcConfig vdcCfg : vdcConfigs) {
if (vdcCfg.getId().equals(vdc.getId())) {
log.info("find the vdc cfg {}", vdcCfg);
// update the VirtualDataCenter object of the vdc
mergeVdcConfig(vdcCfg);
vdc = dbClient.queryObject(VirtualDataCenter.class, vdc.getId());
addStrategyOption(vdc, wait);
break;
}
}
}
use of com.emc.storageos.db.client.model.VirtualDataCenter in project coprhd-controller by CoprHD.
the class AbstractVdcTaskOp method updateVdcStatus.
/*
*
* This function only used for reconnect and disconnect
* Input parameter should be CONNECTED or DISCONNECTED
*
* @param isSyncOperatedVdc, only used for reconnect operation to sync operated vdc, it will trigger a node repair.
*/
protected void updateVdcStatus(VirtualDataCenter.ConnectionStatus status, boolean isSyncOperatedVdc) {
updateOpStatus(status);
VdcConfig.ConfigChangeType configChangeType;
log.info("the connection status is {}", status);
switch(status) {
case CONNECTED:
configChangeType = VdcConfig.ConfigChangeType.RECONNECT_VDC;
break;
case DISCONNECTED:
configChangeType = VdcConfig.ConfigChangeType.DISCONNECT_VDC;
break;
default:
throw FatalGeoException.fatals.vdcWrongStatus(status.toString());
}
for (VirtualDataCenter vdc : allVdc) {
if (vdc.getId().equals(operatedVdc.getId()) && (configChangeType == VdcConfig.ConfigChangeType.RECONNECT_VDC)) {
vdc.setConnectionStatus(VirtualDataCenter.ConnectionStatus.CONNECTED);
break;
}
}
VdcConfigSyncParam syncParam = buildConfigParam(allVdc);
syncParam.setAssignedVdcId(operatedVdc.getId().toString());
List<VirtualDataCenter> vdcsToBeSynced = new ArrayList<>();
if (isSyncOperatedVdc) {
VirtualDataCenter vdc = dbClient.queryObject(VirtualDataCenter.class, operatedVdc.getId());
vdcsToBeSynced.add(vdc);
log.info("Update vdc config for operated vdc {}", operatedVdc);
} else {
vdcsToBeSynced = getToBeSyncedVdc();
if (doesContainOperatedVdc()) {
log.info("Remove operatedVdc {} from the list {}", operatedVdc, vdcsToBeSynced);
vdcsToBeSynced = removeOperatedVdc(vdcsToBeSynced);
}
log.info("Update vdc status {} to connected vdcs={}", operatedVdc, vdcsToBeSynced);
}
sendSyncVdcConfigMsg(vdcsToBeSynced, syncParam);
}
use of com.emc.storageos.db.client.model.VirtualDataCenter 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());
}
}
}
Aggregations