Search in sources :

Example 36 with StorageProvider

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

the class SmisStorageDevice method checkIfProviderSupportsAliasOperations.

/**
 * This method return true if the SMI-S provider supports initiator alias operations.
 * If not, it will throw an exception
 *
 * @param storage
 *            - StorageSystem object
 * @throws Exception
 */
private void checkIfProviderSupportsAliasOperations(StorageSystem storageSystem) throws Exception {
    String providerVersion = null;
    if (storageSystem.checkIfVmax3() && storageSystem.getUsingSmis80()) {
        StorageProvider storageProvider = _dbClient.queryObject(StorageProvider.class, storageSystem.getActiveProviderURI());
        providerVersion = storageProvider.getVersionString();
    }
    if (VersionChecker.verifyVersionDetailsPostTrim(SmisConstants.SMIS_PROVIDER_VERSION_8_2, providerVersion) < 0) {
        String errMsg = String.format("SMI-S Provider associated with Storage System %s does not support Initiator Alias operations", storageSystem.getSerialNumber());
        _log.error(errMsg);
        throw DeviceControllerException.exceptions.couldNotPerformAliasOperation(errMsg);
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider)

Example 37 with StorageProvider

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

the class DbSMISProviderToStorageProviderMigrationTest method validateStorageProviderInstances.

private void validateStorageProviderInstances(boolean isAfterMigration) {
    int size = 0;
    List<URI> keys = _dbClient.queryByType(StorageProvider.class, true);
    Iterator<StorageProvider> iter = _dbClient.queryIterativeObjects(StorageProvider.class, keys);
    while (iter.hasNext()) {
        size++;
        StorageProvider storageProvider = iter.next();
        if (StorageProvider.InterfaceType.vplex.name().equals(storageProvider.getInterfaceType())) {
            verifyVPlexStorageProvider(storageProvider);
        } else {
            Assert.assertEquals("Interface type should be smis", StorageProvider.InterfaceType.smis.name(), storageProvider.getInterfaceType());
            StringSet storageSystems = storageProvider.getStorageSystems();
            int storageSystemCount = 0;
            for (String storageSystemURI : storageSystems) {
                storageSystemCount++;
            }
            if (isAfterMigration) {
                if ("smis1".equals(storageProvider.getLabel())) {
                    Assert.assertEquals("StorageSystems count is mismatch for " + storageProvider.getLabel(), 2, storageSystemCount);
                } else if ("smis3".equals(storageProvider.getLabel()) || "smis2".equals(storageProvider.getLabel())) {
                    Assert.assertEquals("StorageSystems count is mismatch for " + storageProvider.getLabel(), 1, storageSystemCount);
                }
            }
        }
    }
    if (isAfterMigration) {
        Assert.assertEquals("StorageProvider size should be 4", 4, size);
    } else {
        Assert.assertEquals("StorageProvider size should be 0", 0, size);
    }
}
Also used : StringSet(com.emc.storageos.db.client.model.StringSet) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI)

Example 38 with StorageProvider

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

the class TestDataCollectionJobConsumer method triggerScanning.

private void triggerScanning(DataCollectionScanJob job) throws Exception {
    _logger.info("Started scanning SMIS Providers : triggerScanning()");
    List<URI> allProviderURI = _dbClient.queryByType(StorageProvider.class, true);
    List<StorageProvider> allProviders = _dbClient.queryObject(StorageProvider.class, allProviderURI);
    Map<String, StorageSystemViewObject> storageSystemsCache = Collections.synchronizedMap(new HashMap<String, StorageSystemViewObject>());
    boolean exceptionIntercepted = false;
    try {
        List<URI> cacheProviders = new ArrayList<URI>();
        // since dbQuery does not return a normal list required by
        // bookkeeping, we need to rebuild it.
        allProviderURI = new ArrayList<URI>();
        // at the same time.
        for (StorageProvider provider : allProviders) {
            allProviderURI.add(provider.getId());
            ScanTaskCompleter scanCompleter = job.findProviderTaskCompleter(provider.getId());
            if (scanCompleter == null) {
                String taskId = UUID.randomUUID().toString();
                scanCompleter = new ScanTaskCompleter(StorageProvider.class, provider.getId(), taskId);
                job.addCompleter(scanCompleter);
            }
            try {
                provider.setLastScanStatusMessage("");
                _dbClient.persistObject(provider);
                _logger.info("provider.getInterfaceType():{}", provider.getInterfaceType());
                performScan(provider.getId(), scanCompleter, storageSystemsCache);
                cacheProviders.add(provider.getId());
            } catch (Exception ex) {
                _logger.error("Scan failed for {}--->", provider.getId(), ex);
            }
            _dbClient.persistObject(provider);
        }
        // Perform BooKKeeping
        // TODO: we need to access the status of job completer.
        // for now we assume that this operation can not fail.
        _util.performBookKeeping(storageSystemsCache, allProviderURI);
        for (URI provider : cacheProviders) {
            job.findProviderTaskCompleter(provider).ready(_dbClient);
            _logger.info("Scan complete successfully for " + provider);
        }
    } catch (final Exception ex) {
        _logger.error("Scan failed for {} ", ex.getMessage());
        job.error(_dbClient, DeviceControllerErrors.dataCollectionErrors.scanFailed(ex.getLocalizedMessage(), ex));
        exceptionIntercepted = true;
        throw ex;
    } finally {
        try {
            if (!exceptionIntercepted && job.isSchedulerJob()) {
                // Manually trigger discoveries, if any new Arrays detected
                triggerDiscoveryNew(storageSystemsCache, DataCollectionJob.JobOrigin.SCHEDULER);
            }
        } catch (Exception ex) {
            _logger.error(ex.getMessage(), ex);
        }
    }
}
Also used : StorageSystemViewObject(com.emc.storageos.plugins.StorageSystemViewObject) ArrayList(java.util.ArrayList) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) ControllerException(com.emc.storageos.volumecontroller.ControllerException)

