use of com.emc.nas.vnxfile.xmlapi.ResponsePacket in project coprhd-controller by CoprHD.
the class VNXSnapshotIdProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("processing snapshot 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 isSnapshotFound = false;
boolean isFSMatch = false;
String id = "";
List<Object> snapshotList = getQueryResponse(responsePacket);
final String snapName = (String) keyMap.get(VNXFileConstants.SNAPSHOT_NAME);
final String fsId = (String) keyMap.get(VNXFileConstants.FILESYSTEM_ID);
_logger.info("Snapshot name to match: {} Size of snaps found {} ", snapName, snapshotList.size());
Iterator<Object> snapshotItr = snapshotList.iterator();
if (snapshotItr.hasNext()) {
Status status = (Status) snapshotItr.next();
if (status.getMaxSeverity() == Severity.OK) {
while (snapshotItr.hasNext()) {
Checkpoint point = (Checkpoint) snapshotItr.next();
_logger.debug("searching snapshot: {}", point.getName());
if (point.getName().equals(snapName)) {
id = point.getCheckpoint();
_logger.info("Found matching snapshot: {}", id);
isSnapshotFound = true;
_logger.info("Checking if FS matches: {}", fsId);
if (fsId.equalsIgnoreCase(point.getCheckpointOf())) {
keyMap.put(VNXFileConstants.SNAPSHOT_ID, id);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
_logger.info("FS matched successfully: {}", fsId);
isFSMatch = true;
break;
}
}
}
if (isSnapshotFound && !isFSMatch) {
_logger.error("Snapshot creation failed due to: Snapshot {} already exists", id);
}
if (!isSnapshotFound) {
_logger.error("Error in getting the snapshot information.");
}
} else {
_logger.error("Error in getting the snapshot information.");
}
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the snapshot 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 VNXFileSystemMountProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("Processing VNX Mount 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 system = (TaskResponse) responseObj;
status = system.getStatus();
_logger.info("Mount 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());
}
}
// 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 prov 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 VNXFileSystemUnexportProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("Processing VNX File System Unexport 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 Unexport 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());
}
}
// 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 VNXDataMoverNameProcessor 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 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 VNXFSSnapshotsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("processing snapshot id 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> snapshotList = getQueryResponse(responsePacket);
List<Checkpoint> snapsList = new ArrayList<Checkpoint>();
final String fsId = (String) keyMap.get(VNXFileConstants.FILESYSTEM_ID);
_logger.info("Looking for all snapshots of filesystem {}", fsId);
Iterator<Object> snapshotItr = snapshotList.iterator();
if (snapshotItr.hasNext()) {
status = (Status) snapshotItr.next();
if (status.getMaxSeverity() == Severity.OK) {
while (snapshotItr.hasNext()) {
Checkpoint point = (Checkpoint) snapshotItr.next();
_logger.debug("searching snapshot: {} - {}", point.getName(), point.getCheckpointOf());
if (point.getCheckpointOf().equalsIgnoreCase(fsId)) {
String id = point.getCheckpoint();
String localFSId = point.getCheckpointOf();
_logger.info("Found matching snapshot: {} and checkpoint of {}", id, localFSId);
snapsList.add(point);
}
}
_logger.info("Number of Snapshots found for FS : {} are : {}", fsId, snapsList.size());
keyMap.put(VNXFileConstants.SNAPSHOTS_LIST, snapsList);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
} else {
_logger.error("Error in getting the snapshot information.");
processErrorStatus(status, keyMap);
}
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the snapshot response due to {}", ex.getMessage());
keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
Aggregations