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();
}
}
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);
}
}
}
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);
}
}
}
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);
}
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();
}
}
Aggregations