use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class ConnectVdcTaskOp method postCheck.
private void postCheck() {
log.info("vdc config info already synced to all connected vdc, start post check");
if (myVdc == null) {
getMyVdcId();
}
// step 4: wait for the gossip status
dbClient.waitAllSitesDbStable();
// reload operated vdc from db
operatedVdc = dbClient.queryObject(VirtualDataCenter.class, operatedVdc.getId());
Site activeSite = drUtil.getActiveSite(operatedVdc.getShortId());
// check if network strategy updated successfully
dbClient.waitDbRingRebuildDone(operatedVdc.getShortId(), activeSite.getNodeCount());
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class InternalDbClient method waitAllSitesDbStable.
/**
* Waits for the db instances joined in all sites
*/
public void waitAllSitesDbStable() {
String prefix = "Waiting for DB cluster become stable on all sites ...";
log.info(prefix);
DbJmxClient geoInstance = getJmxClient(LOCALHOST);
// Loop all VDC
List<URI> vdcIdIter = queryByType(VirtualDataCenter.class, true);
for (URI vdcId : vdcIdIter) {
log.info("loop db status check on {}", vdcId.toString());
VirtualDataCenter vdc = queryObject(VirtualDataCenter.class, vdcId);
// filter out vdcs that are not connected in geo
if (!shouldCheckDbStatus(vdc)) {
log.error("ignore vdc for db status check {}", vdcId);
continue;
}
if (vdc.getConnectionStatus() != ConnectionStatus.DISCONNECTED) {
Site activeSite = drUtil.getActiveSite(vdc.getShortId());
// short Id
waitDbNodesStable(geoInstance, vdc.getShortId(), activeSite.getNodeCount());
}
}
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class VdcConfigHelper method toConfigParam.
/**
* Build VdcConfig for a vdc for SyncVdcConfig call
*
* @param vdc
* @return
*/
public VdcConfig toConfigParam(VirtualDataCenter vdc) {
log.info("copy {} to the sync config param", vdc.getShortId());
VdcConfig vdcConfig = new VdcConfig();
Site activeSite = drUtil.getActiveSite(vdc.getShortId());
vdcConfig.setId(vdc.getId());
vdcConfig.setShortId(vdc.getShortId());
vdcConfig.setSecretKey(vdc.getSecretKey());
if ((vdc.getLabel() != null) && (!vdc.getLabel().isEmpty())) {
vdcConfig.setName(vdc.getLabel());
}
if ((vdc.getDescription() != null) && (!vdc.getDescription().isEmpty())) {
vdcConfig.setDescription(vdc.getDescription());
}
if (activeSite.getVipEndPoint() != null) {
vdcConfig.setApiEndpoint(activeSite.getVipEndPoint());
}
vdcConfig.setHostCount(activeSite.getNodeCount());
HashMap<String, String> ipv4AddrMap = new HashMap<String, String>(activeSite.getHostIPv4AddressMap());
vdcConfig.setHostIPv4AddressesMap(ipv4AddrMap);
HashMap<String, String> ipv6AddrMap = new HashMap<String, String>(activeSite.getHostIPv6AddressMap());
vdcConfig.setHostIPv6AddressesMap(ipv6AddrMap);
vdcConfig.setVersion(vdc.getVersion());
vdcConfig.setConnectionStatus(vdc.getConnectionStatus().toString());
vdcConfig.setRepStatus(vdc.getRepStatus().toString());
vdcConfig.setGeoCommandEndpoint(vdc.getGeoCommandEndpoint());
vdcConfig.setGeoDataEndpoint(vdc.getGeoDataEndpoint());
vdcConfig.setActiveSiteId(activeSite.getUuid());
return vdcConfig;
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class VdcConfigHelper method sendVdcNodeCheckRequest.
/**
* Send node check request to target vdc.
*
* @param sendToVdc vdc to send msg to
* @param vdcsToCheck list of vdc's with nodes to check
* @return
* @throws Exception
*/
public VdcNodeCheckResponse sendVdcNodeCheckRequest(VirtualDataCenter sendToVdc, Collection<VirtualDataCenter> vdcsToCheck) {
List<VdcConfig> virtualDataCenters = new ArrayList<VdcConfig>();
for (VirtualDataCenter vdc : vdcsToCheck) {
VdcConfig vdcConfig = new VdcConfig();
vdcConfig.setId(vdc.getId());
vdcConfig.setShortId(vdc.getShortId());
Site activeSite = drUtil.getActiveSite(vdc.getShortId());
if (activeSite.getHostIPv4AddressMap() != null && !activeSite.getHostIPv4AddressMap().isEmpty() && activeSite.isUsingIpv4()) {
HashMap<String, String> addressMap = new HashMap<String, String>(activeSite.getHostIPv4AddressMap());
vdcConfig.setHostIPv4AddressesMap(addressMap);
} else if (activeSite.getHostIPv6AddressMap() != null && !activeSite.getHostIPv6AddressMap().isEmpty()) {
HashMap<String, String> addressMap = new HashMap<String, String>(activeSite.getHostIPv6AddressMap());
vdcConfig.setHostIPv6AddressesMap(addressMap);
} else {
throw new IllegalStateException("Cannot perform node reachable check on vdc " + vdc.getShortId() + " no nodes were found on VirtualDataCenter object");
}
virtualDataCenters.add(vdcConfig);
}
return sendVdcNodeCheckRequest(sendToVdc, virtualDataCenters);
}
Aggregations