Search in sources :

Example 26 with Status

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

the class VNXUserAccountsProcessor method processUserAccountList.

private void processUserAccountList(List<Object> userList, Map<String, Object> keyMap) throws VNXFilePluginException {
    Iterator<Object> iterator = userList.iterator();
    Map<String, String> userInfo = new HashMap<String, String>();
    if (iterator.hasNext()) {
        Status status = (Status) iterator.next();
        if (status.getMaxSeverity() == Severity.OK) {
            while (iterator.hasNext()) {
                UserAccount user = (UserAccount) iterator.next();
                userInfo.put(user.getUser(), user.getUid());
                _logger.debug("user name: {} ", user.getUser());
            }
            keyMap.put(VNXFileConstants.USER_INFO, userInfo);
        } else {
            throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
        }
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) HashMap(java.util.HashMap) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) UserAccount(com.emc.nas.vnxfile.xmlapi.UserAccount)

Example 27 with Status

use of com.emc.nas.vnxfile.xmlapi.Status 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)

Example 28 with Status

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

the class VNXFileProcessor method getTaskResponse.

protected List<Object> getTaskResponse(ResponsePacket responsePacket) {
    List<Object> responseList = responsePacket.getResponseOrResponseEx();
    Iterator<Object> responseListItr = responseList.iterator();
    List<Object> taskResponse = new ArrayList<Object>();
    while (responseListItr.hasNext()) {
        Response response = (Response) responseListItr.next();
        if (null != response.getFault()) {
            Status status = response.getFault();
            List<Problem> problems = status.getProblem();
            Iterator<Problem> problemsItr = problems.iterator();
            while (problemsItr.hasNext()) {
                Problem prob = problemsItr.next();
                _logger.error("Respone fault: {}  cause: {}", prob.getDescription(), prob.getDiagnostics());
            }
        }
        taskResponse.add(response.getTaskResponse());
    }
    return taskResponse;
}
Also used : Response(com.emc.nas.vnxfile.xmlapi.Response) Status(com.emc.nas.vnxfile.xmlapi.Status) ArrayList(java.util.ArrayList) Problem(com.emc.nas.vnxfile.xmlapi.Status.Problem)

Example 29 with Status

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

the class VNXControlStationProcessor 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();
            while (queryRespItr.hasNext()) {
                Object responseObj = queryRespItr.next();
                if (responseObj instanceof CelerraSystem) {
                    CelerraSystem system = (CelerraSystem) responseObj;
                    VNXControlStation cs = new VNXControlStation(system.getSerial(), system.getVersion());
                    keyMap.put(VNXFileConstants.CONTROL_STATION_INFO, cs);
                    break;
                }
            }
            // 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) VNXControlStation(com.emc.storageos.vnx.xmlapi.VNXControlStation) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header) PostMethod(org.apache.commons.httpclient.methods.PostMethod) CelerraSystem(com.emc.nas.vnxfile.xmlapi.CelerraSystem) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 30 with Status

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

the class VNXDataMoverIdProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final PostMethod result = (PostMethod) resultObj;
    try {
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        // 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("Received celerra session info from the Server.");
        }
        if (null != responsePacket.getPacketFault()) {
            Status status = responsePacket.getPacketFault();
            processErrorStatus(status, keyMap);
        } else {
            List<Object> dataMoverList = getQueryResponse(responsePacket);
            processDataMoverList(dataMoverList, keyMap);
            keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the vnx data mover due to {}", ex.getMessage());
        keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
        keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
    } finally {
        result.releaseConnection();
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header) PostMethod(org.apache.commons.httpclient.methods.PostMethod) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)

Aggregations

Status (com.emc.nas.vnxfile.xmlapi.Status)42 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)33 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)33 PostMethod (org.apache.commons.httpclient.methods.PostMethod)33 Header (org.apache.commons.httpclient.Header)26 VNXFilePluginException (com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)17 ArrayList (java.util.ArrayList)12 TaskResponse (com.emc.nas.vnxfile.xmlapi.TaskResponse)11 HashMap (java.util.HashMap)5 FileSystem (com.emc.nas.vnxfile.xmlapi.FileSystem)4 List (java.util.List)4 Mover (com.emc.nas.vnxfile.xmlapi.Mover)3 TreeQuota (com.emc.nas.vnxfile.xmlapi.TreeQuota)3 Checkpoint (com.emc.nas.vnxfile.xmlapi.Checkpoint)2 MoverOrVdmRef (com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef)2 Problem (com.emc.nas.vnxfile.xmlapi.Status.Problem)2 DbClient (com.emc.storageos.db.client.DbClient)2 Stat (com.emc.storageos.db.client.model.Stat)2 UnManagedDiscoveredObject (com.emc.storageos.db.client.model.UnManagedDiscoveredObject)2 VNXFileSystem (com.emc.storageos.vnx.xmlapi.VNXFileSystem)2