Search in sources :

Example 1 with ConsistencyGroupsListResult

use of com.emc.storageos.hp3par.command.ConsistencyGroupsListResult in project coprhd-controller by CoprHD.

the class HP3PARIngestHelper method generateVolumeSetToVolumeMap.

/*
	 * Returns: Hashmap of volume to volumesets mapping The key of this hashmap
	 * will be the name of the volume The value of the hasmap returned will be
	 * an array list of volume sets that the volume belongs to. Example:
	 * {volume1: [volumeset5] , volume2:[volumeset1, volumeset2]}
	 */
private HashMap<String, ArrayList<String>> generateVolumeSetToVolumeMap(StorageSystem storageSystem, Registry registry) throws Exception {
    // get Api client
    HP3PARApi hp3parApi = hp3parUtil.getHP3PARDeviceFromNativeId(storageSystem.getNativeId(), registry);
    ConsistencyGroupsListResult objConsisGroupSets = hp3parApi.getVVsetsList();
    HashMap<String, ArrayList<String>> volumeToVolumeSetMap = new HashMap<String, ArrayList<String>>();
    _log.info("3PARDriver: objConsisGroupSets.getTotal() information is {}", objConsisGroupSets.getTotal());
    for (ConsistencyGroupResult objConsisGroupResult : objConsisGroupSets.getMembers()) {
        if (objConsisGroupResult.getSetmembers() != null) {
            for (Integer volIndex = 0; volIndex < objConsisGroupResult.getSetmembers().size(); volIndex++) {
                String vVolName = objConsisGroupResult.getSetmembers().get(volIndex);
                if (!volumeToVolumeSetMap.containsKey(vVolName)) {
                    ArrayList<String> volSetList = new ArrayList<String>();
                    volSetList.add(objConsisGroupResult.getName());
                    volumeToVolumeSetMap.put(vVolName, volSetList);
                } else {
                    volumeToVolumeSetMap.get(vVolName).add(objConsisGroupResult.getName());
                }
            }
        }
    }
    _log.info("3PARDriver: volumeToVolumeSetMap information is {}", volumeToVolumeSetMap.toString());
    return volumeToVolumeSetMap;
}
Also used : ConsistencyGroupResult(com.emc.storageos.hp3par.command.ConsistencyGroupResult) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ConsistencyGroupsListResult(com.emc.storageos.hp3par.command.ConsistencyGroupsListResult)

Example 2 with ConsistencyGroupsListResult

use of com.emc.storageos.hp3par.command.ConsistencyGroupsListResult in project coprhd-controller by CoprHD.

the class HP3PARApi method getVVsetsList.

/**
 * Get Consistency Groups List
 *
 * @param displayName
 * @return
 * @throws Exception
 */
public ConsistencyGroupsListResult getVVsetsList() throws Exception {
    _log.info("3PARDriver: getVVsetsList enter");
    ClientResponse clientResp = null;
    final String path = URI_CG_LIST_DETAILS;
    try {
        clientResp = get(path);
        if (clientResp == null) {
            _log.error("3PARDriver: getVVsetsList There is no response from 3PAR");
            throw new HP3PARException("There is no response from 3PAR");
        } else if (clientResp.getStatus() != 200) {
            String errResp = getResponseDetails(clientResp);
            _log.error("3PARDriver: getVVsetsList There is error response from 3PAR = {}", errResp);
            throw new HP3PARException(errResp);
        } else {
            String responseString = clientResp.getEntity(String.class);
            _log.info("3PARDriver: getVVsetsList 3PAR response is {}", responseString);
            ConsistencyGroupsListResult cgListResult = new Gson().fromJson(sanitize(responseString), ConsistencyGroupsListResult.class);
            return cgListResult;
        }
    } catch (Exception e) {
        throw e;
    } finally {
        if (clientResp != null) {
            clientResp.close();
        }
        _log.info("3PARDriver: getVVsetsList leave");
    }
// end try/catch/finally
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) Gson(com.google.gson.Gson) ConsistencyGroupsListResult(com.emc.storageos.hp3par.command.ConsistencyGroupsListResult)

Aggregations

ConsistencyGroupsListResult (com.emc.storageos.hp3par.command.ConsistencyGroupsListResult)2 ConsistencyGroupResult (com.emc.storageos.hp3par.command.ConsistencyGroupResult)1 Gson (com.google.gson.Gson)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1