Search in sources :

Example 61 with CIMInstance

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

the class SettingsInstanceProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        final CIMInstance poolSettingInstance = (CIMInstance) resultObj;
        addInstance(keyMap, operation.getResult(), poolSettingInstance);
    } catch (Exception e) {
        _logger.error("Processing Pool Setting Instances failed :", e);
    }
}
Also used : CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 62 with CIMInstance

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

the class VNXTierDomainToTiersProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        // indicates ExtremePerformance or Performance or Capacity Tier
        Object[] arguments = (Object[]) _args.get(0);
        CIMObjectPath tierDomainPath = (CIMObjectPath) arguments[0];
        CIMObjectPath storagePoolpath = (CIMObjectPath) keyMap.get(tierDomainPath.getKey(Constants.NAME).getValue());
        addTiersToPool(storagePoolpath, it, _dbClient, keyMap);
    } catch (Exception e) {
        _logger.error("VNX TierDomain to Tier Processing failed :", e);
    }
}
Also used : Iterator(java.util.Iterator) CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 63 with CIMInstance

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

the class XIVStorageConfigurationCapabilitiesProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
    _profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
    _dbClient = (DbClient) keyMap.get(Constants.dbClient);
    try {
        StorageSystem system = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
        while (it.hasNext()) {
            CIMInstance storageConfigurationInstance = it.next();
            UnsignedInteger16[] supportedElementTypeArr = (UnsignedInteger16[]) storageConfigurationInstance.getPropertyValue(SUPPORTED_ELEMENT_TYPES);
            String supportedElementTypes = Arrays.toString(supportedElementTypeArr);
            if (_logger.isDebugEnabled()) {
                _logger.debug("Capability:" + supportedElementTypes);
            }
            if (supportedElementTypes.contains(THIN_VOLUME_SUPPORTED) && supportedElementTypes.contains(THICK_VOLUME_SUPPORTED)) {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN_AND_THICK.name());
            } else if (supportedElementTypes.contains(THIN_VOLUME_SUPPORTED)) {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN.name());
            } else if (supportedElementTypes.contains(THICK_VOLUME_SUPPORTED)) {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.THICK.name());
            } else {
                system.setSupportedProvisioningType(SupportedProvisioningTypes.NONE.name());
            }
            // should have only one instance
            break;
        }
        _dbClient.persistObject(system);
    } catch (Exception e) {
        _logger.error("Finding out Storage System Capability on Volume Creation failed: ", e);
    }
}
Also used : Iterator(java.util.Iterator) CIMInstance(javax.cim.CIMInstance) UnsignedInteger16(javax.cim.UnsignedInteger16) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 64 with CIMInstance

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

the class XIVStoragePoolProcessor method processResult.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
    _profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
    try {
        _newPoolList = new ArrayList<StoragePool>();
        _updatePoolList = new ArrayList<StoragePool>();
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        StorageSystem device = getStorageSystem(_dbClient, _profile.getSystemId());
        if (SupportedProvisioningTypes.NONE.name().equalsIgnoreCase(device.getSupportedProvisioningType())) {
            _logger.info("Storage System doesn't support volume creations :" + device.getLabel());
            return;
        }
        Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS);
        Map<URI, StoragePool> poolsToMatchWithVpool = new HashMap<URI, StoragePool>();
        while (it.hasNext()) {
            CIMInstance poolInstance = it.next();
            try {
                addPath(keyMap, operation.getResult(), poolInstance.getObjectPath());
                String hardSizeStr = getCIMPropertyValue(poolInstance, HARD_SIZE);
                long hardSize = Long.parseLong(hardSizeStr);
                String softSizeStr = getCIMPropertyValue(poolInstance, SOFT_SIZE);
                long softSize = Long.parseLong(softSizeStr);
                SupportedResourceTypes type = SupportedResourceTypes.THICK_ONLY;
                if (hardSize < softSize) {
                    type = SupportedResourceTypes.THIN_ONLY;
                }
                createStoragePool(_dbClient, device, poolInstance, PoolClassNames.IBMTSDS_VirtualPool.name(), type.name(), protocols, poolsToMatchWithVpool, _newPoolList, _updatePoolList);
            } catch (Exception e) {
                _logger.warn("StoragePool Discovery failed for {}", getCIMPropertyValue(poolInstance, Constants.INSTANCEID), getMessage(e));
            }
        }
        // set the pools whose properties got changed.
        keyMap.put(Constants.MODIFIED_STORAGEPOOLS, poolsToMatchWithVpool);
        _dbClient.createObject(_newPoolList);
        _dbClient.updateAndReindexObject(_updatePoolList);
        // find the pools not visible in this discovery
        List<StoragePool> discoveredPools = new ArrayList<StoragePool>(_newPoolList);
        discoveredPools.addAll(_updatePoolList);
        List<StoragePool> notVisiblePools = DiscoveryUtils.checkStoragePoolsNotVisible(discoveredPools, _dbClient, device.getId());
        for (StoragePool notVisiblePool : notVisiblePools) {
            poolsToMatchWithVpool.put(notVisiblePool.getId(), notVisiblePool);
        }
        // If any storage ports on the storage system are in a transport
        // zone, there is an implicit connection to the transport zone
        // varray. We need to add these implicit varray
        // connections for the new storage pool.
        StoragePoolAssociationHelper.setStoragePoolVarrays(device.getId(), _newPoolList, _dbClient);
    } catch (Exception e) {
        _logger.error("StoragePool Discovery failed", e);
    } finally {
        _newPoolList = null;
        _updatePoolList = null;
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) SupportedResourceTypes(com.emc.storageos.db.client.model.StoragePool.SupportedResourceTypes) ArrayList(java.util.ArrayList) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 65 with CIMInstance

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

