Search in sources :

Example 1 with Mover

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

the class VNXDataMoverIdProcessor method processDataMoverList.

private void processDataMoverList(List<Object> dmList, Map<String, Object> keyMap) throws VNXFilePluginException {
    Iterator<Object> iterator = dmList.iterator();
    Set<String> moverNames = new HashSet<String>();
    Set<String> moverIds = new HashSet<String>();
    if (iterator.hasNext()) {
        Status status = (Status) iterator.next();
        if (status.getMaxSeverity() == Severity.OK || status.getMaxSeverity() == Severity.WARNING) {
            while (iterator.hasNext()) {
                Mover dm = (Mover) iterator.next();
                if (dm.getRole() == MoverRole.STANDBY) {
                    continue;
                }
                moverIds.add(dm.getMover());
                moverNames.add(dm.getName());
            }
        } else {
            throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
        }
    }
    keyMap.put(VNXFileConstants.MOVERLIST, moverIds);
    keyMap.put(VNXFileConstants.MOVER_NAME, moverNames);
    if (!moverIds.isEmpty()) {
        keyMap.put(VNXFileConstants.MOVER_ID, moverIds.toArray(new String[0])[0]);
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) Mover(com.emc.nas.vnxfile.xmlapi.Mover) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)

Example 2 with Mover

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

the class VNXStoragePortGroupsProcessor 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 datamovers 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<VNXDataMover> movers = new ArrayList<VNXDataMover>();
            while (queryRespItr.hasNext()) {
                Object responseObj = queryRespItr.next();
                if (responseObj instanceof Mover) {
                    VNXDataMover vnxMover = new VNXDataMover();
                    Mover mover = (Mover) responseObj;
                    vnxMover.setId(Integer.valueOf(mover.getMover()));
                    vnxMover.setName(mover.getName());
                    vnxMover.setRole(mover.getRole().value());
                    _logger.debug("Port Group Information : {}", vnxMover.toString());
                    movers.add(vnxMover);
                }
            }
            _logger.info("Number of Port Groups found : {}", movers.size());
            keyMap.put(VNXFileConstants.STORAGE_PORT_GROUPS, movers);
            // 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) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Mover(com.emc.nas.vnxfile.xmlapi.Mover) VNXDataMover(com.emc.storageos.vnx.xmlapi.VNXDataMover) VNXDataMover(com.emc.storageos.vnx.xmlapi.VNXDataMover) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header)

Example 3 with Mover

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

the class VNXDataMoverNameProcessor method processDataMoverList.

private void processDataMoverList(List<Object> dmList, Map<String, Object> keyMap) throws VNXFilePluginException {
    Iterator<Object> iterator = dmList.iterator();
    String dmId = (String) keyMap.get(VNXFileConstants.DATAMOVER_ID);
    if (iterator.hasNext()) {
        Status status = (Status) iterator.next();
        if (status.getMaxSeverity() == Severity.OK || status.getMaxSeverity() == Severity.WARNING) {
            while (iterator.hasNext()) {
                Mover dm = (Mover) iterator.next();
                if (dm.getRole() == MoverRole.STANDBY) {
                    continue;
                }
                if (dmId.equals(dm.getMover())) {
                    keyMap.put(VNXFileConstants.DATAMOVER_NAME, dm.getName());
                    break;
                }
            }
        } else {
            throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
        }
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) Mover(com.emc.nas.vnxfile.xmlapi.Mover) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)

Aggregations

Mover (com.emc.nas.vnxfile.xmlapi.Mover)3 Status (com.emc.nas.vnxfile.xmlapi.Status)3 VNXFilePluginException (com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)2 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)1 VNXDataMover (com.emc.storageos.vnx.xmlapi.VNXDataMover)1 ArrayList (java.util.ArrayList)1 Header (org.apache.commons.httpclient.Header)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1