Search in sources :

Example 1 with Problem

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

the class VNXFileProcessor method processErrorStatus.

/**
 * Retrieve the description and diagnostics information from the error status.
 *
 * @param status status of the response returned by the XML API Server
 * @param keyMap map used to returned values to upper layers.
 */
protected void processErrorStatus(Status status, Map<String, Object> keyMap) {
    List<Problem> problems = status.getProblem();
    // Only retrieve the first problem.
    if (null != problems && !problems.isEmpty()) {
        Problem problem = problems.get(0);
        String desc = problem.getDescription();
        String message = problem.getMessage();
        String diags = problem.getDiagnostics();
        keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
        // These fields are optional in the response packet.
        if (null != desc) {
            keyMap.put(VNXFileConstants.FAULT_DESC, desc);
        }
        if (null != diags) {
            keyMap.put(VNXFileConstants.FAULT_DIAG, diags);
        }
        if (null != message) {
            keyMap.put(VNXFileConstants.FAULT_MSG, message);
        }
        if ((desc != null) && (!desc.isEmpty())) {
            _logger.error("Fault response received due to {} possible cause {}", desc, diags);
        } else {
            _logger.error("Fault response received due to {} possible cause {}", message, diags);
        }
    }
}
Also used : Problem(com.emc.nas.vnxfile.xmlapi.Status.Problem)

Example 2 with Problem

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

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

the class VNXFileSystemUsageProcessor method processResult.

@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    _logger.info("processing fileshare usage response" + resultObj);
    final PostMethod result = (PostMethod) resultObj;
    try {
        DbClient dbClient = (DbClient) keyMap.get(Constants.dbClient);
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        if (null != responsePacket.getPacketFault()) {
            Status status = responsePacket.getPacketFault();
            List<Problem> problems = status.getProblem();
            Iterator<Problem> problemsItr = problems.iterator();
            while (problemsItr.hasNext()) {
                Problem problem = problemsItr.next();
                _logger.error("Fault response received due to {} possible cause {}", problem.getDescription(), problem.getDiagnostics());
            }
        } else {
            List<Object> fsUsageInfo = getQueryStatsResponse(responsePacket);
            final List<Stat> statList = (List<Stat>) keyMap.get(Constants._Stats);
            processFileShareInfo(fsUsageInfo, keyMap, statList, dbClient);
            _zeroRecordGenerator.identifyRecordstobeZeroed(keyMap, statList, FileShare.class);
        }
    } catch (final IOException ioEx) {
        _logger.error("IOException occurred while processing the Fileshare capacity response due to {}", ioEx.getMessage());
        throw new VNXFilePluginException("IOException occurred while processing the Fileshare capacity response.", ioEx.getCause());
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the Fileshare capacity response due to {}", ex.getMessage());
        throw new VNXFilePluginException("Exception occurred while processing the Fileshare capacity response.", ex.getCause());
    } finally {
        result.releaseConnection();
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) DbClient(com.emc.storageos.db.client.DbClient) PostMethod(org.apache.commons.httpclient.methods.PostMethod) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) IOException(java.io.IOException) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Stat(com.emc.storageos.db.client.model.Stat) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Problem(com.emc.nas.vnxfile.xmlapi.Status.Problem) List(java.util.List)

Aggregations

Problem (com.emc.nas.vnxfile.xmlapi.Status.Problem)3 Status (com.emc.nas.vnxfile.xmlapi.Status)2 Response (com.emc.nas.vnxfile.xmlapi.Response)1 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 DbClient (com.emc.storageos.db.client.DbClient)1 Stat (com.emc.storageos.db.client.model.Stat)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 VNXFilePluginException (com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1