Search in sources :

Example 6 with VdcConfig

use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.

the class VdcConfigHelper method addVdcToCassandraStrategyOptions.

public void addVdcToCassandraStrategyOptions(List<VdcConfig> vdcConfigs, VirtualDataCenter vdc, boolean wait) throws Exception {
    log.info("add vdc {} to strategy options");
    for (VdcConfig vdcCfg : vdcConfigs) {
        if (vdcCfg.getId().equals(vdc.getId())) {
            log.info("find the vdc cfg {}", vdcCfg);
            // update the VirtualDataCenter object of the vdc
            mergeVdcConfig(vdcCfg);
            vdc = dbClient.queryObject(VirtualDataCenter.class, vdc.getId());
            addStrategyOption(vdc, wait);
            break;
        }
    }
}
Also used : VdcConfig(com.emc.storageos.geomodel.VdcConfig) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Example 7 with VdcConfig

use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.

the class ConnectVdcTaskOp method configMerge.

private VdcConfigSyncParam configMerge(VdcPreCheckResponse operatedVdcInfo, String ipsecKey) {
    // step 2: merge the vdc config info of all sites, as the initiator, we should has all current vdc config info
    VdcConfigSyncParam vdcConfigList = new VdcConfigSyncParam();
    vdcConfigList.setVdcConfigVersion(DrUtil.newVdcConfigVersion());
    List<VdcConfig> list = vdcConfigList.getVirtualDataCenters();
    for (VirtualDataCenter vdc : getAllVdc()) {
        if (vdc.getShortId().equals(vdcInfo.getProperty(GeoServiceJob.VDC_SHORT_ID))) {
            continue;
        }
        log.info("add {} to the merged vdc config", vdc.getShortId());
        VdcConfig vdcConfig = helper.toConfigParam(vdc);
        list.add(vdcConfig);
    }
    VdcConfig operatedConfig = mergeVdcInfo(operatedVdcInfo);
    list.add(operatedConfig);
    vdcConfigList.setIpsecKey(ipsecKey);
    return vdcConfigList;
}
Also used : VdcConfigSyncParam(com.emc.storageos.geomodel.VdcConfigSyncParam) VdcConfig(com.emc.storageos.geomodel.VdcConfig) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Example 8 with VdcConfig

use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.

the class DBClient method recoverVdcConfigFromRecoverFile.

/**
 * Recover the system after add/remove vdc failures from recover file
 *
 * @param recoverFileName
 */
public void recoverVdcConfigFromRecoverFile(String recoverFileName) {
    List<VdcConfig> newVdcConfigList = loadRecoverFileToRecoverInfo(recoverFileName);
    InternalDbClient geoDbClient = (InternalDbClient) ctx.getBean("geodbclient");
    geoDbClient.stopClusterGossiping();
    // Don't recover version and ipsec key. Need to reconsider once all vdc data moving to ZK.
    vdcConfHelper.syncVdcConfig(newVdcConfigList, null, true, DrUtil.newVdcConfigVersion(), "");
    try {
        Thread.sleep(30000);
    } catch (InterruptedException e) {
        log.error("Error in recover Vdc Config, e=" + e);
    }
    System.out.println("Recover successfully, please wait for the whole vdc reboot.");
}
Also used : VdcConfig(com.emc.storageos.geomodel.VdcConfig) InternalDbClient(com.emc.storageos.geo.vdccontroller.impl.InternalDbClient)

Example 9 with VdcConfig

use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.

the class DBClient method readRecoverBackupInfo.

