Search in sources :

Example 1 with ConfigVersion

use of com.emc.storageos.coordinator.client.model.ConfigVersion 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;
    }
}
Also used : ClusterInfoMapper.toClusterInfo(com.emc.storageos.systemservices.mapper.ClusterInfoMapper.toClusterInfo) ClusterInfo(com.emc.vipr.model.sys.ClusterInfo) RepositoryInfo(com.emc.storageos.coordinator.client.model.RepositoryInfo) PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) ConfigVersion(com.emc.storageos.coordinator.client.model.ConfigVersion) Service(com.emc.storageos.coordinator.common.Service) ClusterState(com.emc.vipr.model.sys.ClusterInfo.ClusterState) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) SyssvcException(com.emc.storageos.systemservices.exceptions.SyssvcException) InvalidLockOwnerException(com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException) IOException(java.io.IOException) CoordinatorClientException(com.emc.storageos.systemservices.exceptions.CoordinatorClientException)

Example 2 with ConfigVersion

use of com.emc.storageos.coordinator.client.model.ConfigVersion in project coprhd-controller by CoprHD.

the class PropertyManager method initializeLocalAndTargetInfo.

/**
 * Initialize local and target info
 *
 * @throws Exception
 */
private void initializeLocalAndTargetInfo(String svcId) throws Exception {
    // publish config_version which is also a target property
    // used as a flag denoting whether target properties have been changed
    PropertyInfoExt localPropInfo = localRepository.getOverrideProperties();
    localConfigVersion = localPropInfo.getProperty(PropertyInfoExt.CONFIG_VERSION);
    if (localConfigVersion == null) {
        localConfigVersion = "0";
        localPropInfo.addProperty(PropertyInfoExt.CONFIG_VERSION, localConfigVersion);
    }
    coordinator.setNodeSessionScopeInfo(new ConfigVersion(localConfigVersion));
    log.info("Step1a: Local config version: {}", localConfigVersion);
    // get local target property info
    localTargetPropInfo = getLocalTargetPropInfo(localPropInfo);
    log.debug("Step1a: Local target properties: {}", localTargetPropInfo);
    // set target if empty
    targetPropInfo = coordinator.getTargetProperties();
    if (targetPropInfo == null) {
        // only control node can set target
        try {
            // Set the updated propperty info in coordinator
            coordinator.setTargetProperties(localPropInfo.getAllProperties());
            coordinator.setTargetInfo(new PowerOffState(PowerOffState.State.NONE));
            targetPropInfo = coordinator.getTargetInfo(PropertyInfoExt.class);
            log.info("Step1b: Target property set to local state: {}", targetPropInfo);
        } catch (CoordinatorClientException e) {
            log.info("Step1b: Wait another control node to set target");
            retrySleep();
            throw e;
        }
    }
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) ConfigVersion(com.emc.storageos.coordinator.client.model.ConfigVersion) CoordinatorClientException(com.emc.storageos.systemservices.exceptions.CoordinatorClientException) PowerOffState(com.emc.storageos.coordinator.client.model.PowerOffState)

Example 3 with ConfigVersion

use of com.emc.storageos.coordinator.client.model.ConfigVersion in project coprhd-controller by CoprHD.

the class CoordinatorClientImpl method getControlNodesState.

@Override
public ClusterInfo.ClusterState getControlNodesState(String siteId) {
    try {
        // get target repository and configVersion
        final RepositoryInfo targetRepository = getTargetInfo(RepositoryInfo.class);
        final PropertyInfoRestRep targetProperty = getTargetInfo(PropertyInfoExt.class);
        final PowerOffState targetPowerOffState = getTargetInfo(PowerOffState.class);
        final StorageDriversInfo targetDrivers = getTargetInfo(StorageDriversInfo.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);
        final Map<Service, VdcConfigVersion> controlNodesVdcConfigVersions = getAllNodeInfos(VdcConfigVersion.class, CONTROL_NODE_SYSSVC_ID_PATTERN, siteId);
        final Map<Service, StorageDriversInfo> controlNodesDrivers = getAllNodeInfos(StorageDriversInfo.class, CONTROL_NODE_SYSSVC_ID_PATTERN, siteId);
        return getControlNodesState(targetRepository, controlNodesInfo, targetProperty, controlNodesConfigVersions, controlNodesVdcConfigVersions, targetPowerOffState, targetDrivers, controlNodesDrivers, siteId);
    } catch (Exception e) {
        log.info("Fail to get the control node information ", e);
        return ClusterInfo.ClusterState.UNKNOWN;
    }
}
Also used : PropertyInfoRestRep(com.emc.storageos.model.property.PropertyInfoRestRep) RepositoryInfo(com.emc.storageos.coordinator.client.model.RepositoryInfo) VdcConfigVersion(com.emc.storageos.coordinator.client.model.VdcConfigVersion) ConfigVersion(com.emc.storageos.coordinator.client.model.ConfigVersion) Service(com.emc.storageos.coordinator.common.Service) ExecutorService(java.util.concurrent.ExecutorService) StorageDriversInfo(com.emc.storageos.coordinator.client.model.StorageDriversInfo) VdcConfigVersion(com.emc.storageos.coordinator.client.model.VdcConfigVersion) PowerOffState(com.emc.storageos.coordinator.client.model.PowerOffState) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Aggregations

ConfigVersion (com.emc.storageos.coordinator.client.model.ConfigVersion)3 PowerOffState (com.emc.storageos.coordinator.client.model.PowerOffState)2 PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)2 RepositoryInfo (com.emc.storageos.coordinator.client.model.RepositoryInfo)2 Service (com.emc.storageos.coordinator.common.Service)2 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)2 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)2 IOException (java.io.IOException)2 StorageDriversInfo (com.emc.storageos.coordinator.client.model.StorageDriversInfo)1 VdcConfigVersion (com.emc.storageos.coordinator.client.model.VdcConfigVersion)1 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)1 PropertyInfoRestRep (com.emc.storageos.model.property.PropertyInfoRestRep)1 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)1 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)1 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)1 ClusterInfoMapper.toClusterInfo (com.emc.storageos.systemservices.mapper.ClusterInfoMapper.toClusterInfo)1 ClusterInfo (com.emc.vipr.model.sys.ClusterInfo)1 ClusterState (com.emc.vipr.model.sys.ClusterInfo.ClusterState)1 UnknownHostException (java.net.UnknownHostException)1 ExecutorService (java.util.concurrent.ExecutorService)1