Search in sources :

Example 21 with UnsignedInteger16

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

the class SmisStorageDevice method doesStorageSystemSupportVolumeExpand.

/**
 * This method tests if the array represented by 'storageSystem' supports volume expand.
 *
 * @param storageSystem
 *            [IN] - StorageSystem object to check the volume expand capabilities
 * @return true iff The array indicates that it supports volume expand.
 */
private boolean doesStorageSystemSupportVolumeExpand(StorageSystem storageSystem) throws WBEMException {
    boolean expandSupported = false;
    CloseableIterator<CIMInstance> cimInstances = null;
    CIMObjectPath storageConfigServicePath = _cimPath.getConfigSvcPath(storageSystem);
    try {
        cimInstances = _helper.getAssociatorInstances(storageSystem, storageConfigServicePath, null, SmisConstants.EMC_STORAGE_CONFIGURATION_CAPABILITIES, null, null, SmisConstants.PS_SUPPORTED_STORAGE_ELEMENT_FEATURES);
        if (cimInstances != null) {
            while (cimInstances.hasNext()) {
                CIMInstance capabilitiesInstance = cimInstances.next();
                UnsignedInteger16[] supportedFeatures = (UnsignedInteger16[]) capabilitiesInstance.getPropertyValue(SmisConstants.CP_SUPPORTED_STORAGE_ELEMENT_FEATURES);
                for (UnsignedInteger16 supportedFeatureEntry : supportedFeatures) {
                    if (supportedFeatureEntry.intValue() == SmisConstants.STORAGE_ELEMENT_CAPACITY_EXPANSION_VALUE) {
                        expandSupported = true;
                        return true;
                    }
                }
            }
        }
    } finally {
        if (cimInstances != null) {
            cimInstances.close();
        }
        _log.info(String.format("StorageSystem %s %s volume expand", storageSystem.getNativeGuid(), (expandSupported) ? "supports" : "does not support"));
    }
    return false;
}
Also used : CIMObjectPath(javax.cim.CIMObjectPath) CIMInstance(javax.cim.CIMInstance) UnsignedInteger16(javax.cim.UnsignedInteger16)

Example 22 with UnsignedInteger16

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

the class SmisAbstractCreateVolumeJob method processVolume.

/**
 * Processes a newly created volume.
 *
 * @param jobContext The job context.
 * @param volumePath The CIM object path for the volume.
 * @param nativeID The native volume identifier.
 * @param volumeId The Bourne volume id.
 * @param client The CIM client.
 * @param dbClient the database client.
 * @param logMsgBuilder Holds a log message.
 * @param creationTime Holds the date-time for the volume creation
 * @throws java.io.IOException When an error occurs querying the database.
 * @throws WorkflowException
 */
