Search in sources :

Example 46 with VirtualNAS

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

the class IsilonCommunicationInterface method computeStaticLoadMetrics.

private void computeStaticLoadMetrics(final URI storageSystemId) throws BaseCollectionException {
    StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, storageSystemId);
    _log.info("started computeStaticLoadMetrics for storagesystem: {}", storageSystem.getLabel());
    StringMap dbMetrics = null;
    String accessZoneId = null;
    try {
        IsilonApi isilonApi = getIsilonDevice(storageSystem);
        VirtualNAS virtualNAS = null;
        // //step-1 process the dbmetrics for user define access zones
        List<IsilonAccessZone> accessZoneList = isilonApi.getAccessZones(null);
        for (IsilonAccessZone isAccessZone : accessZoneList) {
            accessZoneId = isAccessZone.getZone_id().toString();
            // get the total fs count and capacity for AZ
            if (isAccessZone.isSystem() != true) {
                virtualNAS = findvNasByNativeId(storageSystem, accessZoneId);
                if (virtualNAS != null) {
                    _log.info("Process db metrics for access zone : {}", isAccessZone.getName());
                    dbMetrics = virtualNAS.getMetrics();
                    if (dbMetrics == null) {
                        dbMetrics = new StringMap();
                    }
                    // process db metrics
                    populateDbMetricsAz(isAccessZone, isilonApi, dbMetrics);
                    // set AZ dbMetrics in db
                    virtualNAS.setMetrics(dbMetrics);
                    _dbClient.updateObject(virtualNAS);
                }
            } else {
                PhysicalNAS physicalNAS = findPhysicalNasByNativeId(storageSystem, accessZoneId);
                if (physicalNAS == null) {
                    _log.error(String.format("computeStaticLoadMetrics is failed for  Storagesystemid: %s", storageSystemId));
                    return;
                }
                dbMetrics = physicalNAS.getMetrics();
                if (dbMetrics == null) {
                    dbMetrics = new StringMap();
                }
                /* process the system accesszone dbmetrics */
                _log.info("process db metrics for access zone : {}", isAccessZone.getName());
                populateDbMetricsAz(isAccessZone, isilonApi, dbMetrics);
                physicalNAS.setMetrics(dbMetrics);
                _dbClient.updateObject(physicalNAS);
            }
        }
    } catch (Exception e) {
        _log.error("CollectStatisticsInformation failed. Storage system: " + storageSystemId, e);
    }
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) IsilonAccessZone(com.emc.storageos.isilon.restapi.IsilonAccessZone) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException) URISyntaxException(java.net.URISyntaxException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Example 47 with VirtualNAS

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

the class IsilonCommunicationInterface method discoverAccessZones.

/**
 * discover the access zone and add to vipr db
 *
 * @param storageSystem
 */
private void discoverAccessZones(StorageSystem storageSystem) {
    URI storageSystemId = storageSystem.getId();
    VirtualNAS virtualNAS = null;
    PhysicalNAS physicalNAS = null;
    List<VirtualNAS> newvNASList = new ArrayList<VirtualNAS>();
    List<VirtualNAS> existingvNASList = new ArrayList<VirtualNAS>();
    List<PhysicalNAS> newPhysicalNASList = new ArrayList<PhysicalNAS>();
    List<PhysicalNAS> existingPhysicalNASList = new ArrayList<PhysicalNAS>();
    List<VirtualNAS> discoveredVNASList = new ArrayList<VirtualNAS>();
    // Discover storage ports
    try {
        _log.info("discoverAccessZones for storage system {} - start", storageSystemId);
        IsilonApi isilonApi = getIsilonDevice(storageSystem);
        // Make restapi call to get access zones
        List<IsilonAccessZone> accessZoneList = isilonApi.getAccessZones(null);
        if (accessZoneList == null || accessZoneList.isEmpty()) {
            // No access zones defined. Throw an exception and fail the discovery
            IsilonCollectionException ice = new IsilonCollectionException("discoverAccessZones failed. No Zones defined");
            throw ice;
        }
        // Find the smart connect zones
        List<IsilonNetworkPool> isilonNetworkPoolsSysAZ = new ArrayList<>();
        // get the system access zone and use it later
        List<IsilonNetworkPool> isilonNetworkPoolList = discoverNetworkPools(storageSystem);
        for (IsilonNetworkPool isilonNetworkPool : isilonNetworkPoolList) {
            if (isilonNetworkPool.getAccess_zone().equalsIgnoreCase(SYSTEM_ACCESS_ZONE_NAME)) {
                isilonNetworkPoolsSysAZ.add(isilonNetworkPool);
            }
        }
        // set the protocol based storagesystem version
        // by default all version support CIFS and version above 7.2 NFS also
        StringSet protocols = new StringSet();
        protocols.add(CIFS);
        boolean isNfsV4Enabled = isilonApi.nfsv4Enabled(storageSystem.getFirmwareVersion());
        if (VersionChecker.verifyVersionDetails(ONEFS_V7_2, storageSystem.getFirmwareVersion()) >= 0) {
            protocols.add(NFS);
            if (isNfsV4Enabled) {
                protocols.add(NFSv4);
            }
        }
        List<IsilonNetworkPool> isilonNetworkPools = null;
        // process the access zones list
        for (IsilonAccessZone isilonAccessZone : accessZoneList) {
            // add protocol to NAS servers
            // is it a System access zone?
            isilonNetworkPools = null;
            if (isilonAccessZone.isSystem() == false) {
                _log.info("Process the user defined access zone {} ", isilonAccessZone.toString());
                isilonNetworkPools = new ArrayList<IsilonNetworkPool>();
                // get the smart connect zone information
                for (IsilonNetworkPool eachNetworkPool : isilonNetworkPoolList) {
                    if (eachNetworkPool.getAccess_zone().equalsIgnoreCase(isilonAccessZone.getName())) {
                        isilonNetworkPools.add(eachNetworkPool);
                    }
                }
                // find virtualNAS in db
                virtualNAS = findvNasByNativeId(storageSystem, isilonAccessZone.getZone_id().toString());
                if (virtualNAS == null) {
                    if (isilonNetworkPools != null && !isilonNetworkPools.isEmpty()) {
                        virtualNAS = createVirtualNas(storageSystem, isilonAccessZone);
                        newvNASList.add(virtualNAS);
                    }
                } else {
                    copyUpdatedPropertiesInVNAS(storageSystem, isilonAccessZone, virtualNAS);
                    existingvNASList.add(virtualNAS);
                }
                // Set authentication providers
                setCifsServerMapForNASServer(isilonAccessZone, virtualNAS);
                // set protocol support
                if (virtualNAS != null) {
                    virtualNAS.setProtocols(protocols);
                }
                // set the smart connect
                setStoragePortsForNASServer(isilonNetworkPools, storageSystem, virtualNAS);
            } else {
                _log.info("Process the System access zone {} ", isilonAccessZone.toString());
                // set protocols
                StringSet protocolSet = new StringSet();
                protocolSet.add(CIFS);
                protocolSet.add(NFS);
                if (isNfsV4Enabled) {
                    protocolSet.add(NFSv4);
                }
                physicalNAS = findPhysicalNasByNativeId(storageSystem, isilonAccessZone.getZone_id().toString());
                if (physicalNAS == null) {
                    physicalNAS = createPhysicalNas(storageSystem, isilonAccessZone);
                    physicalNAS.setProtocols(protocolSet);
                    // add system access zone
                    newPhysicalNASList.add(physicalNAS);
                } else {
                    setMaxDbMetricsAz(storageSystem, physicalNAS.getMetrics());
                    existingPhysicalNASList.add(physicalNAS);
                }
                // Set authentication providers
                setCifsServerMapForNASServer(isilonAccessZone, physicalNAS);
                // set the smart connect zone
                setStoragePortsForNASServer(isilonNetworkPoolsSysAZ, storageSystem, physicalNAS);
            }
        }
        // Persist the vNAS servers and
        if (newvNASList != null && !newvNASList.isEmpty()) {
            // add the parent system access zone to user defined access zones
            if (physicalNAS != null) {
                for (VirtualNAS vNas : newvNASList) {
                    // set the parent uri or system access zone uri to vNAS
                    vNas.setParentNasUri(physicalNAS.getId());
                }
            }
            _log.info("New Virtual NAS servers size {}", newvNASList.size());
            _dbClient.createObject(newvNASList);
            discoveredVNASList.addAll(newvNASList);
        }
        if (existingvNASList != null && !existingvNASList.isEmpty()) {
            _log.info("Modified Virtual NAS servers size {}", existingvNASList.size());
            _dbClient.updateObject(existingvNASList);
            discoveredVNASList.addAll(existingvNASList);
        }
        // Persist the NAS servers!!!
        if (existingPhysicalNASList != null && !existingPhysicalNASList.isEmpty()) {
            _log.info("Modified Physical NAS servers size {}", existingPhysicalNASList.size());
            _dbClient.updateObject(existingPhysicalNASList);
        }
        if (newPhysicalNASList != null && !newPhysicalNASList.isEmpty()) {
            _log.info("New Physical NAS servers size {}", newPhysicalNASList.size());
            _dbClient.createObject(newPhysicalNASList);
        }
        DiscoveryUtils.checkVirtualNasNotVisible(discoveredVNASList, _dbClient, storageSystemId);
    } catch (Exception e) {
        _log.error("discoverAccessZones failed. Storage system: {}", storageSystemId, e);
        IsilonCollectionException ice = new IsilonCollectionException("discoverAccessZones failed. Storage system: " + storageSystemId);
        throw ice;
    }
}
Also used : ArrayList(java.util.ArrayList) IsilonAccessZone(com.emc.storageos.isilon.restapi.IsilonAccessZone) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) URI(java.net.URI) IsilonException(com.emc.storageos.isilon.restapi.IsilonException) BaseCollectionException(com.emc.storageos.plugins.BaseCollectionException) IOException(java.io.IOException) JSONException(org.codehaus.jettison.json.JSONException) URISyntaxException(java.net.URISyntaxException) DatabaseException(com.emc.storageos.db.exceptions.DatabaseException) IsilonCollectionException(com.emc.storageos.plugins.metering.isilon.IsilonCollectionException) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) StringSet(com.emc.storageos.db.client.model.StringSet) IsilonNetworkPool(com.emc.storageos.isilon.restapi.IsilonNetworkPool) PhysicalNAS(com.emc.storageos.db.client.model.PhysicalNAS) IsilonApi(com.emc.storageos.isilon.restapi.IsilonApi)

