use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXUserAccountsProcessor 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> userAccountList = getQueryResponseEx(responsePacket);
processUserAccountList(userAccountList, keyMap);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the VNX User Account 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 VNXVolumeStatsProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final PostMethod result = (PostMethod) resultObj;
_logger.info("processing volumeStats response" + resultObj);
try {
ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
List<Object> volumeStats = getQueryStatsResponse(responsePacket);
Iterator<Object> iterator = volumeStats.iterator();
Map<String, String> volFileMap = (Map<String, String>) keyMap.get(VNXFileConstants.VOLFILESHAREMAP);
List<Stat> statsList = (List<Stat>) keyMap.get(VNXFileConstants.STATS);
// and proceed with rest of the Mover stats.
while (iterator.hasNext()) {
VolumeSetStats volStats = (VolumeSetStats) iterator.next();
List<Sample> sampleList = volStats.getSample();
processVolumeSampleList(sampleList, keyMap, volFileMap, statsList);
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the volume stats response due to {}", ex.getMessage());
} finally {
result.releaseConnection();
}
}
use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXFileSystemSnapshotRestoreProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("Processing VNX File System Snapshot Restore 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("FileSystem Snapshot restore task status: {}", status.getMaxSeverity().name());
if (status.getMaxSeverity() == Severity.OK) {
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
// Since the restore worked, the snapshot created by the restore process needs to be removed.
// Setting up the name for the next processor.
String checkPoint = (String) keyMap.get(VNXFileConstants.FILESYSTEM_NAME);
checkPoint += RESTORE_CHKPNT;
keyMap.put(VNXFileConstants.SNAPSHOT_NAME, checkPoint);
} else {
processErrorStatus(status, keyMap);
}
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 create file sys 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 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();
}
}
use of com.emc.nas.vnxfile.xmlapi.ResponsePacket 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();
}
}
Aggregations