use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class MetricSequenceProcessor method processResult.
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
while (it.hasNext()) {
CIMInstance blockManifestInstance = null;
try {
blockManifestInstance = it.next();
String elementType = getCIMPropertyValue(blockManifestInstance, Constants.ELEMENTTYPE);
String elementName = getCIMPropertyValue(blockManifestInstance, Constants.ELEMENTNAME);
String[] csvSeq = (String[]) blockManifestInstance.getPropertyValue(Constants.CSV_SEQUENCE);
List<String> csvSequenceList = new LinkedList<String>(Arrays.asList(csvSeq));
_logger.debug("csvSequenceList: {}", csvSequenceList);
if (elementType.equals(Constants.VOLUME_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_VOLUME_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_VOLUME_MANIFEST, csvSequenceList);
} else if (elementType.equals(Constants.FEPORT_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_FEPORT_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_FEPORT_MANIFEST, csvSequenceList);
} else if (elementType.equals(Constants.FEADAPT_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_FEADAPT_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_FEADAPT_MANIFEST, csvSequenceList);
} else if (elementType.equals(Constants.SYSTEM_ELEMENTTYPE) && elementName.equals(Constants.STORAGEOS_SYSTEM_MANIFEST)) {
keyMap.put(Constants.STORAGEOS_SYSTEM_MANIFEST, csvSequenceList);
}
} catch (Exception e) {
_logger.warn("MetricSequence call failed for {}", getCIMPropertyValue(blockManifestInstance, Constants.INSTANCEID), e);
}
}
} catch (Exception e) {
_logger.error("Processing MetricSequence call failed", e);
}
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class QueryStatisticsProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
try {
final Iterator<?> it = (Iterator<?>) resultObj;
// Only 1 entry per each Array always
while (it.hasNext()) {
final CIMInstance queryInstance = (CIMInstance) it.next();
keyMap.put(Constants._TimeCollected, System.currentTimeMillis());
addPath(keyMap, operation.getResult(), queryInstance.getObjectPath());
}
} catch (Exception e) {
_logger.error("Failed while processing QueryStatistics :", e);
}
resultObj = null;
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class SPProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
final Iterator<?> it = (Iterator<?>) resultObj;
while (it.hasNext()) {
try {
final CIMInstance allocatedfrompool = (CIMInstance) it.next();
CIMObjectPath path = (CIMObjectPath) allocatedfrompool.getProperty("Dependent").getValue();
if (path.getObjectName().contains(_volume)) {
String key = createKeyfromPath(path);
// this check means, validating whether this Volume is
// managed by Bourne
Stat metrics = (Stat) getMetrics(keyMap, key);
_logger.debug("Processing Volume to extract Allocated Capacity: {}", key);
// Allocated Capacity =
// CIM_AllocatedFromStoragePool.SpaceConsumed (in bytes)
metrics.setAllocatedCapacity(Long.parseLong(allocatedfrompool.getProperty(_spaceConsumed).getValue().toString()));
}
} catch (Exception e) {
if (!(e instanceof BaseCollectionException)) {
_logger.error(" Allocated Capacity : ", e);
}
}
}
resultObj = null;
}
use of com.emc.storageos.plugins.BaseCollectionException in project coprhd-controller by CoprHD.
the class VNXAllQuotaDirsProcessor 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 {
List<Object> quotaDirList = getQueryResponse(responsePacket);
List<TreeQuota> quotaDirs = new ArrayList<TreeQuota>();
_logger.info("Received the response size {} ", 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());
String id = quotaDir.getTree();
quotaDirs.add(quotaDir);
_logger.info("Found matching quota dir id: {}", id);
}
keyMap.put(VNXFileConstants.QUOTA_DIR_LIST, quotaDirs);
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_SUCCESS);
}
}
}
} 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 VNXCifsConfigProcessor 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 cifs config response" + 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> queryResponse = getQueryResponse(responsePacket);
Iterator<Object> queryRespItr = queryResponse.iterator();
Boolean enabled = false;
List<VNXCifsServer> cifsServers = new ArrayList<>();
while (queryRespItr.hasNext()) {
Object responseObj = queryRespItr.next();
if (responseObj instanceof CifsServer) {
CifsServer config = (CifsServer) responseObj;
_logger.info("CIFS Interfaces: {}, for VDM: {}", config.getInterfaces(), config.getMover());
enabled = true;
// Get the domain of cifs server!!!
String domain = new String();
if (config.getNT40ServerData() != null) {
domain = config.getNT40ServerData().getDomain();
} else if (config.getW2KServerData() != null) {
domain = config.getW2KServerData().getDomain();
} else if (config.getStandaloneServerData() != null) {
domain = config.getStandaloneServerData().getWorkgroup();
}
if (!domain.isEmpty()) {
_logger.info("domain cofigured for cifs : {}", domain);
}
VNXCifsServer server = new VNXCifsServer(config.getName(), config.getMover(), config.getType().toString(), config.isMoverIdIsVdm(), config.getInterfaces(), domain);
cifsServers.add(server);
_logger.info("Add : {}", server.toString());
}
}
keyMap.put(VNXFileConstants.CIFS_SUPPORTED, enabled);
keyMap.put(VNXFileConstants.CIFS_SERVERS, cifsServers);
}
} catch (final Exception ex) {
_logger.error("Exception occurred while processing the vnx cifs config response due to ", ex);
keyMap.put(VNXFileConstants.FAULT_DESC, ex.getMessage());
keyMap.put(VNXFileConstants.CMD_RESULT, VNXFileConstants.CMD_FAILURE);
} finally {
result.releaseConnection();
}
}
Aggregations