Search in sources :

Example 76 with StringMap

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

the class IsilonCommunicationInterface method getUnManagedFileQuotaDirectory.

private UnManagedFileQuotaDirectory getUnManagedFileQuotaDirectory(String fsNativeGuid, IsilonSmartQuota quota, StorageSystem storageSystem) {
    String qdNativeId = quota.getPath();
    _log.debug("Converting IsilonSmartQuota {} for fileSystem {}", quota.getPath(), fsNativeGuid);
    int softLimit = 0;
    int softGrace = 0;
    int notificationLimit = 0;
    String nativeGuid = null;
    UnManagedFileQuotaDirectory umfsQd = new UnManagedFileQuotaDirectory();
    StringMap extensionsMap = new StringMap();
    String[] tempDirNames = qdNativeId.split("/");
    umfsQd.setParentFSNativeGuid(fsNativeGuid);
    umfsQd.setLabel(tempDirNames[tempDirNames.length - 1]);
    try {
        nativeGuid = NativeGUIDGenerator.generateNativeGuidForUnManagedQuotaDir(storageSystem.getSystemType(), storageSystem.getSerialNumber(), qdNativeId, "");
    } catch (IOException e) {
        _log.error("Exception while generating NativeGuid for UnManagedQuotaDirectory", e);
    }
    umfsQd.setNativeGuid(nativeGuid);
    umfsQd.setNativeId(qdNativeId);
    long capacity = 0;
    if (quota.getThresholds() != null && quota.getThresholds().getHard() != null) {
        capacity = quota.getThresholds().getHard();
    }
    umfsQd.setSize(capacity);
    if (null != quota.getThresholds().getSoft() && capacity != 0) {
        softLimit = new Long(quota.getThresholds().getSoft() * 100 / capacity).intValue();
    }
    if (null != quota.getThresholds().getSoftGrace() && capacity != 0) {
        softGrace = new Long(quota.getThresholds().getSoftGrace() / (24 * 60 * 60)).intValue();
    }
    if (null != quota.getThresholds().getAdvisory() && capacity != 0) {
        notificationLimit = new Long(quota.getThresholds().getAdvisory() * 100 / capacity).intValue();
    }
    if (null != quota.getId()) {
        extensionsMap.put(QUOTA, quota.getId());
    }
    umfsQd.setSoftLimit(softLimit);
    umfsQd.setSoftGrace(softGrace);
    umfsQd.setNotificationLimit(notificationLimit);
    umfsQd.setExtensions(extensionsMap);
    return umfsQd;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) UnManagedFileQuotaDirectory(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileQuotaDirectory) IOException(java.io.IOException) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint)

Example 77 with StringMap

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

the class DataDomainCommunicationInterface method createUnManagedFileSystem.