Example 48 with VirtualNAS

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

the class IsilonCommunicationInterface method createVirtualNas.

/**
 * Create Virtual NAS for the specified Isilon cluster storage array
 *
 * @param system
 * @param isiAccessZone
 * @return Virtual NAS Server
 */
private VirtualNAS createVirtualNas(final StorageSystem system, final IsilonAccessZone isiAccessZone) {
    VirtualNAS vNas = new VirtualNAS();
    vNas.setStorageDeviceURI(system.getId());
    // set name
    vNas.setNasName(isiAccessZone.getName());
    vNas.setNativeId(isiAccessZone.getId());
    // set base directory path
    vNas.setBaseDirPath(isiAccessZone.getPath());
    vNas.setNasState(VirtualNasState.LOADED.toString());
    vNas.setId(URIUtil.createId(VirtualNAS.class));
    // set native "Guid"
    String nasNativeGuid = NativeGUIDGenerator.generateNativeGuid(system, isiAccessZone.getZone_id().toString(), NativeGUIDGenerator.VIRTUAL_NAS);
    vNas.setNativeGuid(nasNativeGuid);
    StringMap dbMetrics = vNas.getMetrics();
    _log.info("new Virtual NAS created with guid {} ", vNas.getNativeGuid());
    if (dbMetrics == null) {
        dbMetrics = new StringMap();
    }
    // set the Limitation Metrics keys
    setMaxDbMetricsAz(system, dbMetrics);
    vNas.setMetrics(dbMetrics);
    return vNas;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS)