private void processVolume(JobContext jobContext, CIMObjectPath volumePath, String nativeID, URI volumeId, WBEMClient client, DbClient dbClient, StringBuilder logMsgBuilder, Calendar creationTime) throws Exception, IOException, DeviceControllerException, WBEMException {
    Volume volume = dbClient.queryObject(Volume.class, volumeId);
    // Honor that the job failed and do not commit the volume, which would make it active again.
    if (volume.getInactive()) {
        if (logMsgBuilder.length() != 0) {
            logMsgBuilder.append("\n");
        }
        logMsgBuilder.append(String.format("Create volume job failed and volume set to inactive. Volume was likely created successfully and will be left on the array for ingestion. NativeId: %s, URI: %s", nativeID, getTaskCompleter().getId()));
        return;
    }
    CIMInstance volumeInstance = commonVolumeUpdate(dbClient, client, volume, volumePath);
    URI storageSystemURI = volume.getStorageController();
    StorageSystem storageSystem = dbClient.queryObject(StorageSystem.class, storageSystemURI);
    if (volume.getIsComposite() && _cimPath != null) {
        // need to set meta volume member size (required for volume expansion).
        // this call is context dependent --- this is why we check for cimPath be set.
        // first, get meta members list;
        // second, get second member and get its size (the first member is a head and it will show size of meta
        // volume itself);
        // third, set this size as meta volume size in vipr volume
        ArrayList<CIMArgument> list = new ArrayList<CIMArgument>();
        CIMArgument<CIMObjectPath> volumeReference = new CIMArgument<CIMObjectPath>(SmisConstants.CP_THE_ELEMENT, CIMDataType.getDataType(volumePath), volumePath);
        // set request type to "children"
        CIMArgument<UnsignedInteger16> requestType = new CIMArgument<UnsignedInteger16>("RequestType", CIMDataType.UINT16_T, new UnsignedInteger16(2));
        list.add(volumeReference);
        list.add(requestType);
        CIMArgument[] inArgs = {};
        inArgs = list.toArray(inArgs);
        CIMArgument[] outArgs = new CIMArgument[5];
        CIMObjectPath elementCompositionServicePath = _cimPath.getElementCompositionSvcPath(storageSystem);
        SmisCommandHelper helper = jobContext.getSmisCommandHelper();
        StorageSystem forProvider = helper.getStorageSystemForProvider(storageSystem, volume);
        helper.invokeMethod(forProvider, elementCompositionServicePath, "GetCompositeElements", inArgs, outArgs);
        // get member volumes from output
        CIMObjectPath[] metaMembersPaths = (CIMObjectPath[]) _cimPath.getFromOutputArgs(outArgs, "OutElements");
        // get meta member size. use second member --- the first member will show size of meta volume itself.
        CIMObjectPath metaMemberPath = metaMembersPaths[1];
        CIMInstance cimVolume = helper.getInstance(forProvider, metaMemberPath, false, false, new String[] { SmisConstants.CP_CONSUMABLE_BLOCKS, SmisConstants.CP_BLOCK_SIZE });
        CIMProperty consumableBlocks = cimVolume.getProperty(SmisConstants.CP_CONSUMABLE_BLOCKS);
        CIMProperty blockSize = cimVolume.getProperty(SmisConstants.CP_BLOCK_SIZE);
        // calculate size = consumableBlocks * block size
        Long size = Long.valueOf(consumableBlocks.getValue().toString()) * Long.valueOf(blockSize.getValue().toString());
        // set member size for meta volume (required for volume expansion)
        volume.setMetaMemberSize(size);
        _log.info(String.format("Meta member info: blocks --- %s, block size --- %s, size --- %s .", consumableBlocks.getValue().toString(), blockSize.getValue().toString(), size));
    }
    specificProcessing(storageSystem, dbClient, client, volume, volumeInstance, volumePath);
    dbClient.updateObject(volume);
    if (logMsgBuilder.length() != 0) {
        logMsgBuilder.append("\n");
    }
    logMsgBuilder.append(String.format("Created volume successfully .. NativeId: %s, URI: %s", nativeID, getTaskCompleter().getId()));
}
Also used : ArrayList(java.util.ArrayList) CIMObjectPath(javax.cim.CIMObjectPath) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) UnsignedInteger16(javax.cim.UnsignedInteger16) Volume(com.emc.storageos.db.client.model.Volume) CIMProperty(javax.cim.CIMProperty) SmisCommandHelper(com.emc.storageos.volumecontroller.impl.smis.SmisCommandHelper) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) CIMArgument(javax.cim.CIMArgument)

Example 23 with UnsignedInteger16

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

the class StoragePortProcessor method createStoragePort.

/**
 * create StoragePort Record, if not present already, else update only the properties.
 *
 * @param port
 * @param portInstance
 * @throws URISyntaxException
 * @throws IOException
 */
private StoragePort createStoragePort(StoragePort port, CIMInstance portInstance, AccessProfile profile, StorageHADomain haDomain, boolean flag, String transportType, StorageSystem device) throws URISyntaxException, IOException {
    boolean newPort = false;
    if (null == port) {
        newPort = true;
        port = new StoragePort();
        port.setId(URIUtil.createId(StoragePort.class));
        // or ethernet will be updated later in ProtocolEndPoint Processor
        if (flag) {
            port.setPortNetworkId(WWNUtility.getWWNWithColons(getCIMPropertyValue(portInstance, PORTID)));
        }
        port.setStorageDevice(profile.getSystemId());
        String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(_dbClient, port);
        port.setNativeGuid(portNativeGuid);
        port.setLabel(portNativeGuid);
        port.setPortGroup(haDomain.getAdapterName());
        port.setStorageHADomain(haDomain.getId());
    }
    setPortType(port, portInstance);
    port.setTransportType(transportType);
    port.setPortName(getCIMPropertyValue(portInstance, PORTNAME));
    port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
    port.setDiscoveryStatus(DiscoveredDataObject.DiscoveryStatus.VISIBLE.name());
    UnsignedInteger16[] operationalStatusCodes = (UnsignedInteger16[]) portInstance.getPropertyValue(OPERATIONALSTATUS);
    OperationalStatus operationalStatus = getPortOperationalStatus(operationalStatusCodes);
    if (OperationalStatus.NOT_OK.equals(operationalStatus)) {
        _logger.info("StoragePort {} operationalStatus is NOT_OK. operationalStatusCodes collected from SMI-S :{}", port.getId(), operationalStatusCodes);
    } else {
        _logger.debug("operationalStatusCodes :{}", operationalStatusCodes);
        // there can be multiple statuses. {OK, Online}, {OK, Stopped}
        if (operationalStatusCodes != null && operationalStatusCodes.length > 1 && Arrays.asList(operationalStatusCodes).contains(stopped_code)) {
            _logger.info("StoragePort {} operational status is {OK, Stopped}. operationalStatusCodes :{}", port.getId(), operationalStatusCodes);
        }
    }
    port.setOperationalStatus(operationalStatus.name());
    String portSpeed = getCIMPropertyValue(portInstance, SPEED);
    if (null != portSpeed) {
        // SMI returns port speed in bits per sec ?? Is this always true?
        Long portSpeedInBitsPerSec = Long.parseLong(portSpeed);
        Long portSpeedInGbps = portSpeedInBitsPerSec / GB;
        port.setPortSpeed(portSpeedInGbps);
    }
    if (FRONTEND_PORT.equalsIgnoreCase(getCIMPropertyValue(portInstance, USAGERESTRICTION))) {
        setCompatibilityByACLXFlag(device, portInstance, port);
    }
    if (flag) {
        if (newPort) {
            _logger.info("Creating port - {}:{}", port.getLabel(), port.getNativeGuid());
            _newPortList.add(port);
        } else {
            _logger.info("Updating port - {}:{}", port.getLabel(), port.getNativeGuid());
            _updatePortList.add(port);
        }
    }
    ;
    return port;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) OperationalStatus(com.emc.storageos.db.client.model.StoragePort.OperationalStatus) UnsignedInteger16(javax.cim.UnsignedInteger16)

