use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXSnapshotCreateProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("Processing VNX Snapshot Create 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 instanceof TaskResponse) {
TaskResponse taskResp = (TaskResponse) responseObj;
status = taskResp.getStatus();
_logger.info("NewCheckpoint task desc: {} : severity {}", status, status.getMaxSeverity());
if (status.getMaxSeverity() == Severity.OK) {
_logger.info("NewCheckpoint creation success");
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
} else if (status.getMaxSeverity() == Severity.ERROR) {
processErrorStatus(status, keyMap);
_logger.info("NewCheckpoint creation failed");
}
break;
} else {
_logger.info("Response not TaskResponse: {}", responseObj.getClass().getName());
}
}
// 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 snapshot create 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.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXControlStationProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final PostMethod result = (PostMethod) resultObj;
_logger.info("processing vnx info response" + resultObj);
try {
ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
if (null != responsePacket.getPacketFault()) {
Status status = responsePacket.getPacketFault();
processErrorStatus(status, keyMap);
} else {
List<Object> queryResponse = getQueryResponse(responsePacket);
Iterator<Object> queryRespItr = queryResponse.iterator();
while (queryRespItr.hasNext()) {
Object responseObj = queryRespItr.next();
if (responseObj instanceof CelerraSystem) {
CelerraSystem system = (CelerraSystem) responseObj;
VNXControlStation cs = new VNXControlStation(system.getSerial(), system.getVersion());
keyMap.put(VNXFileConstants.CONTROL_STATION_INFO, cs);
break;
}
}
// 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("Recieved celerra session information from the Server.");
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the vnx info response due to ", ex);
} finally {
result.releaseConnection();
}
}
use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXDataMoverIdProcessor 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> dataMoverList = getQueryResponse(responsePacket);
processDataMoverList(dataMoverList, keyMap);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the vnx data mover 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.ResponsePacket 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.ResponsePacket 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();
}
}
Aggregations