use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class ExportHLUProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
CloseableIterator<CIMInstance> protocolControllerForUnitInstances = null;
EnumerateResponse<CIMInstance> protocolControllerForUnitInstanceChunks = null;
dbClient = (DbClient) keyMap.get(Constants.dbClient);
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
@SuppressWarnings("unchecked") Map<String, StringSet> volumeToExportMasksHLUMap = (Map<String, StringSet>) keyMap.get(Constants.UN_VOLUME_EXPORT_MASK_HLUS_MAP);
CIMObjectPath maskingViewPath = null;
try {
maskingViewPath = getObjectPathfromCIMArgument(args, keyMap);
logger.info("Masking view: {}", maskingViewPath.toString());
UnManagedExportMask uem = getUnManagedExportMask(maskingViewPath);
if (uem == null) {
logger.info("Skipping HLU discovery as there is no unmananged export mask found for masking path {}", maskingViewPath.toString());
return;
}
protocolControllerForUnitInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
protocolControllerForUnitInstances = protocolControllerForUnitInstanceChunks.getResponses();
processMaskHLUs(protocolControllerForUnitInstances, uem, volumeToExportMasksHLUMap);
while (!protocolControllerForUnitInstanceChunks.isEnd()) {
logger.info("Processing Next ProtocolControllerForUnit Chunk of size {}", BATCH_SIZE);
protocolControllerForUnitInstanceChunks = client.getInstancesWithPath(maskingViewPath, protocolControllerForUnitInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
processMaskHLUs(protocolControllerForUnitInstanceChunks.getResponses(), uem, volumeToExportMasksHLUMap);
}
} catch (Exception e) {
String errMsg = "Extracting HLU for exported Volumes failed: " + e.getMessage();
logger.error(errMsg, e);
throw SmisException.exceptions.hluRetrievalFailed(errMsg, e);
} finally {
if (null != protocolControllerForUnitInstances) {
protocolControllerForUnitInstances.close();
}
if (null != protocolControllerForUnitInstanceChunks) {
try {
client.closeEnumeration(maskingViewPath, protocolControllerForUnitInstanceChunks.getContext());
} catch (Exception e) {
logger.debug("Exception occurred while closing enumeration", e);
}
}
}
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class CapacityPoolProcessor method processResult.
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
EnumerateResponse<CIMInstance> volumeInstanceChunks = (EnumerateResponse<CIMInstance>) resultObj;
WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
CloseableIterator<CIMInstance> volumeInstances = volumeInstanceChunks.getResponses();
try {
processVolumeCapacity(volumeInstances, keyMap);
while (!volumeInstanceChunks.isEnd()) {
CIMObjectPath storagePoolPath = getObjectPathfromCIMArgument(_args);
_logger.info("Processing Next Volume Chunk of size {}", BATCH_SIZE);
volumeInstanceChunks = client.getInstancesWithPath(storagePoolPath, volumeInstanceChunks.getContext(), new UnsignedInteger32(BATCH_SIZE));
processVolumeCapacity(volumeInstanceChunks.getResponses(), keyMap);
}
} catch (Exception e) {
_logger.error("Provisioned Capacity failure :", e);
} finally {
resultObj = null;
if (null != volumeInstances) {
volumeInstances.close();
}
}
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class BrocadeNetworkSMIS method endSession.
@SuppressWarnings("rawtypes")
public boolean endSession(WBEMClient client, CIMInstance zoneService, boolean commit) throws WBEMException {
UnsignedInteger32 result = null;
try {
int sessionState = cimIntegerProperty(zoneService, _SessionState);
if (sessionState == _notApplicable) {
// no session control implemented by this agent
return true;
}
int endMode = commit ? _ended : _terminated;
CIMArgument[] inargs = new CIMArgument[] { _cimArgumentFactory.uint16(_requestedSessionState, endMode) };
result = (UnsignedInteger32) client.invokeMethod(zoneService.getObjectPath(), _SessionControl, inargs, new CIMArgument[1]);
_log.info("End session returned code: " + result.intValue());
return result.intValue() == 0;
} catch (WBEMException ex) {
_log.error("Encountered an exception while trying to end a zone session." + ex.getMessage(), ex);
throw ex;
}
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class BrocadeNetworkSMIS method startSession.
@SuppressWarnings("rawtypes")
public CIMInstance startSession(WBEMClient client, String fabricId, String fabricWwn) throws NetworkControllerSessionLockedException, WBEMException {
UnsignedInteger32 result = null;
CIMInstance zoneService;
try {
zoneService = getZoneServiceInstance(client, fabricId, fabricWwn);
int sessionState = cimIntegerProperty(zoneService, _SessionState);
int requestedSessionState = cimIntegerProperty(zoneService, _requestedSessionState);
_log.debug("Entering startSession: " + zoneService.toString());
if (sessionState == _notApplicable) {
// no session control implemented by this agent
return zoneService;
}
if (sessionState != _ended || requestedSessionState != _noChange) {
_log.info("Zone session is locked by another user or another call. We will try again.");
zoneService = waitForSession(client, fabricId, fabricWwn);
}
CIMArgument[] inargs = new CIMArgument[] { _cimArgumentFactory.uint16(_requestedSessionState, _started) };
result = (UnsignedInteger32) client.invokeMethod(zoneService.getObjectPath(), _SessionControl, inargs, new CIMArgument[1]);
_log.info("Start session returned code: " + result.intValue());
if (result.intValue() == 0 || result.intValue() == 32772) {
zoneService = getZoneServiceInstance(client, fabricId, fabricWwn);
_log.debug("Leaving startSession: " + zoneService.toString());
return zoneService;
}
return null;
} catch (WBEMException ex) {
_log.error("Encountered an exception while trying to start a zone session." + ex.getMessage(), ex);
throw ex;
}
}
use of javax.cim.UnsignedInteger32 in project coprhd-controller by CoprHD.
the class BrocadeNetworkSMIS method activateZoneSet.
@SuppressWarnings("unchecked")
public boolean activateZoneSet(WBEMClient client, CIMInstance zoneServiceIns, CIMObjectPath zonesetObjectPath, boolean activate) throws WBEMException {
CIMArgument[] inargs = new CIMArgument[2];
inargs[0] = _cimArgumentFactory.reference(_ZoneSet, zonesetObjectPath);
inargs[1] = _cimArgumentFactory.bool(_Activate, activate);
CIMArgument[] outargs = new CIMArgument[1];
UnsignedInteger32 result = (UnsignedInteger32) client.invokeMethod(zoneServiceIns.getObjectPath(), _ActivateZoneSet, inargs, outargs);
return result.intValue() == 0;
}
Aggregations