use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException 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]);
}
}
use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException in project coprhd-controller by CoprHD.
the class VNXFileSystemIdProcessor 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 {
String fsName = (String) keyMap.get(VNXFileConstants.FILESYSTEM_NAME);
String fsId = (String) keyMap.get(VNXFileConstants.FILESYSTEM_ID);
boolean foundId = false;
Iterator<Object> iterator = filesystemList.iterator();
if (iterator.hasNext()) {
Status status = (Status) iterator.next();
if (status.getMaxSeverity() == Severity.OK) {
while (iterator.hasNext()) {
FileSystem fileSystem = (FileSystem) iterator.next();
if (fileSystem.getName().equals(fsName) || fileSystem.getFileSystem().equals(fsId)) {
String id = fileSystem.getFileSystem();
_logger.info("Found matching file system: {}", id);
keyMap.put(VNXFileConstants.FILESYSTEM_ID, id);
keyMap.put(VNXFileConstants.FILESYSTEM, fileSystem);
keyMap.put(VNXFileConstants.IS_FILESYSTEM_AVAILABLE_ON_ARRAY, Boolean.TRUE);
foundId = true;
break;
}
}
if (!foundId) {
_logger.error("Did not find file system ID for {}", fsName);
keyMap.put(VNXFileConstants.IS_FILESYSTEM_AVAILABLE_ON_ARRAY, Boolean.FALSE);
}
} else {
throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
}
}
}
use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException in project coprhd-controller by CoprHD.
the class VNXFileSystemInfoProcessor 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();
Map<String, String> volFilesystemMap = new HashMap<String, String>();
Set<String> moverIds = new HashSet<String>();
if (iterator.hasNext()) {
Status status = (Status) iterator.next();
if (status.getMaxSeverity() == Severity.OK) {
while (iterator.hasNext()) {
FileSystem fileSystem = (FileSystem) iterator.next();
volFilesystemMap.put(fileSystem.getVolume(), fileSystem.getFileSystem());
List<MoverOrVdmRef> roFileSysHosts = fileSystem.getRoFileSystemHosts();
Iterator<MoverOrVdmRef> roFileSysHostItr = roFileSysHosts.iterator();
while (roFileSysHostItr.hasNext()) {
MoverOrVdmRef mover = roFileSysHostItr.next();
moverIds.add(mover.getMover());
}
}
} else {
throw new VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
}
}
keyMap.put(VNXFileConstants.MOVERLIST, moverIds);
keyMap.put(VNXFileConstants.VOLFILESHAREMAP, volFilesystemMap);
}
use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException 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);
}
}
}
use of com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException in project coprhd-controller by CoprHD.
the class VNXFileSystemsProcessor method processFilesystemList.
/**
* Process the fileSystemList which are received from XMLAPI server.
*
* @param filesystemList : List of FileSystem objects.
* @param keyMap : keyMap.
*/
private List<VNXFileSystem> processFilesystemList(List<Object> filesystemList, Map<String, Object> keyMap) throws VNXFilePluginException {
Iterator<Object> iterator = filesystemList.iterator();
List<VNXFileSystem> processedFileSystem = new ArrayList<VNXFileSystem>();
if (iterator.hasNext()) {
Status status = (Status) iterator.next();
if ((status.getMaxSeverity() == Severity.OK) || (status.getMaxSeverity() == Severity.WARNING)) {
Map<String, FileSystem> fileSystems = new HashMap<String, FileSystem>();
Map<String, FileSystemCapacityInfo> fileSysCapacityInfos = new HashMap<String, FileSystemCapacityInfo>();
while (iterator.hasNext()) {
Object obj = iterator.next();
if (obj instanceof FileSystem) {
FileSystem fs = (FileSystem) obj;
if (fs.isInternalUse() == false) {
fileSystems.put(fs.getFileSystem(), fs);
}
} else if (obj instanceof FileSystemCapacityInfo) {
FileSystemCapacityInfo fsCapacityInfo = (FileSystemCapacityInfo) obj;
fileSysCapacityInfos.put(fsCapacityInfo.getFileSystem(), fsCapacityInfo);
}
}
Iterator it = fileSystems.keySet().iterator();
while (it.hasNext()) {
String fsId = (String) it.next();
FileSystem fileSystem = fileSystems.get(fsId);
FileSystemCapacityInfo fsCapacity = fileSysCapacityInfos.get(fsId);
List<String> pools = new ArrayList<String>();
if (null != fileSystem.getStoragePools()) {
pools = fileSystem.getStoragePools();
}
String poolId = "";
if (null != pools) {
poolId = pools.get(0);
}
StringBuffer debugInfo = new StringBuffer();
debugInfo.append("VNXFileSystem : " + fileSystem.getName());
debugInfo.append(" Pool : " + poolId);
long totalCapacity = 0;
VNXFileSystem vnxFS = new VNXFileSystem(fileSystem.getName(), Integer.valueOf(fileSystem.getFileSystem()));
if (fileSystem.isVirtualProvisioning()) {
vnxFS.setType(UnManagedDiscoveredObject.SupportedProvisioningType.THIN.name());
FileSystemAutoExtInfo autoExtInfo = fileSystem.getFileSystemAutoExtInfo();
if (null != autoExtInfo) {
totalCapacity = autoExtInfo.getAutoExtensionMaxSize();
totalCapacity = totalCapacity * MBTOBYTECONVERTER;
} else {
totalCapacity = fsCapacity.getVolumeSize() * MBTOBYTECONVERTER;
}
} else {
vnxFS.setType(UnManagedDiscoveredObject.SupportedProvisioningType.THICK.name());
totalCapacity = fsCapacity.getVolumeSize() * MBTOBYTECONVERTER;
}
vnxFS.setStoragePool(poolId);
debugInfo.append(" fsCapacity.getVolumeSize() : " + fsCapacity.getVolumeSize());
vnxFS.setTotalCapacity(totalCapacity + "");
vnxFS.setUsedCapcity("0");
if (null != fsCapacity.getResourceUsage()) {
// We can get Used capacity
// Size is in MB, convert to Bytes
debugInfo.append(" fsCapacity.getUsedCapacity:" + fsCapacity.getResourceUsage().getSpaceUsed());
long usedCapacity = fsCapacity.getResourceUsage().getSpaceUsed() * MBTOBYTECONVERTER;
vnxFS.setUsedCapcity(usedCapacity + "");
}
debugInfo.append(" Total Capacity :" + vnxFS.getTotalCapacity());
debugInfo.append(" Used Capacity :" + vnxFS.getUsedCapacity());
_logger.debug(debugInfo.toString());
processedFileSystem.add(vnxFS);
}
} else {
throw new com.emc.storageos.plugins.metering.vnxfile.VNXFilePluginException("Fault response received from XMLAPI Server.", VNXFilePluginException.ERRORCODE_INVALID_RESPONSE);
}
}
return processedFileSystem;
}
Aggregations