use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class CoordinatorClientExt method getClusterInfo.
public ClusterInfo getClusterInfo(String siteIdParam) {
try {
String siteId = siteIdParam == null ? _coordinator.getSiteId() : siteIdParam;
// get target repository and configVersion
final RepositoryInfo targetRepository = _coordinator.getTargetInfo(RepositoryInfo.class);
final PropertyInfoExt targetProperty = _coordinator.getTargetInfo(PropertyInfoExt.class);
// get control nodes' repository and configVersion info
final Map<Service, RepositoryInfo> controlNodesInfo = getAllNodeInfos(RepositoryInfo.class, CONTROL_NODE_SYSSVC_ID_PATTERN, siteId);
final Map<Service, ConfigVersion> controlNodesConfigVersions = getAllNodeInfos(ConfigVersion.class, CONTROL_NODE_SYSSVC_ID_PATTERN, siteId);
ClusterInfo.ClusterState controlNodesState = _coordinator.getControlNodesState(siteId);
// rotating ipsec key. We should report upgrade in progress on UI
if (backCompatPreYoda && ClusterInfo.ClusterState.STABLE.equals(controlNodesState)) {
if (!drUtil.isMultivdc()) {
_log.info("Back compat flag for preyoda is true. ");
controlNodesState = ClusterInfo.ClusterState.UPDATING;
}
}
// cluster state is determined both by control nodes' state and extra nodes
return toClusterInfo(controlNodesState, controlNodesInfo, controlNodesConfigVersions, targetRepository, targetProperty);
} catch (Exception e) {
_log.info("Fail to get the cluster information ", e);
return null;
}
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class CoordinatorClientExt method setTargetProperties.
/**
* Update system properties to zookeeper
*
* @param currentProps
* @throws CoordinatorClientException
*/
public void setTargetProperties(Map<String, String> currentProps) throws CoordinatorClientException {
Map<String, PropertyMetadata> propsMetadata = PropertiesMetadata.getGlobalMetadata();
// split properties as global, or site specific
HashMap<String, String> globalProps = new HashMap<String, String>();
HashMap<String, String> siteProps = new HashMap<String, String>();
for (Map.Entry<String, String> prop : currentProps.entrySet()) {
String key = prop.getKey();
PropertyMetadata metadata = propsMetadata.get(key);
if (metadata.getSiteSpecific()) {
siteProps.put(key, prop.getValue());
} else {
globalProps.put(key, prop.getValue());
}
}
// update properties to zk
if (getTargetInfoLock()) {
try {
// check we are in stable state if checkState = true specified
if (!isClusterUpgradable()) {
throw APIException.serviceUnavailable.clusterStateNotStable();
}
ConfigurationImpl globalCfg = new ConfigurationImpl();
globalCfg.setId(PropertyInfoExt.TARGET_PROPERTY_ID);
globalCfg.setKind(PropertyInfoExt.TARGET_PROPERTY);
PropertyInfoExt globalPropInfo = new PropertyInfoExt(globalProps);
globalCfg.setConfig(TARGET_INFO, globalPropInfo.encodeAsString());
_coordinator.persistServiceConfiguration(globalCfg);
_log.info("target properties changed successfully. target properties {}", globalPropInfo.toString());
if (siteProps.size() > 0) {
setSiteSpecificProperties(siteProps, _coordinator.getSiteId());
_log.info("site scope target properties changed successfully. target properties {}", siteProps.toString());
}
} catch (Exception e) {
throw SyssvcException.syssvcExceptions.coordinatorClientError("Failed to set target info. " + e.getMessage());
} finally {
releaseTargetVersionLock();
}
} else {
throw SyssvcException.syssvcExceptions.coordinatorClientError("Failed to set target state. Unable to obtain target lock");
}
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class IPSecMonitor method getVdcShortIdByIp.
private String getVdcShortIdByIp(String nodeIp) {
PropertyInfoExt vdcProps = LocalRepository.getInstance().getVdcPropertyInfo();
String nodeKey = null;
for (String key : vdcProps.getAllProperties().keySet()) {
String value = vdcProps.getProperty(key);
if (key.contains("ipaddr6")) {
value = IpUtils.decompressIpv6Address(value);
}
if (value != null && value.toLowerCase().equals(nodeIp.toLowerCase())) {
nodeKey = key;
break;
}
}
String vdcShortId = null;
if (nodeKey != null && nodeKey.startsWith("vdc_vd")) {
vdcShortId = nodeKey.split("_")[1];
}
return vdcShortId;
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class SecretsManager method innerRun.
@Override
protected void innerRun() {
while (doRun) {
log.debug("Main loop: Start");
// Wait for target info initialized
PropertyInfoExt targetInfo = coordinator.getTargetInfo(PropertyInfoExt.class);
if (targetInfo == null) {
log.info("The target info in ZK has not been initialized yet. Waiting...");
retrySleep();
continue;
}
// Step0: Configure ssh if needed. Probably only run once in first boot.
try {
sshConfig.run();
} catch (Exception e) {
log.info("Error during attempt to configure ssh will be retried: {}", e.getMessage());
retrySleep();
continue;
}
// Step1:
log.info("Step1: Sync SSL key and certificate if needed");
try {
syncSslKeyAndCert();
} catch (Exception e) {
log.info("Step1 failed and will be retried: {}", e.getMessage());
retrySleep();
continue;
}
log.info("Step2: Generate DH Params if not yet");
if (!dhInitDone) {
dhInitDone = genDHParam();
}
// Step3: sleep
log.info("Step3: sleep");
longSleep();
}
}
use of com.emc.storageos.coordinator.client.model.PropertyInfoExt in project coprhd-controller by CoprHD.
the class SecretsManager method updateLocalSslProps.
private void updateLocalSslProps() throws Exception {
PropertyInfoExt sslProps = new SslPropertyInfo();
sslProps.addProperty(NGINX_PRIV_KEY, escapeNewlines(key));
sslProps.addProperty(NGINX_PUB_KEY, escapeNewlines(cert));
log.info("updating local ssl properties");
localRepository.setSslPropertyInfo(sslProps);
log.info("Reconfiguring SSL related config files");
localRepository.reconfigProperties(SSL_PROP_TAG);
log.info("Invoking SSL notifier");
Notifier.getInstance(SSL_PROP_TAG).doNotify();
sslProps.addProperty(NGINX_KEY_HASH, keyHash);
log.info("updating local ssl key hash property");
localRepository.setSslPropertyInfo(sslProps);
}
Aggregations