Example 24 with UnsignedInteger16

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

the class SupportedAsynchronousActionsProcessor method addSupportedAsynchronousActionsToStorageSystem.

private void addSupportedAsynchronousActionsToStorageSystem(UnsignedInteger16[] supportedAsyncActions, StorageSystem device) {
    StringSet set = new StringSet();
    if (supportedAsyncActions != null) {
        for (UnsignedInteger16 actionValue : supportedAsyncActions) {
            switch(actionValue.intValue()) {
                case Constants.CREATE_ELEMENT_REPLICA_ASYNC_ACTION:
                    set.add(StorageSystem.AsyncActions.CreateElementReplica.name());
                    break;
                case Constants.CREATE_GROUP_REPLICA_ASYNC_ACTION:
                    set.add(StorageSystem.AsyncActions.CreateGroupReplica.name());
                    break;
                default:
                    _log.warn("Encountered unknown supported asynchronous action {} for StorageSystem {}", actionValue.intValue(), device.getId());
            }
        }
    }
    device.setSupportedAsynchronousActions(set);
    _dbClient.persistObject(device);
}
Also used : StringSet(com.emc.storageos.db.client.model.StringSet) UnsignedInteger16(javax.cim.UnsignedInteger16)

Example 25 with UnsignedInteger16

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

the class SupportedCopyTypesProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    try {
        _dbClient = (DbClient) keyMap.get(Constants.dbClient);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        Map<URI, StoragePool> poolsToMatchWithVpool = (Map<URI, StoragePool>) keyMap.get(Constants.MODIFIED_STORAGEPOOLS);
        StorageSystem device = getStorageSystem(_dbClient, profile.getSystemId());
        boolean isVmax3 = device.checkIfVmax3();
        Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
        while (iterator.hasNext()) {
            CIMInstance instance = iterator.next();
            String instanceID = getCIMPropertyValue(instance, Constants.INSTANCEID);
            String thinProvisionedPreAllocateSupported = Boolean.FALSE.toString();
            if (!isVmax3) {
                thinProvisionedPreAllocateSupported = instance.getPropertyValue(Constants.THIN_PROVISIONED_CLIENT_SETTABLE_RESERVE).toString();
            } else {
                thinProvisionedPreAllocateSupported = Boolean.TRUE.toString();
            }
            UnsignedInteger16[] copyTypes = (UnsignedInteger16[]) instance.getPropertyValue(Constants.SUPPORTED_COPY_TYPES);
            String nativeID = getNativeIDFromInstance(instanceID);
            StoragePool storagePool = checkStoragePoolExistsInDB(nativeID, _dbClient, device);
            if (storagePool == null) {
                _log.warn("No storage pool");
                continue;
            }
            addCopyTypesToStoragePool(copyTypes, storagePool, thinProvisionedPreAllocateSupported, poolsToMatchWithVpool);
        }
    } catch (Exception e) {
        _log.error("Supported copy types processing failed", e);
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) AccessProfile(com.emc.storageos.plugins.AccessProfile) URI(java.net.URI) CIMInstance(javax.cim.CIMInstance) UnsignedInteger16(javax.cim.UnsignedInteger16) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) Iterator(java.util.Iterator) Map(java.util.Map) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

UnsignedInteger16 (javax.cim.UnsignedInteger16)27 CIMInstance (javax.cim.CIMInstance)13 CIMArgument (javax.cim.CIMArgument)10 CIMObjectPath (javax.cim.CIMObjectPath)9 CIMProperty (javax.cim.CIMProperty)8 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)7 ArrayList (java.util.ArrayList)7 WBEMException (javax.wbem.WBEMException)6 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)5 StringSet (com.emc.storageos.db.client.model.StringSet)5 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)5 Iterator (java.util.Iterator)5 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)4 AccessProfile (com.emc.storageos.plugins.AccessProfile)4 URI (java.net.URI)3 BlockObject (com.emc.storageos.db.client.model.BlockObject)2 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)2 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 StoragePort (com.emc.storageos.db.client.model.StoragePort)2 OperationalStatus (com.emc.storageos.db.client.model.StoragePort.OperationalStatus)2