use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class VNXDataMoverInterfaceProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
// TODO Auto-generated method stub
final PostMethod result = (PostMethod) resultObj;
_logger.info("processing PortMetrics 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();
LogicalNetworkDevice logicalNetworkDevice = null;
// this interface to pysical port map.
Map<String, List<String>> interPortMap = null;
// this is mover to interportMap
Map<String, Map<String, List<String>>> moverInterMap = new HashMap<String, Map<String, List<String>>>();
Map<String, String> portSpeedMap = new HashMap<String, String>();
while (queryRespItr.hasNext()) {
Object responseObj = queryRespItr.next();
if (responseObj instanceof LogicalNetworkDevice) {
logicalNetworkDevice = (LogicalNetworkDevice) responseObj;
// get logical device map
interPortMap = moverInterMap.get(logicalNetworkDevice.getMover());
if (interPortMap == null) {
interPortMap = new HashMap<String, List<String>>();
}
// process logical network device
processNetworkDevice(logicalNetworkDevice, interPortMap);
// add to map <movername, Map<interfaceIP, List<physicalport>>
if (!interPortMap.isEmpty()) {
moverInterMap.put(logicalNetworkDevice.getMover(), interPortMap);
}
// process logical network device speed
processPortSpeed(logicalNetworkDevice, portSpeedMap);
}
}
keyMap.put(VNXFileConstants.INTREFACE_PORT_MAP, moverInterMap);
// STORAGE_PORT_SPEED_MAP
keyMap.put(VNXFileConstants.LOGICAL_NETWORK_SPEED_MAP, portSpeedMap);
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 Port Metrics information from the Server.");
}
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the Port Metrics response due to {}", ex.getMessage());
} finally {
result.releaseConnection();
}
}
use of com.emc.storageos.plugins.BaseCollectionException 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.storageos.plugins.BaseCollectionException 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();
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class VNXFileQuotaDirectoryIdProcessor 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);
final String quotaDirName = (String) keyMap.get(VNXFileConstants.QUOTA_DIR_NAME);
String quotaDirPath = "/" + quotaDirName;
_logger.info("Quota dir name to match: {} Size of quotadir found {} ", quotaDirName, 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.getPath().equals(quotaDirPath)) {
String id = quotaDir.getTree();
_logger.info("Found matching quota dir: {}", id);
keyMap.put(VNXFileConstants.QUOTA_DIR_ID, id);
keyMap.put(VNXFileConstants.QUOTA_DIR_PATH, quotaDir.getPath());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
isQuotaDirFound = true;
break;
}
}
if (!isQuotaDirFound) {
_logger.error("Error in getting the quota dir information.");
}
} 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.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class VNXFileQuotaTreeProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
_logger.info("Processing VNX Quota Tree Create/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 instanceof TaskResponse) {
TaskResponse taskResp = (TaskResponse) responseObj;
status = taskResp.getStatus();
_logger.info("Quota Tree Creation/Modification task desc: {} : severity {}", status, status.getMaxSeverity());
if (status.getMaxSeverity() == Severity.OK) {
_logger.info("Quota Tree creation/modification success");
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
} else if (status.getMaxSeverity() == Severity.ERROR) {
_logger.info("Quota Tree creation/modification failed");
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
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 quota tree create response due to ", ex);
keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
Aggregations