Search in sources :

Example 71 with StorageProvider

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

the class DataCollectionJobUtil method getSMISProvidersWithUpdatedSystems.

/**
 * Update all the SMISProviders with their actively managed storage systems information.
 *
 * @param providersToUpdate : dataStructure holds the provider => list of managed systems.
 */
private List<StorageProvider> getSMISProvidersWithUpdatedSystems(Map<URI, List<String>> providersToUpdate) {
    List<StorageProvider> providerList = new ArrayList<StorageProvider>();
    if (!providersToUpdate.isEmpty()) {
        Iterator<URI> providerIdKeyItr = providersToUpdate.keySet().iterator();
        while (providerIdKeyItr.hasNext()) {
            URI providerIdKey = null;
            try {
                providerIdKey = providerIdKeyItr.next();
                List<String> storageSystemList = providersToUpdate.get(providerIdKey);
                StorageProvider provider = _dbClient.queryObject(StorageProvider.class, providerIdKey);
                if (null != provider.getStorageSystems()) {
                    provider.getStorageSystems().clear();
                    provider.getStorageSystems().addAll(storageSystemList);
                } else {
                    StringSet storageSystems = new StringSet();
                    storageSystems.addAll(storageSystemList);
                    provider.setStorageSystems(storageSystems);
                }
                providerList.add(provider);
            } catch (DatabaseException ioEx) {
                _logger.error("IOException occurred while updating storageSystems for provider {}", providerIdKey);
            }
        }
    }
    return providerList;
}
Also used : ArrayList(java.util.ArrayList) StringSet(com.emc.storageos.db.client.model.StringSet) StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException)

Example 72 with StorageProvider

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

the class DataCollectionJobUtil method populateUnityAccessProfileForSystem.

/**
 * Populate access profile for storage system.
 * If it has active provider, it will populate the access profile from provider info,
 * otherwise, it will populate the access profile from the storage system.
 * @param accessProfile
 * @param storageDevice
 */
