use of com.emc.nas.vnxfile.xmlapi.Status 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.nas.vnxfile.xmlapi.Status in project coprhd-controller by CoprHD.
the class VNXFSQuotaDirsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("processing quota dir id response" + resultObj);
final PostMethod result = (PostMethod) resultObj;
try {
ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
if (null != responsePacket.getPacketFault()) {
Status status = responsePacket.getPacketFault();
processErrorStatus(status, keyMap);
} else {
boolean isQuotaDirFound = false;
List<Object> quotaDirList = getQueryResponse(responsePacket);
List<TreeQuota> quotaDirs = new ArrayList<TreeQuota>();
final String fsId = (String) keyMap.get(VNXFileConstants.FILESYSTEM_ID);
_logger.info("Quota dirs for parent file systems to match: {} Size of quotadir found {} ", fsId, quotaDirList.size());
Iterator<Object> quotaDirItr = quotaDirList.iterator();
if (quotaDirItr.hasNext()) {
Status status = (Status) quotaDirItr.next();
if (status.getMaxSeverity() == Severity.OK) {
while (quotaDirItr.hasNext()) {
TreeQuota quotaDir = (TreeQuota) quotaDirItr.next();
_logger.debug("searching quota dir: {}", quotaDir.getTree());
if (quotaDir.getFileSystem().equalsIgnoreCase(fsId)) {
String id = quotaDir.getTree();
quotaDirs.add(quotaDir);
_logger.info("Found matching quota dir: {}", id);
isQuotaDirFound = true;
}
}
if (isQuotaDirFound) {
_logger.info("Number of Quota dirs found for FS : {} are : {}", fsId, quotaDirs.size());
keyMap.put(VNXFileConstants.QUOTA_DIR_LIST, quotaDirs);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
}
} else {
_logger.error("Error in getting the quota dir information.");
}
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the quota dir response due to {}", ex.getMessage());
keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
use of com.emc.nas.vnxfile.xmlapi.Status in project coprhd-controller by CoprHD.
the class VNXFileSystemInfoProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final PostMethod result = (PostMethod) resultObj;
try {
ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
// Extract session information from the response header.
Header[] headers = result.getResponseHeaders(VNXFileConstants.CELERRA_SESSION);
if (null != headers && headers.length > 0) {
keyMap.put(VNXFileConstants.CELERRA_SESSION, headers[0].getValue());
_logger.info("Received celerra session info from the Server.");
}
if (null != responsePacket.getPacketFault()) {
Status status = responsePacket.getPacketFault();
processErrorStatus(status, keyMap);
} else {
List<Object> filesystemList = getQueryResponse(responsePacket);
processFilesystemList(filesystemList, keyMap);
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the vnx fileShare response due to {}", ex.getMessage());
} finally {
result.releaseConnection();
}
}
use of com.emc.nas.vnxfile.xmlapi.Status in project coprhd-controller by CoprHD.
the class VNXFileSystemModifyProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("Processing VNX File System modify 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> queryResponse = getTaskResponse(responsePacket);
Iterator<Object> queryRespItr = queryResponse.iterator();
while (queryRespItr.hasNext()) {
Object responseObj = queryRespItr.next();
if (responseObj != null) {
if (responseObj instanceof TaskResponse) {
TaskResponse taskResp = (TaskResponse) responseObj;
status = taskResp.getStatus();
_logger.info("FileSystem modify task response status: {}", status.getMaxSeverity().name());
if (status.getMaxSeverity() == Severity.OK) {
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
} else {
processErrorStatus(status, keyMap);
}
break;
} else {
_logger.info("Response not TaskResponse: {}", responseObj.getClass().getName());
}
} else {
_logger.warn("FileSystem modify task response is null");
}
}
// Extract session information from the response header.
Header[] headers = result.getResponseHeaders(VNXFileConstants.CELERRA_SESSION);
if (null != headers && headers.length > 0) {
keyMap.put(VNXFileConstants.CELERRA_SESSION, headers[0].getValue());
_logger.info("Received celerra session information from the Server.");
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the vnx file sys modify response due to ", ex);
keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
use of com.emc.nas.vnxfile.xmlapi.Status 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);
}
Aggregations