Search in sources :

Example 66 with CIMObjectPath

use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.

the class CIMObjectPathQueryFactory method getTierPolicyRulePath.

/**
 * TODO StoragePoolSetting or Tier_policyRule
 */
@Override
public CIMObjectPath getTierPolicyRulePath(StorageSystem storageDevice, String policyName) {
    String tierPolicyRuleClazz = storageDevice.checkIfVmax3() ? STORAGE_POOL_SETTING : TIER_POLICY_RULE;
    String wql = format("SELECT * FROM %s WHERE SystemName like '%s' AND PolicyRuleName like '%s'", prefixWithParamName(tierPolicyRuleClazz), storageDevice.getSerialNumber(), policyName);
    CIMObjectPath queryClass = getQueryClass(TIER_POLICY_SERVICE);
    CIMObjectPath[] paths = execQuery(storageDevice, queryClass, wql);
    if (paths.length == 0) {
        return null;
    }
    return paths[0];
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath)

Example 67 with CIMObjectPath

use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.

the class CIMObjectPathQueryFactory method getStoragePoolPath.

@Override
public CIMObjectPath getStoragePoolPath(StorageSystem storage, StoragePool storagePool) {
    String wql = format("SELECT * FROM %s WHERE InstanceID like '%s' AND InstanceID like '%s'", storagePool.getPoolClassName(), storagePool.getPoolName(), storage.getSerialNumber());
    CIMObjectPath queryClass = getQueryClass(storagePool.getPoolClassName());
    CIMObjectPath[] paths = execQuery(storage, queryClass, wql);
    if (paths.length == 0) {
        return null;
    }
    return paths[0];
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath)

Example 68 with CIMObjectPath

use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.

the class CIMObjectPathQueryFactory method getControllerReplicationSvcPath.

@Override
public CIMObjectPath getControllerReplicationSvcPath(StorageSystem storageDevice) {
    String wql = format("SELECT * FROM %s WHERE SystemName like '%s'", prefixWithParamName(REPLICATION_SERVICE), storageDevice.getSerialNumber());
    CIMObjectPath queryClass = getQueryClass(REPLICATION_SERVICE);
    CIMObjectPath[] paths = execQuery(storageDevice, queryClass, wql);
    if (paths.length == 0) {
        return null;
    }
    return paths[0];
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath)

Example 69 with CIMObjectPath

use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.

the class ExportProcessor method processResult.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.plugins.common.Processor#processResult(com.emc.storageos.plugins.common.domainmodel.Operation,
     * java.lang.Object, java.util.Map)
     */
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    initialize(operation, resultObj, keyMap);
    CloseableIterator<CIMInstance> it = null;
    EnumerateResponse<CIMInstance> response = null;
    List<Initiator> matchedInitiators = new ArrayList<Initiator>();
    List<StoragePort> matchedPorts = new ArrayList<StoragePort>();
    WBEMClient client = SMICommunicationInterface.getCIMClient(keyMap);
    StringSet knownIniSet = new StringSet();
    StringSet knownNetworkIdSet = new StringSet();
    StringSet knownPortSet = new StringSet();
    StringSet knownVolumeSet = new StringSet();
    try {
        // set lun masking view CIM path
        CIMObjectPath path = this.getObjectPathfromCIMArgument(_args, keyMap);
        UnManagedExportMask mask = this.getUnManagedExportMask(path);
        mask.setMaskingViewPath(path.toString());
        _logger.info("looking at lun masking view: " + path.toString());
        CIMInstance lunMaskingView = client.getInstance(path, false, false, null);
        if (lunMaskingView != null) {
            String maskName = CIMPropertyFactory.getPropertyValue(lunMaskingView, SmisConstants.CP_NAME);
            if (maskName != null) {
                mask.setMaskName(maskName);
            }
            _logger.info("set UnManagedExportMask maskName to " + mask.getMaskName());
        } else {
            _logger.info("lunMaskingView was null");
        }
        CIMProperty<String> deviceIdProperty = (CIMProperty<String>) path.getKey(SmisConstants.CP_DEVICE_ID);
        if (deviceIdProperty != null) {
            mask.setNativeId(deviceIdProperty.getValue());
        }
        _logger.info("set UnManagedExportMask nativeId to " + mask.getNativeId());
        // set storage system id
        URI systemId = (URI) keyMap.get(Constants.SYSTEMID);
        mask.setStorageSystemUri(systemId);
        response = (EnumerateResponse<CIMInstance>) resultObj;
        processVolumesAndInitiatorsPaths(response.getResponses(), mask, matchedInitiators, matchedPorts, knownIniSet, knownNetworkIdSet, knownPortSet, knownVolumeSet);
        while (!response.isEnd()) {
            _logger.info("Processing next Chunk");
            response = client.getInstancesWithPath(Constants.MASKING_PATH, response.getContext(), new UnsignedInteger32(BATCH_SIZE));
            processVolumesAndInitiatorsPaths(response.getResponses(), mask, matchedInitiators, matchedPorts, knownIniSet, knownNetworkIdSet, knownPortSet, knownVolumeSet);
        }
        // CTRL - 8918 - always update the mask with new initiators and volumes.
        mask.replaceNewWithOldResources(knownIniSet, knownNetworkIdSet, knownVolumeSet, knownPortSet);
        // get zones and store them?
        updateZoningMap(mask, matchedInitiators, matchedPorts);
        updateVplexBackendVolumes(mask, matchedInitiators);
        updateRecoverPointVolumes(mask, matchedInitiators);
    } catch (Exception e) {
        _logger.error("something failed", e);
    } finally {
        if (it != null) {
            it.close();
        }
        wrapUp();
        if (response != null) {
            try {
                client.closeEnumeration(Constants.MASKING_PATH, response.getContext());
            } catch (Exception e) {
                _logger.debug("Exception occurred while closing enumeration", e);
            }
        }
    }
}
Also used : ArrayList(java.util.ArrayList) StoragePort(com.emc.storageos.db.client.model.StoragePort) CIMObjectPath(javax.cim.CIMObjectPath) UnsignedInteger32(javax.cim.UnsignedInteger32) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Initiator(com.emc.storageos.db.client.model.Initiator) CIMProperty(javax.cim.CIMProperty) StringSet(com.emc.storageos.db.client.model.StringSet) WBEMClient(javax.wbem.client.WBEMClient) UnManagedExportMask(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedExportMask)