private UnManagedFileSystem createUnManagedFileSystem(UnManagedFileSystem unManagedFileSystem, String unManagedFileSystemNativeGuid, DDMTreeInfoDetail mtree, StorageSystem system, StoragePool pool, StringSet vPools) {
    if (null == unManagedFileSystem) {
        unManagedFileSystem = new UnManagedFileSystem();
        unManagedFileSystem.setId(URIUtil.createId(UnManagedFileSystem.class));
        unManagedFileSystem.setNativeGuid(unManagedFileSystemNativeGuid);
        unManagedFileSystem.setStorageSystemUri(system.getId());
        unManagedFileSystem.setFsUnManagedExportMap(new UnManagedFSExportMap());
        unManagedFileSystem.setHasExports(false);
        unManagedFileSystem.setHasShares(false);
    } else {
        // existing File System
        UnManagedFSExportMap exportMap = unManagedFileSystem.getFsUnManagedExportMap();
        if (exportMap != null) {
            exportMap.clear();
        }
    }
    Map<String, StringSet> unManagedFileSystemInformation = new HashMap<String, StringSet>();
    StringMap unManagedFileSystemCharacteristics = new StringMap();
    // TODO: DD does not provide snapshot API yet
    // This will be determined at snapshot discovery, once implemented
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_SNAP_SHOT.toString(), FALSE);
    // DD supports only thinly provisioned FS
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_THINLY_PROVISIONED.toString(), TRUE);
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_INGESTABLE.toString(), TRUE);
    // Don't yet know if the FS is exported, to be determined at export discovery
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_FILESYSTEM_EXPORTED.toString(), FALSE);
    unManagedFileSystem.setHasExports(false);
    if (null != pool) {
        StringSet pools = new StringSet();
        pools.add(pool.getId().toString());
        unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_POOL.toString(), pools);
        unManagedFileSystem.setStoragePoolUri(pool.getId());
    }
    _log.debug("Matched Pools : {}", Joiner.on("\t").join(vPools));
    if (null == vPools || vPools.isEmpty()) {
        unManagedFileSystem.getSupportedVpoolUris().clear();
    } else {
        unManagedFileSystem.getSupportedVpoolUris().replace(vPools);
        _log.info("Replaced Pools :" + Joiner.on("\t").join(unManagedFileSystem.getSupportedVpoolUris()));
    }
    List<StoragePort> ports = getPortFromDB(system);
    if (ports != null) {
        StringSet storagePorts = new StringSet();
        for (StoragePort storagePort : ports) {
            String portId = storagePort.getId().toString();
            storagePorts.add(portId);
        }
        unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString(), storagePorts);
    }
    if (null != system) {
        StringSet systemTypes = new StringSet();
        systemTypes.add(system.getSystemType());
        unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SYSTEM_TYPE.toString(), systemTypes);
    }
    StringSet provisionedCapacity = new StringSet();
    if (mtree.quotaConfig != null) {
        provisionedCapacity.add(Long.toString(mtree.quotaConfig.getHardLimit()));
    } else {
        provisionedCapacity.add(Long.toString(mtree.logicalCapacity.getTotal()));
    }
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PROVISIONED_CAPACITY.toString(), provisionedCapacity);
    StringSet allocatedCapacity = new StringSet();
    if (mtree.logicalCapacity != null) {
        allocatedCapacity.add(Long.toString(mtree.logicalCapacity.getUsed()));
    } else {
        allocatedCapacity.add(Long.toString(0));
    }
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.ALLOCATED_CAPACITY.toString(), allocatedCapacity);
    // Save off FileSystem Name, Path, Mount and label information
    String name = mtree.name;
    StringSet fsName = new StringSet();
    fsName.add(name);
    StringSet fsMountPath = new StringSet();
    fsMountPath.add(mtree.name);
    StringSet nativeId = new StringSet();
    nativeId.add(mtree.id);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NAME.toString(), fsName);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NATIVE_ID.toString(), nativeId);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.DEVICE_LABEL.toString(), fsName);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PATH.toString(), fsName);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.MOUNT_PATH.toString(), fsMountPath);
    // Add fileSystemInformation and Characteristics.
    unManagedFileSystem.addFileSystemInformation(unManagedFileSystemInformation);
    unManagedFileSystem.setFileSystemCharacterstics(unManagedFileSystemCharacteristics);
    return unManagedFileSystem;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) HashMap(java.util.HashMap) StringSet(com.emc.storageos.db.client.model.StringSet) StoragePort(com.emc.storageos.db.client.model.StoragePort) UnManagedFileSystem(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem) UnManagedFSExportMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap)

Example 78 with StringMap

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

the class IsilonCommunicationInterface method copyUpdatedPropertiesInVNAS.

/**
 * Modify Virtual NAS for the specified Isilon cluster storage array
 *
 * @param system
 *            the StorageSystem object
 * @param isiAccessZone
 *            accessZone object
 * @param vNas
 *            the VirtualNAS object
 * @return VirtualNAS with updated attributes
 */
private VirtualNAS copyUpdatedPropertiesInVNAS(final StorageSystem system, final IsilonAccessZone isiAccessZone, VirtualNAS vNas) {
    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());
    StringMap dbMetrics = vNas.getMetrics();
    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)

Example 79 with StringMap

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

the class IsilonCommunicationInterface method populateDbMetricsAz.

/**
 * process dbmetrics for total count and capacity
 *
 * @param azName
 * @param isilonApi
 * @param dbMetrics
 */