private void populateUnityAccessProfileForSystem(AccessProfile accessProfile, StorageSystem storageDevice) {
    URI providerUri = storageDevice.getActiveProviderURI();
    if (!NullColumnValueGetter.isNullURI(providerUri)) {
        StorageProvider provider = _dbClient.queryObject(StorageProvider.class, providerUri);
        accessProfile.setSystemType(storageDevice.getSystemType());
        accessProfile.setIpAddress(provider.getIPAddress());
        accessProfile.setUserName(provider.getUserName());
        accessProfile.setPassword(provider.getPassword());
        accessProfile.setserialID(storageDevice.getSerialNumber());
        accessProfile.setPortNumber(provider.getPortNumber());
        accessProfile.setLastSampleTime(0L);
    } else {
        accessProfile.setSystemType(storageDevice.getSystemType());
        accessProfile.setIpAddress(storageDevice.getIpAddress());
        accessProfile.setUserName(storageDevice.getUsername());
        accessProfile.setPassword(storageDevice.getPassword());
        accessProfile.setserialID(storageDevice.getSerialNumber());
        accessProfile.setPortNumber(storageDevice.getPortNumber());
        accessProfile.setLastSampleTime(0L);
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI)

Example 73 with StorageProvider

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

the class DataCollectionJobUtil method populateHDSAccessProfile.

/**
 * Get the AccessProfile details based on the profile Name.
 * For Hitachi, metering is handled thru SMI-S.
 * Hitachi supports two types of providers
 * 1. Embedded SMI-S running SVP -> supports only HUS VM, VSP, VSP G1000.
 * 2. HiCommand Suite Provider -> supports only AMS series
 *
 * @TODO need to look at HUS series model.
 * @TODO User should create a new user using storage navigator to do metering.
 *
 *       Prerequisites for Embedded SMI-S Provider.
 *       User should enable certificate to activate SMI-S and enable performance monitor using storage navigator.
 *
 * @TODO should we document above prerequisites?
 *
 * @param accessProfile
 * @param storageDevice
 * @param nameSpace
 */
private void populateHDSAccessProfile(AccessProfile accessProfile, StorageSystem storageDevice, String nameSpace) {
    accessProfile.setSystemType(storageDevice.getSystemType());
    accessProfile.setserialID(storageDevice.getSerialNumber());
    accessProfile.setLastSampleTime(0L);
    if (null != nameSpace) {
        accessProfile.setnamespace(nameSpace);
    }
    if (accessProfile.getProfileName().equalsIgnoreCase(ControllerServiceImpl.METERING)) {
        accessProfile.setIpAddress(getHDSSMISIPAddressBasedOnModel(storageDevice));
        accessProfile.setInteropNamespace(HDSConstants.HITACHI_NAMESPACE);
        // Currently API is not supporting hence hardcoded to make them
        // work.
        // @TODO remove once API is fixed.
        accessProfile.setPortNumber(getHDSSMISPortBasedOnModel(storageDevice));
        accessProfile.setSslEnable(Boolean.TRUE.toString());
        accessProfile.setUserName(storageDevice.getSmisUserName());
        accessProfile.setPassword(storageDevice.getSmisPassword());
    } else {
        StorageProvider activeProvider = getActiveProviderForStorageSystem(storageDevice, accessProfile);
        // For discovery use the active provider credentials directly.
        accessProfile.setIpAddress(activeProvider.getIPAddress());
        accessProfile.setPortNumber(activeProvider.getPortNumber());
        accessProfile.setUserName(activeProvider.getUserName());
        accessProfile.setPassword(activeProvider.getPassword());
        accessProfile.setSslEnable(String.valueOf(activeProvider.getUseSSL()));
    }
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider)

Example 74 with StorageProvider

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

the class DataCollectionJobUtil method injectDiscoveryProfile.

/**
 * inject Details needed for Discovery
 *
 * @param accessProfile
 * @param system
 * @throws IOException
 */
private void injectDiscoveryProfile(AccessProfile accessProfile, StorageSystem system) throws DatabaseException, DeviceControllerException {
    StorageProvider provider = getActiveProviderForStorageSystem(system, accessProfile);
    populateSMISAccessProfile(accessProfile, provider);
    accessProfile.setSystemId(system.getId());
    accessProfile.setSystemClazz(system.getClass());
    accessProfile.setserialID(system.getSerialNumber());
    accessProfile.setSystemType(system.getSystemType());
    String namespace = Constants.EMC_NAMESPACE;
    if (Type.ibmxiv.name().equals(system.getSystemType())) {
        namespace = Constants.IBM_NAMESPACE;
    }
    // To-Do: get Namespace field in SMISProvider
    accessProfile.setInteropNamespace(namespace);
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider)

Example 75 with StorageProvider

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

the class DataCollectionJobUtil method getActiveProviderForStorageSystem.

/**
 * Return the active StorageProvider for a given storage system.
 *
 * @param system
 * @param accessProfile
 * @return
 */
private StorageProvider getActiveProviderForStorageSystem(StorageSystem system, AccessProfile accessProfile) {
    URI activeProviderURI = system.getActiveProviderURI();
    if (NullColumnValueGetter.isNullURI(activeProviderURI)) {
        // Set the error message only when the job type is discovery.
        if (ControllerServiceImpl.isDiscoveryJobTypeSupported(accessProfile.getProfileName())) {
            system.setLastDiscoveryStatusMessage("Discovery failed " + "since it does not have an active Provider");
            _dbClient.persistObject(system);
        }
        throw DeviceControllerException.exceptions.cannotFindActiveProviderForStorageSystem();
    }
    StorageProvider provider = _dbClient.queryObject(StorageProvider.class, activeProviderURI);
    if (provider == null) {
        if (ControllerServiceImpl.DISCOVERY.equalsIgnoreCase(accessProfile.getProfileName())) {
            system.setLastDiscoveryStatusMessage("Discovery failed " + "since it does not have a valid active Provider");
            _dbClient.persistObject(system);
        }
        throw DeviceControllerException.exceptions.cannotFindValidActiveProviderForStorageSystem();
    }
    return provider;
}
Also used : StorageProvider(com.emc.storageos.db.client.model.StorageProvider) URI(java.net.URI)

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