use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class SchemaUtil method checkStrategyOptionsForDROnActive.
/**
* Remove paused sites from db/geodb strategy options on the active site.
*
* @param strategyOptions
* @return true to indicate keyspace strategy option is changed
*/
private boolean checkStrategyOptionsForDROnActive(Map<String, String> strategyOptions) {
boolean changed = false;
// iterate through all the sites and exclude the paused ones
for (Site site : drUtil.listSites()) {
String dcId = drUtil.getCassandraDcId(site);
if (site.getState().equals(SiteState.STANDBY_PAUSED) && strategyOptions.containsKey(dcId)) {
_log.info("Remove dc {} from strategy options", dcId);
strategyOptions.remove(dcId);
changed = true;
}
}
return changed;
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class SchemaUtil method checkStrategyOptionsForGeo.
/**
* Add new VDC into the geodb strategy options
*
* @param strategyOptions
* @return true to indicate keyspace strategy option is changed
*/
private boolean checkStrategyOptionsForGeo(Map<String, String> strategyOptions) {
if (onStandby) {
_log.info("Only active site updates geo strategy operation. Do nothing on standby site");
return false;
}
if (!isGeoDbsvc()) {
// update local db strategy option in multivdc configuration only
if (!drUtil.isMultivdc()) {
return false;
}
if (backCompatPreYoda) {
_log.info("Upgraded from preyoda release. Keep db strategy options unchanged.");
return false;
}
// for local db, check if current vdc id is in the list
if (!strategyOptions.containsKey(_vdcShortId)) {
strategyOptions.clear();
_log.info("Add {} to strategy options", _vdcShortId);
strategyOptions.put(_vdcShortId, Integer.toString(getReplicationFactor()));
return true;
}
return false;
}
_log.debug("vdcList = {}", _vdcList);
// on newly added vdc - vdc short id is changed
if (_vdcList.size() == 1 && !_vdcList.contains(_vdcShortId)) {
strategyOptions.clear();
}
// on removed vdc, its strategyOption need be reset
boolean isDrConfig = drUtil.listSites().size() > 1;
if (_vdcList.size() == 1 && strategyOptions.size() > 1 && !isDrConfig) {
strategyOptions.clear();
}
String dcName = _vdcShortId;
Site currentSite = null;
try {
currentSite = drUtil.getLocalSite();
} catch (Exception e) {
// ignore
}
if (currentSite != null) {
dcName = drUtil.getCassandraDcId(currentSite);
}
if (strategyOptions.containsKey(dcName)) {
return false;
}
_log.info("Add {} to strategy options", dcName);
strategyOptions.put(dcName, Integer.toString(getReplicationFactor()));
return true;
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class SchemaUtil method checkAndInitSchemaOnStandby.
private boolean checkAndInitSchemaOnStandby(KeyspaceDefinition kd) throws ConnectionException {
_log.info("try scan and setup db on standby site ...");
if (kd == null) {
_log.info("keyspace not exist yet. Wait {} seconds for schema from active site", DBINIT_RETRY_INTERVAL);
return false;
} else {
_log.info("keyspace exist already");
String currentDbSchemaVersion = _coordinator.getCurrentDbSchemaVersion();
if (currentDbSchemaVersion == null) {
_log.info("set current version for standby site {}", _service.getVersion());
setCurrentVersion(_service.getVersion());
}
Site currentSite = drUtil.getLocalSite();
if (SiteState.STANDBY_SYNCING.equals(currentSite.getState())) {
// and shouldn't be relied on any more.
while (clientContext.ensureSchemaAgreement()) {
// one reachable node from the other site (which contains the latest db schema).
if (getReachableDcCount() > 1) {
break;
}
}
}
checkStrategyOptions();
return true;
}
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class StorageDriverManager method updateMetaData.
private void updateMetaData() {
Site activeSite = drUtil.getActiveSite();
List<StorageDriversInfo> infos = getDriversInfo(activeSite.getUuid());
if (activeSite.getNodeCount() != infos.size()) {
log.warn("Not all nodes are online, skip updating meta data");
return;
}
boolean installFinished = updateInstallMetadata(infos);
boolean uninstallFinished = updateUninstallMetadata(infos);
boolean upgradeFinished = updateUpgradeMetadata(infos);
if (installFinished || uninstallFinished || upgradeFinished) {
restartControllerServices();
}
}
use of com.emc.storageos.coordinator.client.model.Site in project coprhd-controller by CoprHD.
the class StorageDriverManager method hasActiveSiteFinishDownload.
private boolean hasActiveSiteFinishDownload(String driverFileName) {
Site activeSite = drUtil.getActiveSite();
String activeSiteId = activeSite.getUuid();
List<StorageDriversInfo> infos = getDriversInfo(activeSiteId);
if (activeSite.getNodeCount() != infos.size()) {
// there're offline node in active site
return false;
}
for (StorageDriversInfo info : infos) {
if (!info.getInstalledDrivers().contains(driverFileName)) {
return false;
}
}
return true;
}
Aggregations