use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class SchedulerConfig method persistBackupUploadStatus.
/**
* Persist upload status to ZK
*/
public void persistBackupUploadStatus(BackupUploadStatus status) {
Map<String, String> allItems = (status != null) ? status.getAllItems() : null;
if (allItems == null || allItems.size() == 0) {
return;
}
ConfigurationImpl config = new ConfigurationImpl();
config.setKind(BackupConstants.BACKUP_UPLOAD_STATUS);
config.setId(Constants.GLOBAL_ID);
log.info("Setting upload status: {}", status);
for (Map.Entry<String, String> entry : allItems.entrySet()) {
config.setConfig(entry.getKey(), entry.getValue());
}
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
coordinatorClient.persistServiceConfiguration(coordinatorClient.getSiteId(), config);
log.info("Persist backup upload status to zk successfully");
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class SchedulerConfig method isClusterUpgrading.
private boolean isClusterUpgrading() {
try {
RepositoryInfo target = coordinator.getTargetInfo(RepositoryInfo.class);
SoftwareVersion targetVersion = target.getCurrentVersion();
SoftwareVersion currentVersion = new LocalRepository().getRepositoryInfo().getCurrentVersion();
log.info("The current version={} target version={}", currentVersion, targetVersion);
if (!currentVersion.equals(targetVersion)) {
log.info("The current version is NOT equals to target version");
return true;
}
} catch (Exception e) {
log.error("Failed to get versions e=", e);
// failed to read data from zk, so no need to do backup at this time
return true;
}
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
String currentDbSchemaVersion = coordinatorClient.getCurrentDbSchemaVersion();
String targetDbSchemaVersion = coordinatorClient.getTargetDbSchemaVersion();
log.info("Current db schema version: {}, target db schema version: {}.", currentDbSchemaVersion, targetDbSchemaVersion);
if (currentDbSchemaVersion == null || !currentDbSchemaVersion.equalsIgnoreCase(targetDbSchemaVersion)) {
log.warn("Current version is not equal to the target version");
return true;
}
ClusterState state = coordinatorClient.getControlNodesState();
log.info("Current control nodes' state: {}", state);
if (state == ClusterState.STABLE || state == ClusterState.SYNCING || state == ClusterState.DEGRADED) {
return false;
}
return true;
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class SchedulerConfig method persist.
public void persist() {
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
ConfigurationImpl cfg = new ConfigurationImpl();
cfg.setKind(Constants.BACKUP_SCHEDULER_CONFIG);
cfg.setId(Constants.GLOBAL_ID);
cfg.setConfig(BackupConstants.BACKUP_TAGS_RETAINED, StringUtils.join(this.retainedBackups, ','));
cfg.setConfig(BackupConstants.BACKUP_TAGS_UPLOADED, StringUtils.join(this.uploadedBackups, ','));
coordinatorClient.persistServiceConfiguration(coordinatorClient.getSiteId(), cfg);
}
use of com.emc.storageos.coordinator.client.service.CoordinatorClient 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.client.service.CoordinatorClient in project coprhd-controller by CoprHD.
the class DistributedKeyStoreImpl method init.
/*
* (non-Javadoc)
*
* @see com.emc.storageos.security.keystore.DistributedKeyStore#init(java.security.KeyStore.LoadStoreParameter)
*/
@Override
public void init(LoadStoreParameter param) throws SecurityException {
if (param instanceof DistributedLoadKeyStoreParam) {
DistributedLoadKeyStoreParam zkConnectionInfo = (DistributedLoadKeyStoreParam) param;
CoordinatorClient coordinator = zkConnectionInfo.getCoordinator();
coordConfigStoringHelper = new CoordinatorConfigStoringHelper(coordinator);
generator = new KeyCertificatePairGenerator();
generator.setKeyCertificateAlgorithmValuesHolder(new KeyCertificateAlgorithmValuesHolder(coordinator));
} else {
throw SecurityException.fatals.failedToInitializedKeystoreNeedDistKeystoreParams();
}
}
Aggregations