Search in sources :

Example 11 with CoordinatorClientException

use of com.emc.storageos.systemservices.exceptions.CoordinatorClientException in project coprhd-controller by CoprHD.

the class LocalPasswordHandler method getPassword.

private String getPassword(String username) throws CoordinatorClientException, LocalRepositoryException {
    PropertyInfoRestRep props = null;
    try {
        props = _cfg.getProperties(PropCategory.CONFIG.toString());
    } catch (Exception e) {
        throw APIException.internalServerErrors.getObjectFromError("password", "coordinator", e);
    }
    String propertyKey = String.format(SYSTEM_ENCPASSWORD_FORMAT, username);
    String oldPassword = props.getProperty(propertyKey);
    if (oldPassword == null) {
        _log.error("password not found for " + username);
        return "";
    }
    return oldPassword;
}
Also used : PropertyInfoRestRep(com.emc.storageos.model.property.PropertyInfoRestRep) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException) LocalRepositoryException(com.emc.storageos.systemservices.exceptions.LocalRepositoryException) CoordinatorClientException(com.emc.storageos.systemservices.exceptions.CoordinatorClientException)

Example 12 with CoordinatorClientException

use of com.emc.storageos.systemservices.exceptions.CoordinatorClientException 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)

Aggregations

CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)12 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)10 IOException (java.io.IOException)6 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)5 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)5 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)5 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)5 LocalRepositoryException (com.emc.storageos.systemservices.exceptions.LocalRepositoryException)4 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 PropertyInfoUpdate (com.emc.storageos.model.property.PropertyInfoUpdate)2 ConfigVersion (com.emc.storageos.coordinator.client.model.ConfigVersion)1 CoordinatorClassInfo (com.emc.storageos.coordinator.client.model.CoordinatorClassInfo)1 SoftwareVersion (com.emc.storageos.coordinator.client.model.SoftwareVersion)1 InvalidSoftwareVersionException (com.emc.storageos.coordinator.exceptions.InvalidSoftwareVersionException)1 PropertyInfoRestRep (com.emc.storageos.model.property.PropertyInfoRestRep)1 PropertyMetadata (com.emc.storageos.model.property.PropertyMetadata)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 UpgradeVoter (com.emc.storageos.security.upgradevoter.UpgradeVoter)1