private void populateDbMetricsAz(final IsilonAccessZone accessZone, IsilonApi isilonApi, StringMap dbMetrics) {
    long totalProvCap = 0L;
    long totalFsCount = 0L;
    String resumeToken = null;
    String zoneName = accessZone.getName();
    String baseDirPath = accessZone.getPath() + "/";
    // filesystems count & used Capacity
    IsilonList<IsilonSmartQuota> quotas = null;
    do {
        quotas = isilonApi.listQuotas(resumeToken, baseDirPath);
        if (quotas != null && !quotas.getList().isEmpty()) {
            for (IsilonSmartQuota quota : quotas.getList()) {
                totalProvCap = totalProvCap + quota.getUsagePhysical();
                totalFsCount++;
            }
        }
        resumeToken = quotas.getToken();
    } while (resumeToken != null);
    // create a list of access zone for which base dir is not same as system access zone.
    // we get all snapshot list at once. baseDirPaths list is used to
    // find snaphot belong to which access zone.
    List<String> baseDirPaths = null;
    if (accessZone.isSystem() == true) {
        List<IsilonAccessZone> isilonAccessZoneList = isilonApi.getAccessZones(resumeToken);
        baseDirPaths = new ArrayList<String>();
        for (IsilonAccessZone isiAccessZone : isilonAccessZoneList) {
            if (!baseDirPath.equals(IFS_ROOT + "/")) {
                baseDirPaths.add(isiAccessZone.getPath() + "/");
            }
        }
    }
    // snapshots count & snap capacity
    resumeToken = null;
    IsilonList<IsilonSnapshot> snapshots = null;
    do {
        snapshots = isilonApi.listSnapshots(resumeToken);
        if (snapshots != null && !snapshots.getList().isEmpty()) {
            if (!baseDirPath.equals(IFS_ROOT + "/")) {
                // if it is not system access zone then compare
                // with fs path with base dir path
                _log.info("access zone base directory path {}", baseDirPath);
                for (IsilonSnapshot isilonSnap : snapshots.getList()) {
                    if (isilonSnap.getPath().startsWith(baseDirPath)) {
                        totalProvCap = totalProvCap + Long.valueOf(isilonSnap.getSize());
                        totalFsCount++;
                    }
                }
            } else {
                // process the snapshots for system access zone
                boolean snapSystem = true;
                for (IsilonSnapshot isilonSnap : snapshots.getList()) {
                    snapSystem = true;
                    // first check fs path with user defined AZ's paths
                    if (baseDirPaths != null && !baseDirPaths.isEmpty()) {
                        for (String basePath : baseDirPaths) {
                            if (isilonSnap.getPath().startsWith(basePath)) {
                                snapSystem = false;
                                break;
                            }
                        }
                    }
                    // it then it is belongs to access zone with basedir same as system access zone.
                    if (snapSystem) {
                        totalProvCap = totalProvCap + Long.valueOf(isilonSnap.getSize());
                        totalFsCount++;
                        _log.info("Access zone base directory path: {}", accessZone.getPath());
                    }
                }
            }
            resumeToken = snapshots.getToken();
        }
    } while (resumeToken != null);
    if (totalProvCap > 0) {
        totalProvCap = (totalProvCap / KB_IN_BYTES);
    }
    _log.info("Total fs Count {} for access zone : {}", String.valueOf(totalFsCount), accessZone.getName());
    _log.info("Total fs Capacity {} for access zone : {}", String.valueOf(totalProvCap), accessZone.getName());
    // get total exports
    int nfsExportsCount = 0;
    int cifsSharesCount = 0;
    resumeToken = null;
    IsilonList<IsilonExport> isilonNfsExports = null;
    do {
        isilonNfsExports = isilonApi.listExports(resumeToken, zoneName);
        if (isilonNfsExports != null) {
            nfsExportsCount = nfsExportsCount + isilonNfsExports.size();
            resumeToken = isilonNfsExports.getToken();
        }
    } while (resumeToken != null);
    _log.info("Total NFS exports {} for access zone : {}", String.valueOf(nfsExportsCount), accessZone.getName());
    // get cifs exports for given access zone
    resumeToken = null;
    IsilonList<IsilonSMBShare> isilonCifsExports = null;
    do {
        isilonCifsExports = isilonApi.listShares(resumeToken, zoneName);
        if (isilonCifsExports != null) {
            cifsSharesCount = cifsSharesCount + isilonCifsExports.size();
            resumeToken = isilonCifsExports.getToken();
        }
    } while (resumeToken != null);
    _log.info("Total CIFS sharess {} for access zone : {}", String.valueOf(cifsSharesCount), accessZone.getName());
    if (dbMetrics == null) {
        dbMetrics = new StringMap();
    }
    // set total nfs and cifs exports for give AZ
    dbMetrics.put(MetricsKeys.totalNfsExports.name(), String.valueOf(nfsExportsCount));
    dbMetrics.put(MetricsKeys.totalCifsShares.name(), String.valueOf(cifsSharesCount));
    // set total fs objects and their sum of capacity for give AZ
    dbMetrics.put(MetricsKeys.storageObjects.name(), String.valueOf(totalFsCount));
    dbMetrics.put(MetricsKeys.usedStorageCapacity.name(), String.valueOf(totalProvCap));
    Long maxExports = MetricsKeys.getLong(MetricsKeys.maxNFSExports, dbMetrics) + MetricsKeys.getLong(MetricsKeys.maxCifsShares, dbMetrics);
    Long maxStorObjs = MetricsKeys.getLong(MetricsKeys.maxStorageObjects, dbMetrics);
    Long maxCapacity = MetricsKeys.getLong(MetricsKeys.maxStorageCapacity, dbMetrics);
    Long totalExports = Long.valueOf(nfsExportsCount + cifsSharesCount);
    // setting overLoad factor (true or false)
    String overLoaded = FALSE;
    if (totalExports >= maxExports || totalProvCap >= maxCapacity || totalFsCount >= maxStorObjs) {
        overLoaded = TRUE;
    }
    double percentageLoadExports = 0.0;
    // percentage calculator
    if (totalExports > 0.0) {
        percentageLoadExports = ((double) (totalExports) / maxExports) * 100;
    }
    double percentageLoadStorObj = ((double) (totalProvCap) / maxCapacity) * 100;
    double percentageLoad = (percentageLoadExports + percentageLoadStorObj) / 2;
    dbMetrics.put(MetricsKeys.percentLoad.name(), String.valueOf(percentageLoad));
    dbMetrics.put(MetricsKeys.overLoaded.name(), overLoaded);
    return;
}
Also used : IsilonExport(com.emc.storageos.isilon.restapi.IsilonExport) StringMap(com.emc.storageos.db.client.model.StringMap) IsilonSmartQuota(com.emc.storageos.isilon.restapi.IsilonSmartQuota) IsilonAccessZone(com.emc.storageos.isilon.restapi.IsilonAccessZone) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) IsilonSMBShare(com.emc.storageos.isilon.restapi.IsilonSMBShare) IsilonSnapshot(com.emc.storageos.isilon.restapi.IsilonSnapshot)