Example 49 with VirtualNAS

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

the class FileStorageScheduler method getVNASServersInProject.

/**
 * Get list of VNAS servers assigned to a project
 *
 * @param project
 * @param varrayUri
 * @param vpool
 * @return vNASList
 */
private List<VirtualNAS> getVNASServersInProject(Project project, URI varrayUri, VirtualPool vpool, List<VirtualNAS> invalidNasServers) {
    List<VirtualNAS> vNASList = null;
    _log.debug("Get VNAS servers assigned to project {}", project);
    StringSet vNASServerIdSet = project.getAssignedVNasServers();
    if (vNASServerIdSet != null && !vNASServerIdSet.isEmpty()) {
        _log.info("Number of vNAS servers assigned to this project: {}", vNASServerIdSet.size());
        List<URI> vNASURIList = new ArrayList<URI>();
        for (String vNASId : vNASServerIdSet) {
            vNASURIList.add(URI.create(vNASId));
        }
        vNASList = _dbClient.queryObject(VirtualNAS.class, vNASURIList);
        for (Iterator<VirtualNAS> iterator = vNASList.iterator(); iterator.hasNext(); ) {
            VirtualNAS virtualNAS = iterator.next();
            // Remove inactive, incompatible, invisible vNAS
            _log.info("Checking vNAS - {} : {}", virtualNAS.getNasName(), virtualNAS.getId());
            if (!isVNASActive(virtualNAS)) {
                _log.info("Removing vNAS {} as it is inactive", virtualNAS.getNasName());
                iterator.remove();
                invalidNasServers.add(virtualNAS);
            } else if (!virtualNAS.getAssignedVirtualArrays().contains(varrayUri.toString())) {
                _log.info("Removing vNAS {} as it is not part of varray: {}", virtualNAS.getNasName(), varrayUri.toString());
                iterator.remove();
                invalidNasServers.add(virtualNAS);
            } else if (MetricsKeys.getBoolean(MetricsKeys.overLoaded, virtualNAS.getMetrics())) {
                _log.info("Removing vNAS {} as it is overloaded", virtualNAS.getNasName());
                iterator.remove();
                invalidNasServers.add(virtualNAS);
            } else if (null != virtualNAS.getProtocols() && null != vpool.getProtocols() && !virtualNAS.getProtocols().containsAll(vpool.getProtocols())) {
                _log.info("Removing vNAS {} as it does not support vpool protocols: {}", virtualNAS.getNasName(), vpool.getProtocols());
                iterator.remove();
                invalidNasServers.add(virtualNAS);
            }
        }
    }
    if (vNASList != null) {
        _log.info("Got {} assigned VNAS servers for project {}", vNASList.size(), project);
    }
    return vNASList;
}
Also used : VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) StringSet(com.emc.storageos.db.client.model.StringSet) ArrayList(java.util.ArrayList) URI(java.net.URI)

