Search in sources :

Example 16 with StorageSystemViewObject

use of com.emc.storageos.plugins.StorageSystemViewObject in project coprhd-controller by CoprHD.

the class VPlexCommunicationInterface method scan.

/**
 * Implementation for scan for VPlex storage systems.
 *
 * @param accessProfile
 *
 * @throws BaseCollectionException
 */
@Override
public void scan(AccessProfile accessProfile) throws BaseCollectionException {
    URI mgmntServerURI = accessProfile.getSystemId();
    StorageProvider mgmntServer = null;
    String scanStatusMessage = "Unknown Status";
    VPlexApiClient client = null;
    try {
        // Get the storage provider representing a VPLEX management server.
        mgmntServer = _dbClient.queryObject(StorageProvider.class, mgmntServerURI);
        // Get the Http client for getting information about the VPLEX
        // cluster(s) managed by the VPLEX management server.
        client = getVPlexAPIClient(accessProfile);
        s_logger.debug("Got handle to VPlex API client");
        // Verify the connectivity to the VPLEX management server.
        verifyConnectivity(client, mgmntServer);
        // Verify the VPLEX system firmware version is supported.
        verifyMinimumSupportedFirmwareVersion(client, mgmntServer);
        // Determine the VPLEX system managed by this management server.
        Map<String, StorageSystemViewObject> scanCache = accessProfile.getCache();
        s_logger.info("Storage System scanCache before scanning:" + scanCache);
        scanManagedSystems(client, mgmntServer, scanCache);
        s_logger.info("Storage System scanCache after scanning:" + scanCache);
        scanStatusMessage = String.format("Scan job completed successfully for " + "VPLEX management server: %s", mgmntServerURI.toString());
    } catch (Exception e) {
        if (null != client) {
            // clear cached discovery data in the VPlexApiClient
            client.clearCaches();
        }
        VPlexCollectionException vce = VPlexCollectionException.exceptions.failedScan(mgmntServer.getIPAddress(), e.getLocalizedMessage());
        scanStatusMessage = vce.getLocalizedMessage();
        throw vce;
    } finally {
        if (mgmntServer != null) {
            try {
                mgmntServer.setLastScanStatusMessage(scanStatusMessage);
                _dbClient.updateObject(mgmntServer);
            } catch (Exception e) {
                s_logger.error("Error persisting scan status message for management server {}", mgmntServerURI.toString(), e);
            }
        }
    }
}
Also used : VPlexCollectionException(com.emc.storageos.plugins.metering.vplex.VPlexCollectionException) StorageSystemViewObject(com.emc.storageos.plugins.StorageSystemViewObject) VPlexApiClient(com.emc.storageos.vplex.api.VPlexApiClient) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) URISyntaxException(java.net.URISyntaxException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) VPlexApiException(com.emc.storageos.vplex.api.VPlexApiException) VPlexCollectionException(com.emc.storageos.plugins.metering.vplex.VPlexCollectionException) IOException(java.io.IOException)

Example 17 with StorageSystemViewObject

use of com.emc.storageos.plugins.StorageSystemViewObject in project coprhd-controller by CoprHD.

the class ModelProcessor method processResult.

/**
 * {@inheritDoc}
 */
