Search in sources :

Example 1 with OperationalStatus

use of com.emc.storageos.db.client.model.StoragePort.OperationalStatus in project coprhd-controller by CoprHD.

the class CIMStoragePortUpdatableDeviceEvent method updateStoragePortOperationalStatus.

/**
 * Updates Port's operational status based on the indication received from SMI-S provider.
 *
 * @return true if success.
 */
public Boolean updateStoragePortOperationalStatus() {
    _logger.info("Updating operationalStatus for the StoragePort initiated");
    boolean updateStatus = false;
    StoragePort storagePort = getStoargePortFromDBBasedOnPortName();
    OperationalStatus operationalStatus = StoragePortProcessor.getPortOperationalStatus(getOperationalStatusCodesArray());
    newOperationalStatus = operationalStatus.name();
    storagePort.setOperationalStatus(newOperationalStatus);
    _dbClient.persistObject(storagePort);
    updateStatus = true;
    _logger.info("Updating operationalStatus for the StoragePort completed status:{}", updateStatus);
    return updateStatus;
}
Also used : StoragePort(com.emc.storageos.db.client.model.StoragePort) OperationalStatus(com.emc.storageos.db.client.model.StoragePort.OperationalStatus)

Example 2 with OperationalStatus

use of com.emc.storageos.db.client.model.StoragePort.OperationalStatus 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 3 with OperationalStatus

use of com.emc.storageos.db.client.model.StoragePort.OperationalStatus 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)

Aggregations

StoragePort (com.emc.storageos.db.client.model.StoragePort)3 OperationalStatus (com.emc.storageos.db.client.model.StoragePort.OperationalStatus)3 UnsignedInteger16 (javax.cim.UnsignedInteger16)2 StorageHADomain (com.emc.storageos.db.client.model.StorageHADomain)1