the class XIVStoragePortProcessor method processResult.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        _profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        Set<String> protocols = (Set<String>) keyMap.get(Constants.PROTOCOLS);
        _newPortList = new ArrayList<StoragePort>();
        _updatePortList = new ArrayList<StoragePort>();
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
        StorageSystem device = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId());
        while (it.hasNext()) {
            CIMInstance portInstance = null;
            StoragePort port = null;
            try {
                portInstance = it.next();
                String protocol = getCIMPropertyValue(portInstance, LINKTECHNOLOGY);
                String className = portInstance.getClassName();
                // FC Port - 4
                if ("4".equals(protocol)) {
                    port = checkStoragePortExistsInDB(portInstance, device, _dbClient);
                    checkProtocolAlreadyExists(protocols, FC);
                    createStoragePort(port, portInstance, _profile, true, FC, device);
                } else if (IPPORT_CLASS_NAME.equals(className)) {
                    port = createStoragePort(null, portInstance, _profile, false, IP, device);
                    checkProtocolAlreadyExists(protocols, ISCSI);
                    keyMap.put(portInstance.getObjectPath().toString(), port);
                    addPath(keyMap, operation.getResult(), portInstance.getObjectPath());
                } else {
                    _logger.debug("Unsupported Port : {}", getCIMPropertyValue(portInstance, DEVICEID));
                }
            } catch (Exception e) {
                _logger.warn("Port Discovery failed for {}", getCIMPropertyValue(portInstance, DEVICEID), e);
            }
        }
        _dbClient.createObject(_newPortList);
        _dbClient.persistObject(_updatePortList);
        // ports used later to run Transport Zone connectivity
        List<List<StoragePort>> portsUsedToRunTZoneConnectivity = (List<List<StoragePort>>) keyMap.get(Constants.STORAGE_PORTS);
        portsUsedToRunTZoneConnectivity.add(_newPortList);
        portsUsedToRunTZoneConnectivity.add(_updatePortList);
        List<StoragePool> modifiedPools = StoragePoolAssociationHelper.getStoragePoolsFromPorts(_dbClient, _newPortList, _updatePortList);
        for (StoragePool pool : modifiedPools) {
            // pool matcher will be invoked on this pool
            if (!poolsToMatchWithVpool.containsKey(pool.getId())) {
                poolsToMatchWithVpool.put(pool.getId(), pool);
            }
        }
        _logger.debug("# Pools used in invoking PoolMatcher during StoragePortProcessor {}", Joiner.on("\t").join(poolsToMatchWithVpool.keySet()));
        // discovered ports used later to check for not visible ports
        List<StoragePort> discoveredPorts = (List<StoragePort>) keyMap.get(Constants.DISCOVERED_PORTS);
        discoveredPorts.addAll(_newPortList);
        discoveredPorts.addAll(_updatePortList);
        // if the port's end point is in a transport zone, associate the the
        // port to the
        // transport zone. Also update the storage pools and varray
        // association if needed.
        StoragePortAssociationHelper.updatePortAssociations(_newPortList, _dbClient);
        StoragePortAssociationHelper.updatePortAssociations(_updatePortList, _dbClient);
    } catch (Exception e) {
        _logger.error("Port Discovery failed -->{}", getMessage(e));
    } finally {
        _newPortList = null;
        _updatePortList = null;
    }
}
Also used : Set(java.util.Set) StoragePool(com.emc.storageos.db.client.model.StoragePool) StoragePort(com.emc.storageos.db.client.model.StoragePort) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

CIMInstance (javax.cim.CIMInstance)370 CIMObjectPath (javax.cim.CIMObjectPath)254 WBEMException (javax.wbem.WBEMException)139 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)104 ArrayList (java.util.ArrayList)98 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)79 URI (java.net.URI)79 CIMArgument (javax.cim.CIMArgument)71 WBEMClient (javax.wbem.client.WBEMClient)69 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)62 Volume (com.emc.storageos.db.client.model.Volume)62 HashSet (java.util.HashSet)60 IOException (java.io.IOException)53 HashMap (java.util.HashMap)52 Iterator (java.util.Iterator)50 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)48 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)48 CIMProperty (javax.cim.CIMProperty)37 StringSet (com.emc.storageos.db.client.model.StringSet)31 SmisException (com.emc.storageos.volumecontroller.impl.smis.SmisException)29