use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class CoordinatorClientImpl method getLicenseInfo.
/**
* get License Info from coordinator for the specified license type
*
* @param licenseType
* @return LicenseInfo
*/
private LicenseInfo getLicenseInfo(LicenseType licenseType) {
final Configuration config = queryConfiguration(LicenseInfo.LICENSE_INFO_TARGET_PROPERTY, TARGET_PROPERTY_ID);
if (config == null || config.getConfig(TARGET_INFO) == null) {
return null;
}
final String infoStr = config.getConfig(TARGET_INFO);
try {
List<LicenseInfo> licenseInfoList = LicenseInfo.decodeLicenses(infoStr);
for (LicenseInfo licenseInfo : licenseInfoList) {
if (licenseType.equals(licenseInfo.getLicenseType())) {
log.debug("getLicenseInfo: " + licenseInfo);
return licenseInfo;
}
}
} catch (final Exception e) {
throw CoordinatorException.fatals.unableToDecodeLicense(e);
}
log.warn("getLicenseInfo: null");
return null;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class RecoveryManager method removeOfflineInfo.
private void removeOfflineInfo() {
Configuration config = coordinator.getCoordinatorClient().queryConfiguration(coordinator.getCoordinatorClient().getSiteId(), Constants.DB_DOWNTIME_TRACKER_CONFIG, Constants.DBSVC_NAME);
DbOfflineEventInfo dbOfflineEventInfo = new DbOfflineEventInfo(config);
for (int i = 1; i <= nodeCount; i++) {
String nodeId = "vipr" + i;
if (corruptedNodes.contains(nodeId)) {
if (dbOfflineEventInfo.getOfflineTimeInMS(nodeId) != null) {
dbOfflineEventInfo.setOfflineTimeInMS(nodeId, null);
log.info("Removed offline Time info of {}", nodeId);
}
}
}
config = dbOfflineEventInfo.toConfiguration(Constants.DBSVC_NAME);
coordinator.getCoordinatorClient().persistServiceConfiguration(coordinator.getCoordinatorClient().getSiteId(), config);
log.info("Clean offlineTime and Persist db tracker info to zk successfully");
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class SchedulerConfig method isClusterNodeRecovering.
private boolean isClusterNodeRecovering() {
RecoveryStatus.Status status = null;
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
Configuration cfg = coordinatorClient.queryConfiguration(Constants.NODE_RECOVERY_STATUS, Constants.GLOBAL_ID);
if (cfg != null) {
String statusStr = cfg.getConfig(RecoveryConstants.RECOVERY_STATUS);
if (statusStr != null && statusStr.length() > 0) {
status = RecoveryStatus.Status.valueOf(statusStr);
}
}
log.info("Recovery status is: {}", status);
if (status == RecoveryStatus.Status.INIT || status == RecoveryStatus.Status.PREPARING || status == RecoveryStatus.Status.REPAIRING || status == RecoveryStatus.Status.SYNCING) {
return true;
}
return false;
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class RecoveryManager method validateAutoBootFlag.
private void validateAutoBootFlag() {
String siteId = coordinator.getCoordinatorClient().getSiteId();
List<Configuration> configs = coordinator.getCoordinatorClient().queryAllConfiguration(siteId, Constants.DB_CONFIG);
if (!isAllAutoBootTrue(configs)) {
log.info("Auto boot flag check passed");
return;
}
log.info("Auto boot flag was set true on all nodes, Change to false for one node");
for (int i = 0; i < configs.size(); i++) {
Configuration config = configs.get(i);
if (config.getId() == null || config.getId().equals(Constants.GLOBAL_ID)) {
continue;
}
config.setConfig(DbConfigConstants.AUTOBOOT, "false");
coordinator.getCoordinatorClient().persistServiceConfiguration(siteId, config);
log.info("Persist autoboot info as false on {} to zk successfully", config.getId());
break;
}
}
use of com.emc.storageos.coordinator.common.Configuration in project coprhd-controller by CoprHD.
the class SignatureKeyGenerator method deleteSignatureKey.
/**
* Delete a particular signature key
*
* @param relKeyLocation "leaf" node under \getSignatureKeyConfig()\getSignatureKeyId()\
* @param relKeyLocation
* @throws Exception
*/
protected synchronized void deleteSignatureKey(String relKeyLocation) throws Exception {
Configuration config = _coordinator.queryConfiguration(getSignatureKeyConfig(), getSignatureKeyId());
if (config != null && config.getConfig(relKeyLocation) != null) {
InterProcessLock lock = null;
try {
lock = _coordinator.getLock(getDistributedSignatureKeyLock());
lock.acquire();
config = _coordinator.queryConfiguration(getSignatureKeyConfig(), getSignatureKeyId());
config.removeConfig(relKeyLocation);
_coordinator.persistServiceConfiguration(config);
} finally {
if (lock != null) {
lock.release();
}
}
}
}
Aggregations