Search in sources :

Example 26 with UnsignedInteger16

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

the class XIVStoragePortProcessor method createStoragePort.

/**
 * create StoragePort Record, if not present already, else update only the
 * properties.
 *
 * @param port
 * @param portInstance
 * @param profile
 * @param isFCPort
 * @param transportType
 * @param device
 *
 * @throws URISyntaxException
 * @throws IOException
 *
 * @return StoragePort
 */
private StoragePort createStoragePort(StoragePort port, CIMInstance portInstance, AccessProfile profile, boolean isFCPort, String transportType, StorageSystem device) throws URISyntaxException, IOException {
    if (null == port) {
        port = new StoragePort();
        port.setId(URIUtil.createId(StoragePort.class));
        // Ethernet will be updated later in ProtocolEndPoint Processor
        if (isFCPort) {
            port.setPortNetworkId(WWNUtility.getWWNWithColons(getCIMPropertyValue(portInstance, PORTID)));
            _newPortList.add(port);
        }
        port.setStorageDevice(profile.getSystemId());
        String portNativeGuid = NativeGUIDGenerator.generateNativeGuid(_dbClient, port);
        port.setNativeGuid(portNativeGuid);
        port.setLabel(portNativeGuid);
    } else {
        if (isFCPort) {
            _updatePortList.add(port);
        }
    }
    setPortType(port, portInstance);
    port.setTransportType(transportType);
    String[] identifiers = getCIMPropertyArrayValue(portInstance, IDENTIFYING_INFO);
    String moduleName = null;
    if (isFCPort) {
        moduleName = identifiers[0];
        String portName = getCIMPropertyValue(portInstance, PORTNAME);
        port.setPortName(portName);
    } else {
        moduleName = identifiers[1];
        port.setPortName(identifiers[1] + ":" + identifiers[0]);
        // port type is not set for ethernet port in SMI
        if (port.getPortType().equals(StoragePort.PortType.Unknown.name())) {
            port.setPortType(StoragePort.PortType.frontend.name());
        }
    }
    port.setPortGroup(moduleName);
    StorageHADomain adapter = getStorageAdapter(moduleName, device);
    port.setStorageHADomain(adapter.getId());
    port.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
    port.setDiscoveryStatus(DiscoveredDataObject.DiscoveryStatus.VISIBLE.name());
    UnsignedInteger16[] operationalStatusCodes = (UnsignedInteger16[]) portInstance.getPropertyValue(OPERATIONALSTATUS);
    OperationalStatus operationalStatus = StoragePortProcessor.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);
    }
    port.setOperationalStatus(operationalStatus.name());
    String portSpeed = getCIMPropertyValue(portInstance, SPEED);
    if (null != portSpeed) {
        // SMI returns port speed in bits per sec
        Long portSpeedInBitsPerSec = Long.parseLong(portSpeed);
        Long portSpeedInGbps = portSpeedInBitsPerSec / GB;
        port.setPortSpeed(portSpeedInGbps);
    }
    return port;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) StorageHADomain(com.emc.storageos.db.client.model.StorageHADomain) OperationalStatus(com.emc.storageos.db.client.model.StoragePort.OperationalStatus) UnsignedInteger16(javax.cim.UnsignedInteger16)

Example 27 with UnsignedInteger16

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

the class XIVSupportedCopyTypesProcessor 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());
        Iterator<CIMInstance> iterator = (Iterator<CIMInstance>) resultObj;
        while (iterator.hasNext()) {
            CIMInstance instance = iterator.next();
            CIMObjectPath poolPath = getObjectPathfromCIMArgument();
            String instanceId = poolPath.getKeyValue(Constants.INSTANCEID).toString();
            // instanceId is the pool's nativeId
            StoragePool storagePool = checkStoragePoolExistsInDB(instanceId, _dbClient, device);
            if (storagePool == null) {
                _log.warn("No storage pool");
                continue;
            }
            String thinProvisionedPreAllocateSupported = instance.getPropertyValue(Constants.THIN_PROVISIONED_CLIENT_SETTABLE_RESERVE).toString();
            UnsignedInteger16[] copyTypes = (UnsignedInteger16[]) instance.getPropertyValue(Constants.SUPPORTED_COPY_TYPES);
            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) CIMObjectPath(javax.cim.CIMObjectPath) 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