Search in sources :

Example 11 with PropertyInfoExt

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

the class SecretsManager method syncLocalKey.

private void syncLocalKey() throws Exception {
    PropertyInfoExt localSslInfo = localRepository.getSslPropertyInfo();
    localKey = localSslInfo.getProperty(NGINX_PRIV_KEY);
    localKeyHash = localSslInfo.getProperty(NGINX_KEY_HASH);
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt)

Example 12 with PropertyInfoExt

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

the class TokenMaxLifeValuesHolder method loadParameterFromZK.

/**
 * load parameter from system properties of ZooKeeper.
 * if the properties do not exist, or exception when loading, use default values.
 */
public void loadParameterFromZK() {
    try {
        _log.info("load token life time and idle time from zk");
        PropertyInfoExt params = _coordinator.getTargetInfo(PropertyInfoExt.class);
        _maxTokenLifeTimeInMins = NumberUtils.toInt(params.getProperty(Constants.TOKEN_LIFE_TIME), Constants.DEFAULT_TOKEN_LIFE_TIME);
        _maxTokenIdleTimeInMins = NumberUtils.toInt(params.getProperty(Constants.TOKEN_IDLE_TIME), Constants.DEFAULT_TOKEN_IDLE_TIME);
    } catch (Exception e) {
        _log.warn("load parameter from ZK error, use default values.");
        _maxTokenLifeTimeInMins = Constants.DEFAULT_TOKEN_LIFE_TIME;
        _maxTokenIdleTimeInMins = Constants.DEFAULT_TOKEN_IDLE_TIME;
    }
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) APIException(com.emc.storageos.svcs.errorhandling.resources.APIException)

Example 13 with PropertyInfoExt

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

the class PropertyManager method updateProperties.

/**
 * Update properties
 *
 * @param svcId node service id
 * @throws Exception
 */
private void updateProperties(String svcId) throws Exception {
    PropertyInfoExt diffProperties = new PropertyInfoExt(targetPropInfo.getDiffProperties(localTargetPropInfo));
    PropertyInfoExt override_properties = new PropertyInfoExt(localRepository.getOverrideProperties().getAllProperties());
    log.info("Step3a: Updating User Changed properties file: {}", override_properties);
    PropertyInfoExt updatedUserChangedProps = combineProps(override_properties, diffProperties);
    if (diffProperties.hasRebootProperty()) {
        if (!getRebootLock(svcId)) {
            retrySleep();
        } else if (!isQuorumMaintained()) {
            releaseRebootLock(svcId);
            retrySleep();
        } else {
            log.info("Step3a: Reboot property found.");
            localRepository.setOverrideProperties(updatedUserChangedProps);
            log.info("Step3a: Updating properties: {}", updatedUserChangedProps);
            reboot();
        }
    } else if (diffProperties.hasReconfigProperty() || !diffProperties.getNotifierTags().isEmpty()) {
        log.info("Step3a: Reconfig property found or notifiers specified.");
        // CTRL-9860: don't update the local config version until everything is done.
        String targetVersion = targetPropInfo.getProperty(PropertyInfoExt.CONFIG_VERSION);
        updatedUserChangedProps.addProperty(PropertyInfoExt.CONFIG_VERSION, localConfigVersion);
        localRepository.setOverrideProperties(updatedUserChangedProps);
        log.info("Step3a: Updating properties without updating the config version: {}", updatedUserChangedProps);
        if (diffProperties.hasReconfigAttributeWithoutNotifiers()) {
            // this is the old-school "complete" reconfig that takes no notifiers as arguments.
            // moving forward this will diminish
            // i.e., all reconfigRequired properties will have notifier specified.
            localRepository.reconfig();
        } else if (diffProperties.hasReconfigProperty()) {
            reconfigProperties(diffProperties);
        }
        // the notifier list can be empty, in which case nothing will be done.
        notifyPropertyChanges(diffProperties);
        // update the local config version to target version now
        log.info("Step3a: Updating the config version to {}", targetVersion);
        updatedUserChangedProps.addProperty(PropertyInfoExt.CONFIG_VERSION, targetVersion);
        localRepository.setOverrideProperties(updatedUserChangedProps);
    } else {
        log.info("Step3a: No reboot property found.");
        localRepository.setOverrideProperties(updatedUserChangedProps);
        log.info("Step3a: Updating properties: {}", updatedUserChangedProps);
    }
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt)

Example 14 with PropertyInfoExt

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

the class PropertyManager method getLocalTargetPropInfo.

/**
 * Get local target property info
 *
 * For control node, properties that can be found in metadata are target properties
 * For extra node, not only exist in metadata, but also ControlNodeOnly==false
 *
 * @param localPropInfo
 * @return
 */
private PropertyInfoExt getLocalTargetPropInfo(final PropertyInfoExt localPropInfo) {
    Map<String, PropertyMetadata> metadata = PropertiesMetadata.getGlobalMetadata();
    PropertyInfoExt localTargetProps = new PropertyInfoExt();
    for (Entry<String, String> entry : localPropInfo.getAllProperties().entrySet()) {
        final String key = entry.getKey();
        final String value = entry.getValue();
        if (metadata.containsKey(key)) {
            if (coordinator.isControlNode()) {
                localTargetProps.addProperty(key, value);
            } else {
                if (!metadata.get(key).getControlNodeOnly()) {
                    localTargetProps.addProperty(key, value);
                }
            }
        }
    }
    return localTargetProps;
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) PropertyMetadata(com.emc.storageos.model.property.PropertyMetadata)

Example 15 with PropertyInfoExt

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

the class VdcOpHandler method flushVdcConfigToLocal.

/**
 * Flush vdc config to local disk /.volumes/boot/etc/vdcconfig.properties
 * Note: this flush will not write VDC_CONFIG_VERSION to disk to make sure if there are some errors, VdcManager can enter retry loop
 */
protected void flushVdcConfigToLocal() {
    PropertyInfoExt vdcProperty = new PropertyInfoExt(targetVdcPropInfo.getAllProperties());
    vdcProperty.addProperty(VdcConfigUtil.VDC_CONFIG_VERSION, localVdcPropInfo.getProperty(VdcConfigUtil.VDC_CONFIG_VERSION));
    localRepository.setVdcPropertyInfo(vdcProperty);
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt)

Aggregations

PropertyInfoExt (com.emc.storageos.coordinator.client.model.PropertyInfoExt)33 HashMap (java.util.HashMap)7 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)5 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)4 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)4 CoordinatorClientException (com.emc.storageos.systemservices.exceptions.CoordinatorClientException)4 Test (org.junit.Test)4 Site (com.emc.storageos.coordinator.client.model.Site)3 SyssvcException (com.emc.storageos.systemservices.exceptions.SyssvcException)3 IOException (java.io.IOException)3 ConfigVersion (com.emc.storageos.coordinator.client.model.ConfigVersion)2 Configuration (com.emc.storageos.coordinator.common.Configuration)2 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)2 SiteParam (com.emc.storageos.model.dr.SiteParam)2 PropertyInfoRestRep (com.emc.storageos.model.property.PropertyInfoRestRep)2 PropertyMetadata (com.emc.storageos.model.property.PropertyMetadata)2 InvalidLockOwnerException (com.emc.storageos.systemservices.exceptions.InvalidLockOwnerException)2 UnknownHostException (java.net.UnknownHostException)2 ArrayList (java.util.ArrayList)2 PowerOffState (com.emc.storageos.coordinator.client.model.PowerOffState)1