Search in sources :

Example 1 with VNXControlStation

use of com.emc.storageos.vnx.xmlapi.VNXControlStation in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method discoverControlStation.

/**
 * Discover the Control Station for the specified VNX File storage array. Since the StorageSystem object
 * currently exists, this method updates information in the object.
 *
 * @param system
 * @throws VNXFileCollectionException
 */
private void discoverControlStation(StorageSystem system) throws VNXFileCollectionException {
    _logger.info("Start Control Station discovery for storage system {}", system.getId());
    VNXControlStation tmpSystem = null;
    try {
        tmpSystem = getControlStation(system);
    } catch (VNXException e) {
        throw new VNXFileCollectionException("Get control station op failed", e);
    }
    if (tmpSystem != null) {
        String sysNativeGuid = NativeGUIDGenerator.generateNativeGuid(DiscoveredDataObject.Type.vnxfile.toString(), tmpSystem.getSerialNumber());
        system.setNativeGuid(sysNativeGuid);
        system.setSerialNumber(tmpSystem.getSerialNumber());
        String firmwareVersion = tmpSystem.getSoftwareVersion();
        String minimumSupportedVersion = VersionChecker.getMinimumSupportedVersion(Type.valueOf(system.getSystemType()));
        // Example version String for VNX looks like 7.1.56-5.
        firmwareVersion = firmwareVersion.replaceAll("-", ".").trim();
        minimumSupportedVersion = minimumSupportedVersion.replaceAll("-", ".");
        system.setFirmwareVersion(firmwareVersion);
        _logger.info("Verifying version details : Minimum Supported Version {} - Discovered VNX Version {}", minimumSupportedVersion, firmwareVersion);
        if (VersionChecker.verifyVersionDetails(minimumSupportedVersion, firmwareVersion) < 0) {
            system.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.INCOMPATIBLE.name());
            system.setReachableStatus(false);
            DiscoveryUtils.setSystemResourcesIncompatible(_dbClient, _coordinator, system.getId());
            VNXFileCollectionException vnxe = new VNXFileCollectionException(String.format(" ** This version of VNX File is not supported ** Should be a minimum of %s", minimumSupportedVersion));
            throw vnxe;
        }
        system.setCompatibilityStatus(DiscoveredDataObject.CompatibilityStatus.COMPATIBLE.name());
        system.setReachableStatus(true);
    } else {
        _logger.error("Failed to retrieve control station info!");
        system.setReachableStatus(false);
    }
    _logger.info("Control Station discovery for storage system {} complete", system.getId());
}
Also used : VNXFileCollectionException(com.emc.storageos.plugins.metering.vnxfile.VNXFileCollectionException) VNXControlStation(com.emc.storageos.vnx.xmlapi.VNXControlStation) VNXException(com.emc.storageos.vnx.xmlapi.VNXException)

Example 2 with VNXControlStation

use of com.emc.storageos.vnx.xmlapi.VNXControlStation in project coprhd-controller by CoprHD.

the class VNXFileCommunicationInterface method getControlStation.

private VNXControlStation getControlStation(final StorageSystem system) throws VNXException {
    VNXControlStation station = null;
    try {
        Map<String, Object> reqAttributeMap = getRequestParamsMap(system);
        _discExecutor.setKeyMap(reqAttributeMap);
        _discExecutor.execute((Namespace) _discNamespaces.getNsList().get("vnxfileControlStation"));
        station = (VNXControlStation) _discExecutor.getKeyMap().get(VNXFileConstants.CONTROL_STATION_INFO);
    } catch (BaseCollectionException e) {
        throw new VNXException("Get control station op failed", e);
    }
    return station;
}
Also used : VNXControlStation(com.emc.storageos.vnx.xmlapi.VNXControlStation) VNXException(com.emc.storageos.vnx.xmlapi.VNXException) DiscoveredDataObject(com.emc.storageos.db.client.model.DiscoveredDataObject) UnManagedDiscoveredObject(com.emc.storageos.db.client.model.UnManagedDiscoveredObject) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 3 with VNXControlStation

use of com.emc.storageos.vnx.xmlapi.VNXControlStation in project coprhd-controller by CoprHD.

the class VNXControlStationProcessor method processResult.

@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    final PostMethod result = (PostMethod) resultObj;
    _logger.info("processing vnx info response" + resultObj);
    try {
        ResponsePacket responsePacket = (ResponsePacket) _unmarshaller.unmarshal(result.getResponseBodyAsStream());
        if (null != responsePacket.getPacketFault()) {
            Status status = responsePacket.getPacketFault();
            processErrorStatus(status, keyMap);
        } else {
            List<Object> queryResponse = getQueryResponse(responsePacket);
            Iterator<Object> queryRespItr = queryResponse.iterator();
            while (queryRespItr.hasNext()) {
                Object responseObj = queryRespItr.next();
                if (responseObj instanceof CelerraSystem) {
                    CelerraSystem system = (CelerraSystem) responseObj;
                    VNXControlStation cs = new VNXControlStation(system.getSerial(), system.getVersion());
                    keyMap.put(VNXFileConstants.CONTROL_STATION_INFO, cs);
                    break;
                }
            }
            // Extract session information from the response header.
            Header[] headers = result.getResponseHeaders(VNXFileConstants.CELERRA_SESSION);
            if (null != headers && headers.length > 0) {
                keyMap.put(VNXFileConstants.CELERRA_SESSION, headers[0].getValue());
                _logger.info("Recieved celerra session information from the Server.");
            }
        }
    } catch (final Exception ex) {
        _logger.error("Exception occurred while processing the vnx info response due to ", ex);
    } finally {
        result.releaseConnection();
    }
}
Also used : Status(com.emc.nas.vnxfile.xmlapi.Status) VNXControlStation(com.emc.storageos.vnx.xmlapi.VNXControlStation) ResponsePacket(com.emc.nas.vnxfile.xmlapi.ResponsePacket) Header(org.apache.commons.httpclient.Header) PostMethod(org.apache.commons.httpclient.methods.PostMethod) CelerraSystem(com.emc.nas.vnxfile.xmlapi.CelerraSystem) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Aggregations

VNXControlStation (com.emc.storageos.vnx.xmlapi.VNXControlStation)3 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)2 VNXException (com.emc.storageos.vnx.xmlapi.VNXException)2 CelerraSystem (com.emc.nas.vnxfile.xmlapi.CelerraSystem)1 ResponsePacket (com.emc.nas.vnxfile.xmlapi.ResponsePacket)1 Status (com.emc.nas.vnxfile.xmlapi.Status)1 DiscoveredDataObject (com.emc.storageos.db.client.model.DiscoveredDataObject)1 UnManagedDiscoveredObject (com.emc.storageos.db.client.model.UnManagedDiscoveredObject)1 VNXFileCollectionException (com.emc.storageos.plugins.metering.vnxfile.VNXFileCollectionException)1 Header (org.apache.commons.httpclient.Header)1 PostMethod (org.apache.commons.httpclient.methods.PostMethod)1