private List<VdcConfig> readRecoverBackupInfo() {
    List<VdcConfig> newVdcConfigList = new ArrayList<VdcConfig>();
    List<URI> ids = _dbClient.queryByType(VdcOpLog.class, true);
    VdcOpLog latestOp = null;
    for (URI id : ids) {
        if (latestOp == null) {
            latestOp = _dbClient.queryObject(VdcOpLog.class, id);
        } else {
            VdcOpLog thisOp = _dbClient.queryObject(VdcOpLog.class, id);
            if (thisOp.getCreationTime().getTimeInMillis() > latestOp.getCreationTime().getTimeInMillis()) {
                latestOp = thisOp;
            }
        }
    }
    if (latestOp != null) {
        byte[] vdcConfigInfo = latestOp.getVdcConfigInfo();
        try {
            List<VirtualDataCenter> vdcList = (List<VirtualDataCenter>) SerializerUtils.deserialize(vdcConfigInfo);
            if (vdcList != null) {
                for (VirtualDataCenter vdc : vdcList) {
                    newVdcConfigList.add(vdcConfHelper.toConfigParam(vdc));
                }
            }
        } catch (Exception e) {
            log.error("error in recovervdcinfo: " + e);
        }
    }
    return newVdcConfigList;
}
Also used : VdcConfig(com.emc.storageos.geomodel.VdcConfig) ArrayList(java.util.ArrayList) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter) ArrayList(java.util.ArrayList) List(java.util.List) NodeList(org.w3c.dom.NodeList) URI(java.net.URI) IntrospectionException(java.beans.IntrospectionException) InvocationTargetException(java.lang.reflect.InvocationTargetException) ConnectionException(com.netflix.astyanax.connectionpool.exceptions.ConnectionException) IOException(java.io.IOException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) VdcOpLog(com.emc.storageos.db.client.model.VdcOpLog)

Example 10 with VdcConfig

use of com.emc.storageos.geomodel.VdcConfig in project coprhd-controller by CoprHD.

the class ConnectVdcTaskOp method sendVdcNodeCheckRequest.

/**
 * Send node check request to target vdc.
 *
 * @param vdcProp vdc to send msg to
 * @param vdcsToCheck list of vdc's with nodes to check
 * @return
 * @throws Exception
 */
private VdcNodeCheckResponse sendVdcNodeCheckRequest(Properties vdcProp, Collection<VirtualDataCenter> vdcsToCheck) {
    List<VdcConfig> virtualDataCenters = new ArrayList<VdcConfig>();
    for (VirtualDataCenter vdc : vdcsToCheck) {
        VdcConfig vdcConfig = new VdcConfig();
        Site activeSite = drUtil.getActiveSite(vdc.getShortId());
        vdcConfig.setId(vdc.getId());
        vdcConfig.setShortId(vdc.getShortId());
        if (activeSite.getHostIPv4AddressMap() != null && !activeSite.getHostIPv4AddressMap().isEmpty() && activeSite.isUsingIpv4()) {
            HashMap<String, String> ipv4AddrMap = new HashMap<String, String>(activeSite.getHostIPv4AddressMap());
            vdcConfig.setHostIPv4AddressesMap(ipv4AddrMap);
        } else if (activeSite.getHostIPv6AddressMap() != null && !activeSite.getHostIPv6AddressMap().isEmpty()) {
            HashMap<String, String> ipv6AddrMap = new HashMap<String, String>(activeSite.getHostIPv6AddressMap());
            vdcConfig.setHostIPv6AddressesMap(ipv6AddrMap);
        } else {
            throw GeoException.fatals.cannotPerformOperation(vdc.getId().toString(), " no nodes were found on VirtualDataCenter object");
        }
        virtualDataCenters.add(vdcConfig);
    }
    return sendVdcNodeCheckRequest(vdcProp, virtualDataCenters);
}
Also used : Site(com.emc.storageos.coordinator.client.model.Site) HashMap(java.util.HashMap) VdcConfig(com.emc.storageos.geomodel.VdcConfig) ArrayList(java.util.ArrayList) VirtualDataCenter(com.emc.storageos.db.client.model.VirtualDataCenter)

Aggregations

VdcConfig (com.emc.storageos.geomodel.VdcConfig)18 VirtualDataCenter (com.emc.storageos.db.client.model.VirtualDataCenter)11 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)4 Site (com.emc.storageos.coordinator.client.model.Site)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 VdcConfigSyncParam (com.emc.storageos.geomodel.VdcConfigSyncParam)3 ConnectionException (com.netflix.astyanax.connectionpool.exceptions.ConnectionException)3 IntrospectionException (java.beans.IntrospectionException)3 IOException (java.io.IOException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3 URI (java.net.URI)3 Date (java.util.Date)3 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)3 Method (java.lang.reflect.Method)2 DocumentBuilder (javax.xml.parsers.DocumentBuilder)2 Document (org.w3c.dom.Document)2 Element (org.w3c.dom.Element)2 NodeList (org.w3c.dom.NodeList)2 TimeSeriesQueryResult (com.emc.storageos.db.client.TimeSeriesQueryResult)1