Search in sources :

Example 6 with VNXFilePluginException

use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException in project coprhd-controller by CoprHD.

the class VNXLoginProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final PostMethod postMethod = (PostMethod) resultObj;
    try {
        Header[] headers = postMethod.getResponseHeaders("Set-Cookie");
        if (null != headers && headers.length > 0) {
            keyMap.put(VNXFileConstants.COOKIE, headers[0].getValue());
            _logger.debug("Recieved cookie information from the Server.");
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the login response due to {}", ex.getMessage());
        throw new VNXFilePluginException("Exception occurred while processing the login response.", ex.getCause());
    } finally {
        postMethod.releaseConnection();
    }
}
Also used : Header(org.apache.commons.httpclient.Header) PostMethod(org.apache.commons.httpclient.methods.PostMethod) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 7 with VNXFilePluginException

use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException 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 8 with VNXFilePluginException

use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException 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)

Example 9 with VNXFilePluginException

use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException in project coprhd-controller by CoprHD.

the class VNXFileSystemMoverInfoProcessor method processFilesystemList.

/**
 * Process the fileSystemList which are received from XMLAPI server.
 *
 * @param filesystemList : List of FileSystem objects.
 * @param keyMap : keyMap.
 */
private void processFilesystemList(List<Object> filesystemList, Map<String, Object> keyMap) throws VNXFilePluginException {
    Iterator<Object> iterator = filesystemList.iterator();
    Set<String> moverIds = new HashSet<String>();
    if (iterator.hasNext()) {
        Status status = (Status) iterator.next();
        if (status.getMaxSeverity() == Severity.OK) {
            keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
            while (iterator.hasNext()) {
                FileSystem fileSystem = (FileSystem) iterator.next();
                _logger.info("Processing result for file system {}", fileSystem.getName());
                List<MoverOrVdmRef> roFileSysHosts = fileSystem.getRoFileSystemHosts();
                if (null != roFileSysHosts) {
                    Iterator<MoverOrVdmRef> roFileSysHostItr = roFileSysHosts.iterator();
                    while (roFileSysHostItr.hasNext()) {
                        MoverOrVdmRef mover = roFileSysHostItr.next();
                        moverIds.add(mover.getMover());
                        _logger.debug("Mover id for read only host is {}", mover.getMover());
                    }
                }
                List<MoverOrVdmRef> rwFileSysHosts = fileSystem.getRwFileSystemHosts();
                if (null != rwFileSysHosts) {
                    Iterator<MoverOrVdmRef> rwFileSysHostItr = rwFileSysHosts.iterator();
                    while (rwFileSysHostItr.hasNext()) {
                        MoverOrVdmRef mover = rwFileSysHostItr.next();
                        moverIds.add(mover.getMover());
                        _logger.debug("Mover id for read write host is {}", mover.getMover());
                    }
                }
            }
        } else {
            keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
            throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
        }
    }
    keyMap.put(VNXFileConstants.MOVERLIST, moverIds);
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) FileSystem(com.emc.nas.vnxfile.xmlapi.FileSystem) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) MoverOrVdmRef(com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef) HashSet(java.util.HashSet)

Example 10 with VNXFilePluginException

use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException 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

VNXFilePluginException (com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)10 Status (com.emc.nas.vnxfile.xmlapi.Status)9 FileSystem (com.emc.nas.vnxfile.xmlapi.FileSystem)4 HashMap (java.util.HashMap)4 Mover (com.emc.nas.vnxfile.xmlapi.Mover)2 MoverOrVdmRef (com.emc.nas.vnxfile.xmlapi.MoverOrVdmRef)2 DbClient (com.emc.storageos.db.client.DbClient)2 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 List (java.util.List)2 PostMethod (org.apache.commons.httpclient.methods.PostMethod)2 FileSystemAutoExtInfo (com.emc.nas.vnxfile.xmlapi.FileSystemAutoExtInfo)1 FileSystemCapacityInfo (com.emc.nas.vnxfile.xmlapi.FileSystemCapacityInfo)1 Mount (com.emc.nas.vnxfile.xmlapi.Mount)1 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 Problem (com.emc.nas.vnxfile.xmlapi.Status.Problem)1 UserAccount (com.emc.nas.vnxfile.xmlapi.UserAccount)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 Stat (com.emc.storageos.db.client.model.Stat)1