Search in sources :

Example 16 with PropertyInfoExt

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

the class ClusterAddressPoller method setLocalRepoControllerProps.

/**
 * Set controller properties in local repository
 *
 * @param props properties to set
 * @throws LocalRepositoryException
 */
private void setLocalRepoControllerProps(Map<String, String> props) throws LocalRepositoryException {
    PropertyInfoExt controllerProps = getLocalRepository().getControllerOvfProperties();
    controllerProps.removeProperties(props.keySet());
    controllerProps.addProperties(props);
    getLocalRepository().setControllerOvfProperties(controllerProps);
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt)

Example 17 with PropertyInfoExt

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

the class PropertyInfoTest method testGetTargetProps.

@Test
public void testGetTargetProps() {
    Map<String, String> map = new HashMap<String, String>();
    map.put("node_id", "node2");
    map.put("system_connectemc_username", "username");
    map.put("version", "");
    PropertyInfoExt propertyInfo = new PropertyInfoExt(map);
    Map<String, String> targetProps = propertyInfo.getAllProperties();
    Assert.assertEquals("username", targetProps.get("system_connectemc_username"));
    Assert.assertEquals("node2", targetProps.get("node_id"));
    Assert.assertEquals("", targetProps.get("version"));
    Assert.assertNull(targetProps.get("nonExistant"));
}
Also used : HashMap(java.util.HashMap) PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) Test(org.junit.Test)

Example 18 with PropertyInfoExt

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

the class LocalRepository method getOverrideProperties.

/**
 * @return PropertyInfo
 */
public PropertyInfoExt getOverrideProperties() throws LocalRepositoryException {
    final String prefix = "getOverrideProperties(): ";
    _log.debug(prefix);
    final String[] cmd = { _SYSTOOL_CMD, _SYSTOOL_GET_OPROPS };
    PropertyInfoExt overrides = new PropertyInfoExt(exec(prefix, cmd));
    _log.debug(prefix + "properties={}", Strings.repr(overrides));
    return overrides;
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt)

Example 19 with PropertyInfoExt

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

the class ZkCmdHandler method rollbackDataRevision.

public void rollbackDataRevision() throws Exception {
    DrUtil drUtil = new DrUtil(ZKUtil.getCoordinatorClient());
    if (!precheckForRollback(drUtil)) {
        return;
    }
    LocalRepository localRepository = LocalRepository.getInstance();
    PropertyInfoExt localDataRevisionProps = localRepository.getDataRevisionPropertyInfo();
    String prevRevision = localDataRevisionProps.getProperty(Constants.KEY_PREV_DATA_REVISION);
    log.info("Previous data revision at local {}", prevRevision);
    if (StringUtils.isNotEmpty(prevRevision)) {
        long rollbackTargetRevision = Long.parseLong(prevRevision);
        drUtil.updateVdcTargetVersion(drUtil.getLocalSite().getUuid(), SiteInfo.DR_OP_CHANGE_DATA_REVISION, DrUtil.newVdcConfigVersion(), rollbackTargetRevision);
        log.info("Manual rollback to {} has been triggered", rollbackTargetRevision);
        System.out.println(String.format("Rollback to %s has been initiated successfully", prevRevision));
    } else {
        log.warn("No valid previous revision found. Skip rollback");
        System.out.println("Can't find viable previous data revision. Rollback oparation has been aborted");
    }
}
Also used : PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) DrUtil(com.emc.storageos.coordinator.client.service.DrUtil) LocalRepository(com.emc.storageos.systemservices.impl.upgrade.LocalRepository)

Example 20 with PropertyInfoExt

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

the class ComputeImageServerMigrationTest method prepareData.

@Override
protected void prepareData() throws Exception {
    log.info("Storing image server info into zk configuration");
    Map<String, String> imageServerProps = new HashMap<String, String>();
    imageServerProps.put("image_server_address", "10.247.84.185");
    imageServerProps.put("image_server_username", "root");
    imageServerProps.put("image_server_password", "ChangeMe");
    imageServerProps.put("image_server_tftpbootdirectory", "");
    imageServerProps.put("image_server_os_network_ip", "12.0.6.10");
    imageServerProps.put("image_server_http_port", "");
    imageServerProps.put("image_server_image_directory", "");
    String str = new PropertyInfoExt(imageServerProps).encodeAsString();
    ConfigurationImpl config = new ConfigurationImpl();
    config.setKind(PropertyInfoExt.TARGET_PROPERTY);
    config.setId(PropertyInfoExt.TARGET_PROPERTY_ID);
    config.setConfig(PropertyInfoExt.TARGET_INFO, str);
    _coordinator.persistServiceConfiguration(_coordinator.getSiteId(), config);
    String imageServerIP = _coordinator.getPropertyInfo().getProperty("image_server_address");
    if (imageServerIP == null) {
        log.info("image server info not saved to ZK db");
    }
}
Also used : HashMap(java.util.HashMap) PropertyInfoExt(com.emc.storageos.coordinator.client.model.PropertyInfoExt) ConfigurationImpl(com.emc.storageos.coordinator.common.impl.ConfigurationImpl)

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