@SuppressWarnings("unchecked")
@Override
public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException {
    CIMInstance modelInstance = null;
    try {
        final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj;
        Map<String, StorageSystemViewObject> storageSystemsCache = (Map<String, StorageSystemViewObject>) keyMap.get(Constants.SYSTEMCACHE);
        AccessProfile profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE);
        String deviceType = null;
        while (it.hasNext()) {
            modelInstance = it.next();
            String model = modelInstance.getPropertyValue(MODEL).toString();
            // TODO should CIM_Chassis.SerialNumber be used instead of Tag?
            String tag = modelInstance.getPropertyValue(TAG).toString();
            String serialID = null;
            if (isIBMInstance(modelInstance)) {
                String typeDesc = modelInstance.getPropertyValue(TYPE_DESC).toString();
                if (Constants.XIV.equalsIgnoreCase(typeDesc)) {
                    deviceType = DiscoveredDataObject.Type.ibmxiv.name();
                    // e.g., IBM.2810-7825363
                    serialID = tag;
                } else {
                    _logger.warn("Array {} is of model {} ---> not XIV, hence will not be added to ViPR", tag, model);
                    continue;
                }
            } else {
                if (model.toLowerCase().contains(VNX)) {
                    deviceType = VNXBLOCK;
                } else if (model.toLowerCase().contains(VMAX) || model.toLowerCase().contains(POWERMAX) || model.toLowerCase().contains(PMAX)) {
                    deviceType = VMAX;
                } else {
                    _logger.warn("Array {} is of model {} ---> neither VMAX nor VNX, hence will not be added to ViPR", tag, model);
                    continue;
                }
                serialID = tag.split(Constants.PATH_DELIMITER_REGEX)[1];
            }
            keyMap.put(Constants.ARRAYTYPE, deviceType);
            StorageSystemViewObject systemVO = null;
            String nativeGuid = NativeGUIDGenerator.generateNativeGuid(deviceType, serialID);
            if (storageSystemsCache.containsKey(nativeGuid)) {
                systemVO = storageSystemsCache.get(nativeGuid);
            } else {
                systemVO = new StorageSystemViewObject();
            }
            systemVO.setDeviceType(deviceType);
            systemVO.addprovider(profile.getSystemId().toString());
            systemVO.setProperty(StorageSystemViewObject.MODEL, model);
            systemVO.setProperty(StorageSystemViewObject.SERIAL_NUMBER, serialID);
            systemVO.setProperty(StorageSystemViewObject.STORAGE_NAME, nativeGuid);
            storageSystemsCache.put(nativeGuid, systemVO);
        }
        _logger.info("Found {} systems during scanning for ip {}", storageSystemsCache.size(), profile.getIpAddress());
        resultObj = null;
    } catch (Exception e) {
        _logger.error(e.getMessage(), e);
        _logger.error("Model Extraction failed for {}-->{}", modelInstance.getObjectPath(), getMessage(e));
    }
}
Also used : StorageSystemViewObject(com.emc.storageos.plugins.StorageSystemViewObject) Iterator(java.util.Iterator) AccessProfile(com.emc.storageos.plugins.AccessProfile) Map(java.util.Map) CIMInstance(javax.cim.CIMInstance) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException)

Example 18 with StorageSystemViewObject

use of com.emc.storageos.plugins.StorageSystemViewObject in project coprhd-controller by CoprHD.

the class SMICommunicationInterfaceTest method testXIVBlockPlugin.

// Need to start coordinator & DB service, before running this test
@Test
public void testXIVBlockPlugin() {
    StorageProvider provider = createXIVProvider();
    try {
        Map<String, Object> cache = new ConcurrentHashMap<String, Object>();
        Set<String> idset = new HashSet<String>();
        idset.add("SYMMETRIX+000194900404+VOLUME+00000");
        cache.put("000194900404-block-Volumes", idset);
        xiv.injectCache(cache);
        xiv.injectDBClient(_dbClient);
        xiv.injectCoordinatorClient(coordinator);
        // scanTest(_smiplugin);
        AccessProfile profile = populateSMISAccessProfile(provider);
        verifyDB(profile);
        Map<String, StorageSystemViewObject> storageSystemsCache = Collections.synchronizedMap(new HashMap<String, StorageSystemViewObject>());
        profile.setCache(storageSystemsCache);
        xiv.scan(profile);
        DataCollectionJobUtil util = new DataCollectionJobUtil();
        util.setDbClient(_dbClient);
        util.setConfigInfo(configinfo);
        List<URI> providerList = new ArrayList<URI>();
        providerList.add(provider.getId());
        util.performBookKeeping(storageSystemsCache, providerList);
        // provider.getStorageSystems();
        // profile.setSystemId(provider.getSystemId());
        profile.setserialID(profile.getserialID());
        xiv.discover(profile);
    } catch (Exception e) {
        _LOGGER.error(e.getMessage(), e);
    }
}
Also used : StorageSystemViewObject(com.emc.storageos.plugins.StorageSystemViewObject) ArrayList(java.util.ArrayList) AccessProfile(com.emc.storageos.plugins.AccessProfile) DataCollectionJobUtil(com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.DataCollectionJobUtil) URI(java.net.URI) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) StorageSystemViewObject(com.emc.storageos.plugins.StorageSystemViewObject) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

StorageSystemViewObject (com.emc.storageos.plugins.StorageSystemViewObject)18 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)13 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)8 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)8 IOException (java.io.IOException)6 URI (java.net.URI)6 ArrayList (java.util.ArrayList)6 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)3 VPlexCollectionException (com.emc.storageos.plugins.metering.vplex.VPlexCollectionException)3 VPlexApiException (com.emc.storageos.vplex.api.VPlexApiException)3 URISyntaxException (java.net.URISyntaxException)3 HashMap (java.util.HashMap)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 AccessProfile (com.emc.storageos.plugins.AccessProfile)2 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 CephClient (com.emc.storageos.ceph.CephClient)1 CephException (com.emc.storageos.ceph.CephException)1 ClusterInfo (com.emc.storageos.ceph.model.ClusterInfo)1 DataDomainClient (com.emc.storageos.datadomain.restapi.DataDomainClient)1