Example 50 with VirtualNAS

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

the class FileStorageScheduler method getRecommendedVirtualNASBasedOnCandidatePools.

/**
 * Retrieve list of recommended storage ports for file placement
 * Follows the step to get recommendations for file placement.
 * 1. Get the valid vNas servers assigned to given project.
 * a. Get the active vNas assigned to project.
 * b. filter out vNas, if any of them are overloaded.
 * c. filter out vNas which based on vPool protocols.
 * 2. if any valid assigned vNas found for project, goto step #3
 * a. get all vNas servers in given virtual array
 * b. filter out vNas server which are assigned to some project
 * c. filter out vNas, if any of them are overloaded.
 * d. filter out vNas which based on vPool protocols
 * 3. If No - vNas servers found, goto step #
 * 3. if the dynamic metric collection enabled
 * a. sort the list of qualified vNas servers based on
 * i. vNas - avgPercentageBusy
 * ii. vNas - StorageObjects
 * iii. vNas - Storage capacity
 * 4. sort the list of qualified vNas servers based on static load
 * i. vNas - StorageObjects
 * ii. vNas - Storage capacity
 * 5. Pick the overlapping vNas server in the order and recommended by vPool.
 * 6. Pick the overlapping StorageHADomian recommended by vPool.
 *
 * @param vPool
 * @param vArrayURI
 *            virtual array URI
 * @param candidatePools
 * @param project
 * @return list of recommended storage ports for VNAS
 */
