Search in sources :

Example 1 with Vdm

use of com.emc.nas.vnxfile.xmlapi.Vdm in project coprhd-controller by CoprHD.

the class VNXVDMProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final PostMethod result = (PostMethod) resultObj;
    _logger.info("processing vnx info response" + resultObj);
    try {
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        if (null != responsePacket.getPacketFault()) {
            Status status = responsePacket.getPacketFault();
            processErrorStatus(status, keyMap);
        } else {
            List<Object> queryResponse = getQueryResponse(responsePacket);
            Iterator<Object> queryRespItr = queryResponse.iterator();
            List<VNXVdm> vdms = new ArrayList<VNXVdm>();
            while (queryRespItr.hasNext()) {
                Object responseObj = queryRespItr.next();
                if (responseObj instanceof Vdm) {
                    Vdm system = (Vdm) responseObj;
                    if (system.getState() == VdmState.LOADED) {
                        VNXVdm vdm = new VNXVdm(system.getName(), system.getMover(), system.getVdm(), system.getState().name());
                        vdm.setInterfaces(system.getInterfaces().getLi());
                        vdms.add(vdm);
                    } else {
                        _logger.info("Ignoring VDM {} because not LOADED {}", system.getName(), system.getState().value());
                    }
                }
            }
            keyMap.put(VNXFileConstants.VDM_INFO, vdms);
            // Extract session information from the response header.
            Header[] headers = result.getResponseHeaders(VNXFileConstants.CELERRA_SESSION);
            if (null != headers && headers.length > 0) {
                keyMap.put(VNXFileConstants.CELERRA_SESSION, headers[0].getValue());
                _logger.info("Recieved celerra session information from the Server.");
            }
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the vnx info response due to ", ex);
    } finally {
        result.releaseConnection();
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) PostMethod(org.apache.commons.httpclient.methods.PostMethod) ArrayList(java.util.ArrayList) VNXVdm(com.emc.storageos.vnx.xmlapi.VNXVdm) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header) VNXVdm(com.emc.storageos.vnx.xmlapi.VNXVdm) Vdm(com.emc.nas.vnxfile.xmlapi.Vdm)

Aggregations

ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 Status (com.emc.nas.vnxfile.xmlapi.Status)1 Vdm (com.emc.nas.vnxfile.xmlapi.Vdm)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 VNXVdm (com.emc.storageos.vnx.xmlapi.VNXVdm)1 ArrayList (java.util.ArrayList)1 Header (org.apache.commons.httpclient.Header)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1