Example 80 with StringMap

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

the class VPlexControllerUtils method getVolumeITLs.

/**
 * Gets the list of ITLs from the volume extensions
 *
 * @param volume
 * @return
 */
public static List<String> getVolumeITLs(Volume volume) {
    List<String> itlList = new ArrayList<>();
    StringMap extensions = volume.getExtensions();
    if (null != extensions) {
        Set<String> keys = extensions.keySet();
        for (String key : keys) {
            if (key.startsWith(CinderConstants.PREFIX_ITL)) {
                itlList.add(extensions.get(key));
            }
        }
    }
    return itlList;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) ArrayList(java.util.ArrayList)

Aggregations

StringMap (com.emc.storageos.db.client.model.StringMap)257 URI (java.net.URI)108 ArrayList (java.util.ArrayList)90 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)59 StringSet (com.emc.storageos.db.client.model.StringSet)57 HashMap (java.util.HashMap)57 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)48 ExportMask (com.emc.storageos.db.client.model.ExportMask)43 Volume (com.emc.storageos.db.client.model.Volume)42 NamedURI (com.emc.storageos.db.client.model.NamedURI)41 StoragePool (com.emc.storageos.db.client.model.StoragePool)39 Initiator (com.emc.storageos.db.client.model.Initiator)38 List (java.util.List)34 StringSetMap (com.emc.storageos.db.client.model.StringSetMap)33 VirtualArray (com.emc.storageos.db.client.model.VirtualArray)31 HashSet (java.util.HashSet)30 Project (com.emc.storageos.db.client.model.Project)24 StoragePort (com.emc.storageos.db.client.model.StoragePort)23 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)22 Network (com.emc.storageos.db.client.model.Network)21