private Map<VirtualNAS, List<StoragePool>> getRecommendedVirtualNASBasedOnCandidatePools(VirtualPool vPool, URI vArrayURI, List<StoragePool> candidatePools, Project project, List<VirtualNAS> invalidNasServers) {
    Map<VirtualNAS, List<StoragePool>> map = new LinkedHashMap<VirtualNAS, List<StoragePool>>();
    List<VirtualNAS> vNASList = null;
    if (project != null) {
        _log.info("Get matching recommendations based on assigned VNAS to project {}", project.getLabel());
        vNASList = getVNASServersInProject(project, vArrayURI, vPool, invalidNasServers);
    }
    if (vNASList == null || vNASList.isEmpty()) {
        _log.info("Get matching recommendations based on un-assigned VNAS in varray {}", vArrayURI);
        vNASList = getUnassignedVNASServers(vArrayURI, vPool, project, invalidNasServers);
    }
    if (vNASList != null && !vNASList.isEmpty()) {
        boolean meteringEnabled = Boolean.parseBoolean(configInfo.get(ENABLE_METERING));
        if (meteringEnabled) {
            _log.info("Metering collection is enabled. Sort  vNAS list based on performance.");
            String dynamicPerformanceEnabled = customConfigHandler.getComputedCustomConfigValue(CustomConfigConstants.NAS_DYNAMIC_PERFORMANCE_PLACEMENT_ENABLED, "vnxfile", null);
            _log.info("NAS dynamic performance placement enabled? : {}", dynamicPerformanceEnabled);
            if (Boolean.valueOf(dynamicPerformanceEnabled)) {
                _log.debug("Considering dynamic load to sort virtual NASs");
                sortVNASListOnDyanamicLoad(vNASList);
            } else {
                _log.debug("Considering static load to sort virtual NASs");
                sortVNASListOnStaticLoad(vNASList);
            }
        } else {
            Collections.shuffle(vNASList);
        }
    }
    for (VirtualNAS vNAS : vNASList) {
        List<StoragePool> storagePools = new ArrayList<StoragePool>();
        for (StoragePool storagePool : candidatePools) {
            if (vNAS.getStorageDeviceURI().equals(storagePool.getStorageDevice())) {
                storagePools.add(storagePool);
            }
        }
        if (!storagePools.isEmpty()) {
            map.put(vNAS, storagePools);
        }
    }
    return map;
}
Also used : VirtualNAS(com.emc.storageos.db.client.model.VirtualNAS) StoragePool(com.emc.storageos.db.client.model.StoragePool) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

VirtualNAS (com.emc.storageos.db.client.model.VirtualNAS)54 URI (java.net.URI)26 ArrayList (java.util.ArrayList)19 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)18 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)16 StringSet (com.emc.storageos.db.client.model.StringSet)15 PhysicalNAS (com.emc.storageos.db.client.model.PhysicalNAS)9 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)9 List (java.util.List)9 StoragePort (com.emc.storageos.db.client.model.StoragePort)8 URISyntaxException (java.net.URISyntaxException)8 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)7 FileDeviceInputOutput (com.emc.storageos.volumecontroller.FileDeviceInputOutput)7 Project (com.emc.storageos.db.client.model.Project)6 StringMap (com.emc.storageos.db.client.model.StringMap)6 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)6 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)6 APIException (com.emc.storageos.svcs.errorhandling.resources.APIException)6 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)6 ControllerException (com.emc.storageos.volumecontroller.ControllerException)6