use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class SeedProviderImpl method getSeeds.
/**
* We select seeds based on the following rules -
* For DR standby sites, use all nodes in active site as seeds
* For DR active site, use local nodes as seeds. The rule to select local seed is
* - first boot node(AUTOBOOT = false) uses itself as seed nodes so that it could boot and initialize schema
* - subsquent node(AUTOBOOT = true) uses other successfully booted(JOINED = true) nodes as seeds
*/
@Override
public List<InetAddress> getSeeds() {
try {
CoordinatorClientInetAddressMap nodeMap = _client.getInetAddessLookupMap();
List<Configuration> configs = _client.queryAllConfiguration(_client.getSiteId(), Constants.DB_CONFIG);
List<InetAddress> seeds = new ArrayList<>();
// If we are upgrading from pre-2.5 releases, dbconfig exists in zk global area
List<Configuration> leftoverConfig = _client.queryAllConfiguration(Constants.DB_CONFIG);
configs.addAll(leftoverConfig);
// Add extra seeds - seeds from remote sites
for (String seed : extraSeeds) {
if (StringUtils.isNotEmpty(seed)) {
seeds.add(InetAddress.getByName(seed));
}
}
for (int i = 0; i < configs.size(); i++) {
Configuration config = configs.get(i);
// Bypasses item of "global" and folders of "version", just check db configurations.
if (config.getId() == null || config.getId().equals(Constants.GLOBAL_ID)) {
continue;
}
String nodeId = config.getConfig(DbConfigConstants.NODE_ID);
if (!Boolean.parseBoolean(config.getConfig(DbConfigConstants.AUTOBOOT)) || (!config.getId().equals(_id) && Boolean.parseBoolean(config.getConfig(DbConfigConstants.JOINED)))) {
// all non autobootstrap nodes + other nodes are used as seeds
InetAddress ip = null;
if (nodeMap != null) {
String ipAddress = nodeMap.getConnectableInternalAddress(nodeId);
_logger.debug("ip[" + i + "]: " + ipAddress);
ip = InetAddress.getByName(ipAddress);
} else {
ip = InetAddress.getByName(nodeId);
}
seeds.add(ip);
_logger.info("Seed {}", ip);
}
}
_logger.info("Seeds list {}", StringUtils.join(seeds.toArray(), ","));
return seeds;
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class LazyLoadTests method setMigrationStatus.
private static void setMigrationStatus(MigrationStatus status) {
String dbConfigPath = _coordinator.getVersionedDbConfigPath("dbsvc", "1.1");
Configuration config = _coordinator.queryConfiguration(dbConfigPath, Constants.GLOBAL_ID);
if (config == null) {
ConfigurationImpl cfg = new ConfigurationImpl();
cfg.setKind(dbConfigPath);
cfg.setId(Constants.GLOBAL_ID);
config = cfg;
}
config.setConfig(Constants.MIGRATION_STATUS, status.name());
_coordinator.persistServiceConfiguration(config);
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class DbServiceStatusChecker method isClusterStateDone.
/**
* Checks to see if the cassandra cluster finished entering a certain state
*/
private boolean isClusterStateDone(String state, boolean isVersioned, String svcName) throws Exception {
if (clusterNodeCount == 0) {
throw new IllegalStateException("node count not set");
}
List<Configuration> configs = coordinator.queryAllConfiguration(coordinator.getSiteId(), coordinator.getVersionedDbConfigPath(svcName, getDbsvcVersion(isVersioned)));
List<Configuration> leftoverConfig = coordinator.queryAllConfiguration(coordinator.getVersionedDbConfigPath(svcName, getDbsvcVersion(isVersioned)));
configs.addAll(leftoverConfig);
Set<String> qualifiedConfigs = new HashSet<String>();
for (int i = 0; i < configs.size(); i++) {
Configuration config = configs.get(i);
String value = config.getConfig(state);
if (value != null && Boolean.parseBoolean(value)) {
qualifiedConfigs.add(config.getId());
}
}
return (qualifiedConfigs.size() == clusterNodeCount);
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class DbServiceStatusChecker method isAnyNodeInState.
/**
* Checks to see if any node in the cluster has entered a certain state
*/
private boolean isAnyNodeInState(String state, boolean isVersioned) throws Exception {
List<Configuration> configs = coordinator.queryAllConfiguration(coordinator.getSiteId(), coordinator.getVersionedDbConfigPath(serviceName, getDbsvcVersion(isVersioned)));
for (int i = 0; i < configs.size(); i++) {
Configuration config = configs.get(i);
String value = config.getConfig(state);
if (value != null && Boolean.parseBoolean(value)) {
return true;
}
}
return false;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class StorageDriverManager method getUpgradeDriverMetaDataMap.
private Map<String, StorageDriverMetaData> getUpgradeDriverMetaDataMap() {
List<Configuration> configs = coordinatorClient.queryAllConfiguration(StorageDriverMetaData.KIND);
Map<String, StorageDriverMetaData> result = new HashMap<String, StorageDriverMetaData>();
if (configs == null || configs.isEmpty()) {
return result;
}
for (Configuration config : configs) {
StorageDriverMetaData newMetaData = new StorageDriverMetaData(config);
result.put(newMetaData.getDriverName(), newMetaData);
}
return result;
}
Aggregations