Example 39 with StorageProvider

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

the class SmisCommandHelper method checkIfProviderSupportsCompressionOperations.

/**
 * This method return true if the SMI-S provider supports compression operations.
 * If not, it will throw an exception
 *
 * @param storage - StorageSystem object
 * @param boolean to report if SMI-S provider supports compression
 */
public Boolean checkIfProviderSupportsCompressionOperations(StorageSystem storageSystem) {
    if (storageSystem.checkIfVmax3() && storageSystem.getUsingSmis80()) {
        try {
            StorageProvider storageProvider = _dbClient.queryObject(StorageProvider.class, storageSystem.getActiveProviderURI());
            String providerVersion = storageProvider.getVersionString();
            if (VersionChecker.verifyVersionDetailsPostTrim(SMIS_PROVIDER_VERSION_8_3, providerVersion) < 0) {
                String errMsg = String.format("SMI-S Provider associated with Storage System %s does not support compression operations", storageSystem.getSerialNumber());
                _log.error(errMsg);
                return false;
            }
        } catch (Exception e) {
            _log.error("Exception get provider version for the storage system {} {}.", storageSystem.getLabel(), storageSystem.getId());
            return false;
        }
    }
    return true;
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider) IOException(java.io.IOException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException) WBEMException(javax.wbem.WBEMException) ServiceCodeException(com.emc.storageos.svcs.errorhandling.resources.ServiceCodeException)

Example 40 with StorageProvider

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

the class SmisCommandHelper method convertStandAloneStorageGroupToCascaded.

/**
 * Converts a stand alone storage group in the masking view to cascaded.
 * This method is supported from SMI-S v8.4
 *
 * @param storage the storage system
 * @param storageGroupPath the storage group path
 * @param storageGroupName the storage group name
 * @throws WBEMException the WBEM exception
 */
public void convertStandAloneStorageGroupToCascaded(StorageSystem storage, CIMObjectPath storageGroupPath, String storageGroupName) throws WBEMException {
    // This method is supported from SMI-S v8.4
    StorageProvider storageProvider = _dbClient.queryObject(StorageProvider.class, storage.getActiveProviderURI());
    String providerVersion = storageProvider.getVersionString();
    if (VersionChecker.verifyVersionDetailsPostTrim(SMIS_PROVIDER_VERSION_8_4, providerVersion) >= 0) {
        String ChildStorageGroupName = String.format("%s_ChildSG", storageGroupName);
        CIMArgument[] inArgs = getConvertStandAloneStorageGroupToCascadedInputArguments(storage, storageGroupPath, ChildStorageGroupName);
        CIMArgument[] outArgs = new CIMArgument[5];
        invokeMethod(storage, _cimPath.getControllerConfigSvcPath(storage), "EMCConvertMaskingGroup", inArgs, outArgs);
    } else {
        _log.info("SMI-S Provider version {} does not support converting" + " Stand alone storage group to Cascaded.", providerVersion);
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider) CIMArgument(javax.cim.CIMArgument)

Aggregations

StorageProvider (com.emc.storageos.db.client.model.StorageProvider)97 URI (java.net.URI)44 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)26 ArrayList (java.util.ArrayList)24 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)23 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)19 Produces (javax.ws.rs.Produces)19 IOException (java.io.IOException)18 StringSet (com.emc.storageos.db.client.model.StringSet)17 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)15 Path (javax.ws.rs.Path)15 Consumes (javax.ws.rs.Consumes)11 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)10 MapStorageProvider (com.emc.storageos.api.mapper.functions.MapStorageProvider)8 StorageSystemViewObject (com.emc.storageos.plugins.StorageSystemViewObject)8 GET (javax.ws.rs.GET)8 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)7 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)7 AsyncTask (com.emc.storageos.volumecontroller.AsyncTask)7 BlockController (com.emc.storageos.volumecontroller.BlockController)7