Search in sources :

Example 21 with UnsignedInteger32

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);
            }
        }
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) SmisException(com.emc.storageos.volumecontroller.impl.smis.SmisException) StringSet(com.emc.storageos.db.client.model.StringSet) WBEMClient(javax.wbem.client.WBEMClient) Map(java.util.Map) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Example 22 with UnsignedInteger32

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();
        }
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) WBEMClient(javax.wbem.client.WBEMClient) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) EnumerateResponse(javax.wbem.client.EnumerateResponse)

Example 23 with UnsignedInteger32

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;
    }
}
Also used : UnsignedInteger32(javax.cim.UnsignedInteger32) WBEMException(javax.wbem.WBEMException) FCEndpoint(com.emc.storageos.db.client.model.FCEndpoint) CIMArgument(javax.cim.CIMArgument)

Example 24 with UnsignedInteger32

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;
    }
}
Also used : UnsignedInteger32(javax.cim.UnsignedInteger32) WBEMException(javax.wbem.WBEMException) CIMInstance(javax.cim.CIMInstance) FCEndpoint(com.emc.storageos.db.client.model.FCEndpoint) CIMArgument(javax.cim.CIMArgument)

Example 25 with UnsignedInteger32

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;
}
Also used : UnsignedInteger32(javax.cim.UnsignedInteger32) CIMArgument(javax.cim.CIMArgument)

Aggregations

UnsignedInteger32 (javax.cim.UnsignedInteger32)29 CIMObjectPath (javax.cim.CIMObjectPath)22 CIMArgument (javax.cim.CIMArgument)15 WBEMClient (javax.wbem.client.WBEMClient)14 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)11 CIMInstance (javax.cim.CIMInstance)11 WBEMException (javax.wbem.WBEMException)7 FCEndpoint (com.emc.storageos.db.client.model.FCEndpoint)6 StoragePool (com.emc.storageos.db.client.model.StoragePool)6 EnumerateResponse (javax.wbem.client.EnumerateResponse)5 UnManagedVolume (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedVolume)4 Volume (com.emc.storageos.db.client.model.Volume)4 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 CimConnection (com.emc.storageos.cimadapter.connections.cim.CimConnection)3 BlockMirror (com.emc.storageos.db.client.model.BlockMirror)3 StringSet (com.emc.storageos.db.client.model.StringSet)3 UnManagedExportMask (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)3 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)3 IOException (java.io.IOException)3