use of com.emc.storageos.coordinator.client.model.RepositoryInfo in project coprhd-controller by CoprHD.
the class LocalRepository method getRepositoryInfo.
/**
* @return RepositoryState
* @throws InvalidRepositoryInfoException
*/
public RepositoryInfo getRepositoryInfo() throws LocalRepositoryException, InvalidRepositoryInfoException {
final String prefix = "getRepositoryState(): ";
_log.debug(prefix);
final String[] cmd1 = { _SYSTOOL_CMD, _SYSTOOL_LIST };
List<SoftwareVersion> versions = toSoftwareVersionList(prefix + _SYSTOOL_LIST, exec(prefix, cmd1));
final String[] cmd2 = { _SYSTOOL_CMD, _SYSTOOL_GET_DEFAULT };
final SoftwareVersion current = toSoftwareVersionList(prefix + _SYSTOOL_GET_DEFAULT, exec(prefix, cmd2)).get(0);
_log.debug(prefix + "current={} versions={}", current, Strings.repr(versions));
return new RepositoryInfo(current, versions);
}
use of com.emc.storageos.coordinator.client.model.RepositoryInfo in project coprhd-controller by CoprHD.
the class SchedulerConfig method getSofttwareWithRetry.
private void getSofttwareWithRetry() throws Exception, InterruptedException {
int retryTimes = 0;
RepositoryInfo targetInfo = null;
CoordinatorClient coordinatorClient = coordinator.getCoordinatorClient();
while (retryTimes <= MAX_VERSION_RETRY_TIMES) {
retryTimes++;
targetInfo = coordinatorClient.getTargetInfo(RepositoryInfo.class);
if (targetInfo == null) {
log.info("can't get version, try {} seconds later", MAX_VERSION_RETRY_INTERVAL / 1000);
Thread.sleep(MAX_VERSION_RETRY_INTERVAL);
continue;
}
this.softwareVersion = targetInfo.getCurrentVersion().toString();
log.info("Version: {}", softwareVersion);
break;
}
if (targetInfo == null) {
throw new Exception("Can't get version information from coordinator client");
}
}
use of com.emc.storageos.coordinator.client.model.RepositoryInfo 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.model.RepositoryInfo in project coprhd-controller by CoprHD.
the class ClusterInfoMapper method toClusterInfo.
public static ClusterInfo toClusterInfo(final ClusterState controlNodesState, final Map<Service, RepositoryInfo> controlNodesInfo, final Map<Service, ConfigVersion> controlNodesConfigVersions, final RepositoryInfo targetRepository, final PropertyInfoExt targetProperty) {
ClusterInfo toClusterInfo = new ClusterInfo();
toClusterInfo.setCurrentState((controlNodesState != ClusterState.STABLE) ? controlNodesState.toString() : ClusterState.STABLE.toString());
if (!controlNodesInfo.isEmpty()) {
toClusterInfo.setControlNodes(new HashMap<String, NodeState>());
for (Map.Entry<Service, RepositoryInfo> entry : controlNodesInfo.entrySet()) {
addControlNodeInfo(toClusterInfo, entry.getKey().getNodeId(), entry.getValue(), controlNodesConfigVersions != null ? controlNodesConfigVersions.get(entry.getKey()) : null);
}
}
if (targetRepository != null) {
addTargetInfo(toClusterInfo, targetRepository, targetProperty);
}
return toClusterInfo;
}
use of com.emc.storageos.coordinator.client.model.RepositoryInfo in project coprhd-controller by CoprHD.
the class UpgradeCoordinatorClientTest method testNodeIdentifier.
@Test
public void testNodeIdentifier() {
List<String> nodelist = _coordinator.getAllNodes();
System.out.println("Number of Nodes found " + nodelist.size());
Iterator<String> nodeIter = nodelist.iterator();
while (nodeIter.hasNext()) {
String currentnode = nodeIter.next();
System.out.println("Node ID " + currentnode);
try {
RepositoryInfo info = _coordinator.getRepositoryInfo(currentnode);
} catch (CoordinatorClientException e) {
System.out.println("Version List is null");
}
}
}
Aggregations