use of com.emc.storageos.coordinator.client.model.Site 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.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class InternalDbClient method queryHostIPAddressesMap.
public Map<String, String> queryHostIPAddressesMap(VirtualDataCenter vdc) {
Site activeSite = drUtil.getActiveSite(vdc.getShortId());
Map<String, String> hostIPv4AddressMap = activeSite.getHostIPv4AddressMap();
if (hostIPv4AddressMap != null && !hostIPv4AddressMap.isEmpty() && activeSite.isUsingIpv4()) {
return hostIPv4AddressMap;
}
return activeSite.getHostIPv6AddressMap();
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class BackupOps method getNodesInfo.
public Map<String, URI> getNodesInfo() throws URISyntaxException {
List<Service> services = coordinatorClient.locateAllServices(((CoordinatorClientImpl) coordinatorClient).getSysSvcName(), ((CoordinatorClientImpl) coordinatorClient).getSysSvcVersion(), null, null);
// get URL schema and port
Service svc = services.get(0);
URI uri = svc.getEndpoint();
int port = uri.getPort();
String scheme = uri.getScheme();
DrUtil util = new DrUtil();
util.setCoordinator(coordinatorClient);
Site localSite = util.getLocalSite();
Map<String, String> addresses = localSite.getHostIPv4AddressMap();
if (!localSite.isUsingIpv4()) {
addresses = localSite.getHostIPv6AddressMap();
}
Map<String, URI> nodesInfo = new HashMap();
for (Map.Entry<String, String> addr : addresses.entrySet()) {
String nodeUri = scheme + "://" + addr.getValue() + ":" + port + "/";
nodesInfo.put(addr.getKey(), new URI(nodeUri));
}
return nodesInfo;
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class DbManager method checkAndSetIncrementalSyncing.
private void checkAndSetIncrementalSyncing(InetAddress endpoint) {
Site site = getSite(endpoint);
if (site == null) {
log.info("Unknown site for {}. Skip HandoffLogDetector", endpoint);
return;
}
log.info("Node {} in site {} comes online", endpoint, site.getUuid());
if (site.getState() == SiteState.STANDBY_SYNCED) {
SiteMonitorResult monitorResult = drUtil.getCoordinator().getTargetInfo(site.getUuid(), SiteMonitorResult.class);
if (monitorResult == null || monitorResult.getDbQuorumLostSince() == 0) {
log.info("No db quorum lost on standby site. Skip this node up event on {} ", endpoint);
return;
}
if (hasPendingHintedHandoff(endpoint)) {
log.info("Hinted handoff logs detected. Change site {} state to STANDBY_INCR_SYNCING", site.getUuid());
site.setState(SiteState.STANDBY_INCR_SYNCING);
drUtil.getCoordinator().persistServiceConfiguration(site.toConfiguration());
}
} else {
log.info("Skip hinted handoff logs detector for {} due to site state is {}. ", endpoint, site.getState());
}
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class DbRebuildRunnable method purgeOldDataRevision.
private void purgeOldDataRevision(DrUtil drUtil) {
try {
coordinator.startTransaction();
log.info("Purge old data revisions after resync data from active site");
long vdcTargetVersion = DrUtil.newVdcConfigVersion();
String localSiteId = drUtil.getLocalSite().getUuid();
for (Site site : drUtil.listSites()) {
drUtil.updateVdcTargetVersion(site.getUuid(), SiteInfo.DR_OP_PURGE_DATA_REVISION, vdcTargetVersion, localSiteId, localSiteId);
}
coordinator.commitTransaction();
} catch (Exception e) {
log.warn("Failed to purge old data revision on local", e);
coordinator.discardTransaction();
}
}
Aggregations