Search in sources :

Example 1 with Mount

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

the class VNXFileSystemStaticLoadProcessor method processMountList.

/**
 * 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());
                    // get filesystem list for VDM or vNAS
                    fsMountvNASMap.put(mount.getMover(), fsList);
                    _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());
                    // get filesystem list for DM or mover
                    fsMountPhyNASMap.put(mount.getMover(), fsList);
                    _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);
        }
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) DbClient(com.emc.storageos.db.client.DbClient) HashMap(java.util.HashMap) VNXFilePluginException(com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException) Mount(com.emc.nas.vnxfile.xmlapi.Mount) AccessProfile(com.emc.storageos.plugins.AccessProfile) ArrayList(java.util.ArrayList) List(java.util.List) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) HashMap(java.util.HashMap) Map(java.util.Map) StringMap(com.emc.storageos.db.client.model.StringMap) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

Mount (com.emc.nas.vnxfile.xmlapi.Mount)1 Status (com.emc.nas.vnxfile.xmlapi.Status)1 DbClient (com.emc.storageos.db.client.DbClient)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)1 StringMap (com.emc.storageos.db.client.model.StringMap)1 AccessProfile (com.emc.storageos.plugins.AccessProfile)1 VNXFilePluginException (com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1