Example 70 with CIMObjectPath

use of javax.cim.CIMObjectPath in project coprhd-controller by CoprHD.

the class AbstractFASTPolicyProcessor method addStoragePoolstoPolicy.

/**
 * add StoragePools to FAST Policy Object
 * Existing Pools associated with Policy will get replaced.
 *
 * @param policyObjectPath
 * @param it
 * @param dbClient
 * @throws IOException
 */
@SuppressWarnings("unchecked")
protected void addStoragePoolstoPolicy(List<CIMObjectPath> policyObjectPaths, Iterator<CIMObjectPath> it, DbClient dbClient, Map<String, Object> keyMap, String tierID) throws IOException {
    // PolicyToPoolInfo ---> Map <PolicyName, Set<String> Pools>
    // set already at runtime
    Map<String, Set<String>> policytopoolMapping = (Map<String, Set<String>>) keyMap.get(Constants.POLICY_TO_POOLS_MAPPING);
    while (it.hasNext()) {
        CIMObjectPath poolObjectPath = it.next();
        URI poolURI = getStoragePoolURI(poolObjectPath, dbClient);
        if (null != poolURI) {
            for (CIMObjectPath policyObjectPath : policyObjectPaths) {
                String policyID = getFASTPolicyID(policyObjectPath);
                if (!policytopoolMapping.containsKey(policyID)) {
                    policytopoolMapping.put(policyID, new HashSet<String>());
                }
                policytopoolMapping.get(policyID).add(poolURI.toString());
            }
        }
    }
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CIMObjectPath(javax.cim.CIMObjectPath) HashMap(java.util.HashMap) Map(java.util.Map) URI(java.net.URI)

Aggregations

CIMObjectPath (javax.cim.CIMObjectPath)582 CIMInstance (javax.cim.CIMInstance)254 WBEMException (javax.wbem.WBEMException)236 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)208 CIMArgument (javax.cim.CIMArgument)190 ArrayList (java.util.ArrayList)139 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)118 Volume (com.emc.storageos.db.client.model.Volume)108 URI (java.net.URI)108 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)82 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)76 WBEMClient (javax.wbem.client.WBEMClient)75 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)72 HashSet (java.util.HashSet)68 HashMap (java.util.HashMap)63 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)57 CIMProperty (javax.cim.CIMProperty)57 IOException (java.io.IOException)55 BlockObject (com.emc.storageos.db.client.model.BlockObject)52 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)52