Search in sources :

Example 1 with Condition

use of com.emc.storageos.hds.model.Condition in project coprhd-controller by CoprHD.

the class HDSApiDiscoveryManager method getThinImagePoolList.

public List<Pool> getThinImagePoolList(String systemObjectId) throws Exception {
    InputStream responseStream = null;
    StorageArray storageArray = null;
    try {
        URI endpointURI = hdsApiClient.getBaseURI();
        Map<String, Object> attributeMap = new HashMap<String, Object>();
        StorageArray inputStorageArray = new StorageArray(systemObjectId);
        Get getOp = new Get(HDSConstants.STORAGEARRAY);
        Condition condition = new Condition("6");
        attributeMap.put(HDSConstants.GET, getOp);
        attributeMap.put(HDSConstants.STORAGEARRAY, inputStorageArray);
        attributeMap.put(HDSConstants.CONDITION, condition);
        String getThinImagePoolInputXML = InputXMLGenerationClient.getInputXMLString(HDSConstants.GET_THINIMAGE_POOL_INFO_OP, attributeMap, HDSConstants.HITACHI_INPUT_XML_CONTEXT_FILE, HDSConstants.HITACHI_SMOOKS_CONFIG_FILE);
        log.info("Query to get ThinImagePool :{}", getThinImagePoolInputXML);
        ClientResponse response = hdsApiClient.post(endpointURI, getThinImagePoolInputXML);
        if (HttpStatus.SC_OK == response.getStatus()) {
            responseStream = response.getEntityInputStream();
            JavaResult result = SmooksUtil.getParsedXMLJavaResult(responseStream, HDSConstants.SMOOKS_CONFIG_FILE);
            verifyErrorPayload(result);
            storageArray = result.getBean(StorageArray.class);
        } else {
            log.error("Get system details failed with invalid response code {}", response.getStatus());
            throw HDSException.exceptions.invalidResponseFromHDS(String.format("Not able to query system details due to invalid response %1$s from server", response.getStatus()));
        }
    } finally {
        if (null != responseStream) {
            try {
                responseStream.close();
            } catch (IOException e) {
                log.warn("IOException occurred while closing the response stream");
            }
        }
    }
    return storageArray.getThinPoolList();
}
Also used : Condition(com.emc.storageos.hds.model.Condition) ClientResponse(com.sun.jersey.api.client.ClientResponse) HashMap(java.util.HashMap) InputStream(java.io.InputStream) Get(com.emc.storageos.hds.model.Get) IOException(java.io.IOException) URI(java.net.URI) JavaResult(org.milyn.payload.JavaResult) StorageArray(com.emc.storageos.hds.model.StorageArray)

Aggregations

Condition (com.emc.storageos.hds.model.Condition)1 Get (com.emc.storageos.hds.model.Get)1 StorageArray (com.emc.storageos.hds.model.StorageArray)1 ClientResponse (com.sun.jersey.api.client.ClientResponse)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 URI (java.net.URI)1 HashMap (java.util.HashMap)1 JavaResult (org.milyn.payload.JavaResult)1