@Override public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException { _logger.info("processing snapshot id response" + resultObj); final PostMethod result = (PostMethod) resultObj; try { ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream()); Status status = null; if (null != responsePacket.getPacketFault()) { status = responsePacket.getPacketFault(); processErrorStatus(status, keyMap); } else { List<Object> snapshotList = getQueryResponse(responsePacket); List<Checkpoint> snapsList = new ArrayList<Checkpoint>(); final String fsId = (String) keyMap.get(VNXFileConstants.FILESYSTEM_ID); _logger.info("Looking for all snapshots of filesystem {}", fsId); Iterator<Object> snapshotItr = snapshotList.iterator(); if (snapshotItr.hasNext()) { status = (Status) snapshotItr.next(); if (status.getMaxSeverity() == Severity.OK) { while (snapshotItr.hasNext()) { Checkpoint point = (Checkpoint) snapshotItr.next(); _logger.debug( "searching snapshot: {} - {}", point.getName(), point.getCheckpointOf()); if (point.getCheckpointOf().equalsIgnoreCase(fsId)) { String id = point.getCheckpoint(); String localFSId = point.getCheckpointOf(); _logger.info("Found matching snapshot: {} and checkpoint of {}", id, localFSId); snapsList.add(point); } } _logger.info("Number of Snapshots found for FS : {} are : {}", fsId, snapsList.size()); keyMap.put(VNXFileConstants.SNAPSHOTS_LIST, snapsList); keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS); } else { _logger.error("Error in getting the snapshot information."); processErrorStatus(status, keyMap); } } } } catch (final Exception ex) { _logger.error( "Exception occurred while processing the snapshot response due to {}", ex.getMessage()); keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage()); keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE); } finally { result.releaseConnection(); } }
@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(); } }
/** * Process the mountList which are received from XMLAPI server. * * @param mountList : List of Mount objects. * @param keyMap : keyMap. */ private void processMountList(final List<Object> mountList, Map<String, Object> keyMap) throws VNXFilePluginException { _logger.info("Processing file system mount response...."); final DbClient dbClient = (DbClient) keyMap.get(VNXFileConstants.DBCLIENT); // step -1 get the filesystem capacity map < filesystemid, size> Map<String, Long> fsCapList = (HashMap<String, Long>) keyMap.get(VNXFileConstants.FILE_CAPACITY_MAP); Map<String, Map<String, Long>> snapCapFsMap = (HashMap<String, Map<String, Long>>) keyMap.get(VNXFileConstants.SNAP_CAPACITY_MAP); // step-2 get the snapshot checkpoint size for give filesystem and it is map of filesystem and // map <snapshot, checkpointsize>> AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE); // get the storagesystem from db StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, profile.getSystemId()); List<String> fsList = null; Map<String, List<String>> fsMountvNASMap = new HashMap<String, List<String>>(); Map<String, List<String>> fsMountPhyNASMap = new HashMap<String, List<String>>(); // step -3 we will get filesystem on VDM or DM Iterator<Object> iterator = mountList.iterator(); if (iterator.hasNext()) { Status status = (Status) iterator.next(); if (status.getMaxSeverity() == Severity.OK) { // step -4 get the filesystem list for each mover or VDM in Map while (iterator.hasNext()) { Mount mount = (Mount) iterator.next(); if (mount.isMoverIdIsVdm() == true) { fsList = fsMountvNASMap.get(mount.getMover()); if (null == fsList) { fsList = new ArrayList<String>(); } fsList.add(mount.getFileSystem()); fsMountvNASMap.put(mount.getMover(), fsList); // get filesystem list for VDM or vNAS _logger.debug( "Filestem or Snapshot {} mounted on vdm {} ", mount.getFileSystem(), mount.getMover()); } else { fsList = fsMountPhyNASMap.get(mount.getMover()); if (null == fsList) { fsList = new ArrayList<String>(); } fsList.add(mount.getFileSystem()); fsMountPhyNASMap.put(mount.getMover(), fsList); // get filesystem list for DM or mover _logger.debug( "Filestem or Snapshot {} mounted on data mover {} ", mount.getFileSystem(), mount.getMover()); } } // Log the number of objects mounted on each data mover and virtual data mover!!! for (Entry<String, List<String>> eachVNas : fsMountvNASMap.entrySet()) { _logger.info( " Virtual data mover {} has Filestem or Snapshot mounts {} ", eachVNas.getKey(), eachVNas.getValue().size()); } for (Entry<String, List<String>> eachNas : fsMountPhyNASMap.entrySet()) { _logger.info( " Data mover {} has Filestem or Snapshot mounts {} ", eachNas.getKey(), eachNas.getValue().size()); } Map<String, Long> vdmCapacityMap = new HashMap<String, Long>(); Map<String, Long> dmCapacityMap = new HashMap<String, Long>(); vdmCapacityMap = computeMoverCapacity(fsMountvNASMap, fsCapList, snapCapFsMap); dmCapacityMap = computeMoverCapacity(fsMountPhyNASMap, fsCapList, snapCapFsMap); prepareDBMetrics( storageSystem, dbClient, fsMountPhyNASMap, dmCapacityMap, fsMountvNASMap, vdmCapacityMap); } else { throw new VNXFilePluginException( "Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE); } } }