/** * process the FileShareUsage response of the VNX XML API Server. * * @param fsUsageList : fileShareUsage map. * @param keyMap : attribute map. * @param statList : list of stat objects. */ @SuppressWarnings("rawtypes") private void processFileShareInfo( final List<Object> fsUsageList, final Map<String, Object> keyMap, final List<Stat> statList, DbClient dbClient) throws VNXFilePluginException { final String serialId = keyMap.get(Constants._serialID).toString(); Iterator iterator = fsUsageList.iterator(); keyMap.put(Constants._TimeCollected, System.currentTimeMillis()); Map<String, Long> fsCapacityMap = new HashMap<String, Long>(); while (iterator.hasNext()) { FileSystemSetUsageStats fsSetUsageStats = (FileSystemSetUsageStats) iterator.next(); List<Item> fsUsageItems = fsSetUsageStats.getItem(); _logger.info( "Received {} fileShareUsage records at server time {}", fsUsageItems.size(), fsSetUsageStats.getTime()); for (Item item : fsUsageItems) { if (null == item.getFileSystem()) { continue; } final String nativeGuid = NativeGUIDGenerator.generateNativeGuid( Type.vnxfile.toString(), serialId, item.getFileSystem()); Stat stat = _zeroRecordGenerator.injectattr(keyMap, nativeGuid, null); if (null != stat) { stat.setTimeInMillis((Long) keyMap.get(Constants._TimeCollected)); stat.setTimeCollected((Long) keyMap.get(Constants._TimeCollected)); injectProvisionedCapacity(stat, keyMap); // The data coming in is in KB. Converting to Bytes stat.setAllocatedCapacity(item.getSpaceUsed() * 1024); _statsColumnInjector.injectColumns(stat, dbClient); statList.add(stat); // Persists the file system, only if change in used capacity. DbClient client = (DbClient) keyMap.get(Constants.dbClient); if (client != null) { FileShare fileSystem = client.queryObject(FileShare.class, stat.getResourceId()); if (fileSystem != null) { if (!fileSystem.getInactive() && fileSystem.getUsedCapacity() != stat.getAllocatedCapacity()) { fileSystem.setUsedCapacity(stat.getAllocatedCapacity()); client.persistObject(fileSystem); } } } } // filesystem and total capacity in Map long totalSpace = item.getSpaceTotal(); String fsNativeId = item.getFileSystem(); fsCapacityMap.put(fsNativeId, Long.valueOf(totalSpace)); _logger.info( "processFileShareInfo - FileSystem native id {} and file system total size{}", fsNativeId, String.valueOf(totalSpace)); } _logger.info("Filesystems found - {} ", fsCapacityMap.size()); keyMap.put(VNXFileConstants.FILE_CAPACITY_MAP, fsCapacityMap); } _logger.info("No. of stat objects: {}", statList.size()); }