Search in sources :

Example 21 with CIMInstance

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

the class AllocatedFromStoragePoolProcessor method processInstances.

/**
 * {@inheritDoc}
 */
@Override
protected int processInstances(Iterator<CIMInstance> instances, WBEMClient client) {
    int count = 0;
    while (instances.hasNext()) {
        try {
            count++;
            CIMInstance instance = instances.next();
            CIMObjectPath volPath = (CIMObjectPath) instance.getObjectPath().getKeyValue(DEPENDENT);
            if (_symmvolume.equals(volPath.getObjectName())) {
                String spaceConsumed = getCIMPropertyValue(instance, SPACE_CONSUMED);
                _volumeToSpaceConsumedMap.put(volPath.toString(), spaceConsumed);
            }
        } catch (Exception e) {
            _logger.error("Exception on processing instances", e);
        }
    }
    return count;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 22 with CIMInstance

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

the class FirmwareProcessor method processResult.

/**
 * {@inheritDoc}
 */
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        String serialNumber = null;
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        coordinator = (CoordinatorClient) keyMap.get(Constants.COORDINATOR_CLIENT);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        String delimiter = Constants.PATH_DELIMITER_REGEX;
        if (Type.ibmxiv.name().equals(profile.getSystemType())) {
            delimiter = Pattern.quote(Constants.COLON);
        }
        if (it.hasNext()) {
            // e.g., IBM XIV InstanceID, IBMTSDS:IBM.2810-7825363
            CIMInstance firmwareInstance = it.next();
            serialNumber = firmwareInstance.getPropertyValue(INSTANCEID).toString().split(delimiter)[1];
            String nativeGuid = NativeGUIDGenerator.generateNativeGuid(profile.getSystemType(), serialNumber);
            List<StorageSystem> systems = CustomQueryUtility.getActiveStorageSystemByNativeGuid(_dbClient, nativeGuid);
            if (!systems.isEmpty()) {
                StorageSystem system = systems.get(0);
                checkFirmwareVersion(firmwareInstance, system);
            }
        } else {
            String errMsg = String.format("No information obtained from Provider %s for Firmware version", profile.getIpAddress());
            throw new SMIPluginException(errMsg, SMIPluginException.ERRORCODE_OPERATIONFAILED);
        }
    } catch (SMIPluginException e) {
        throw e;
    } catch (Exception e) {
        String errMsg = String.format("An error occurred while verifying Firmware version: %s", e.getMessage());
        throw new SMIPluginException(SMIPluginException.ERRORCODE_OPERATIONFAILED, e, errMsg);
    }
}
Also used : Iterator(java.util.Iterator) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) SMIPluginException(com.emc.storageos.plugins.metering.smis.SMIPluginException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 23 with CIMInstance

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

the class LunMaskingProcessor method addIoLimitsOnVolume.

/**
 * Add IO limits on volume based on SG they belong to.
 *
 * Also sets the SLO name in which the SG is configured.
 *
 * @param client
 * @param path
 * @param volToIolimits
 * @param parentHostIoBw
 * @param parentHostIoPs
 */
private void addIoLimitsOnVolume(WBEMClient client, CIMObjectPath path, Map<String, VolHostIOObject> volToIolimits, Map<String, String> volToFastPolicy, String parentHostIoBw, String parentHostIoPs) {
    try {
        CIMInstance instance = client.getInstance(path, false, true, SmisConstants.PS_HOST_IO);
        String hostIoBw = String.valueOf(instance.getPropertyValue(SmisConstants.EMC_MAX_BANDWIDTH));
        String hostIoPs = String.valueOf(instance.getPropertyValue(SmisConstants.EMC_MAX_IO));
        String fastSetting = SmisUtils.getSLOPolicyName(instance);
        _logger.info("Bw {} and Iops {} found for SG : {} ", new Object[] { hostIoBw, hostIoPs, String.valueOf(instance.getPropertyValue(Constants.ELEMENTNAME)) });
        if (hostIoBw.equals("0") && hostIoPs.equals("0")) {
            hostIoBw = parentHostIoBw;
            hostIoPs = parentHostIoPs;
        }
        CloseableIterator<CIMObjectPath> volPaths = client.associatorNames(path, null, Constants.STORAGE_VOLUME, null, null);
        while (volPaths.hasNext()) {
            CIMObjectPath volPath = volPaths.next();
            String volumeNativeGuid = getVolumeNativeGuid(volPath);
            VolHostIOObject obj = new VolHostIOObject();
            obj.setVolNativeGuid(volumeNativeGuid);
            obj.setHostIoBw(hostIoBw);
            obj.setHostIops(hostIoPs);
            _logger.debug("Volume key: {}..obj : {}", volumeNativeGuid, obj.toString());
            volToIolimits.put(volumeNativeGuid, obj);
            if (!Strings.isNullOrEmpty(fastSetting)) {
                volToFastPolicy.put(volumeNativeGuid, fastSetting);
            }
        }
    } catch (Exception e) {
        _logger.warn("Finding HostIO limits failed during unmanaged volume discovery", e);
    }
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) VolHostIOObject(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.detailedDiscovery.VolHostIOObject) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 24 with CIMInstance

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

the class PoolCapabilitiesProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
        while (it.hasNext()) {
            CIMInstance capabilitiesInstance = null;
            try {
                capabilitiesInstance = it.next();
                String instanceID = capabilitiesInstance.getPropertyValue(Constants.INSTANCEID).toString();
                if (DiscoveredDataObject.Type.vnxblock.toString().equalsIgnoreCase(device.getSystemType())) {
                    insertExpectedPoolSettingsPerTier(capabilitiesInstance.getObjectPath(), keyMap);
                    addPath(keyMap, Constants.VNXPOOLCAPABILITIES, capabilitiesInstance.getObjectPath());
                }
                addPath(keyMap, operation.getResult(), capabilitiesInstance.getObjectPath());
            } catch (Exception e) {
                _logger.warn("Pool Capabilities Discovery failed for {}-->{}", capabilitiesInstance.getObjectPath(), getMessage(e));
            }
        }
    } catch (Exception e) {
        _logger.error("Pool Capabilities Discovery failed -->{}", getMessage(e));
    }
}
Also used : Iterator(java.util.Iterator) AccessProfile(com.emc.storageos.plugins.AccessProfile) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 25 with CIMInstance

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

the class ProfileProcessor method isRegisteredProfileValid.

/**
 * is Registered Profile Valid.
 *
 * @param profileinstances
 * @return
 */
private CIMInstance isRegisteredProfileValid(Iterator<CIMInstance> profileinstances) {
    CIMInstance profileInstance = null;
    while (profileinstances.hasNext()) {
        profileInstance = profileinstances.next();
        String registeredName = getCIMPropertyValue(profileInstance, REGISTEREDNAME);
        String registeredVersion = getCIMPropertyValue(profileInstance, REGISTEREDVERSION);
        String registeredOrganization = getCIMPropertyValue(profileInstance, REGISTEREDORGANIZATION);
        if (registeredName.contains(ARRAY) && registeredOrganization.equalsIgnoreCase(ELEVEN)) {
            if (highestVersion.isEmpty()) {
                highestVersionRegProfile = profileInstance;
                highestVersion = registeredVersion;
            } else if (compareVersions(registeredVersion, highestVersion) > 0) {
                highestVersionRegProfile = profileInstance;
                highestVersion = registeredVersion;
            }
        }
    }
    return highestVersionRegProfile;
}
Also used : CIMInstance(javax.cim.CIMInstance)

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