Search in sources :

Example 6 with UnManagedFSExportMap

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

the class VNXFileCommunicationInterface method associateExportMapWithFS.

private void associateExportMapWithFS(UnManagedFileSystem vnxufs, UnManagedFSExport unManagedfileExport) {
    // TODO: create - separate
    UnManagedFSExportMap currUnManagedExportMap = vnxufs.getFsUnManagedExportMap();
    if (currUnManagedExportMap == null) {
        currUnManagedExportMap = new UnManagedFSExportMap();
        vnxufs.setFsUnManagedExportMap(currUnManagedExportMap);
    }
    String exportKey = unManagedfileExport.getFileExportKey();
    if (currUnManagedExportMap.get(exportKey) == null) {
        currUnManagedExportMap.put(exportKey, unManagedfileExport);
        _logger.debug("associateExportMapWithFS {} no export already exists for mount path {}", exportKey, unManagedfileExport.getMountPath());
    } else {
        currUnManagedExportMap.put(exportKey, unManagedfileExport);
        _logger.warn("associateExportMapWithFS {} Identical export already exists for mount path {} Overwrite", exportKey, unManagedfileExport.getMountPath());
    }
}
Also used : UnManagedFSExportMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap)

Example 7 with UnManagedFSExportMap

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

the class IsilonCommunicationInterface method createUnManagedFileSystem.

/**
 * create StorageFileSystem Info Object
 *
 * @param unManagedFileSystem
 * @param unManagedFileSystemNativeGuid
 * @param storageSystem
 * @param fileSystem
 * @return UnManagedFileSystem
 * @throws IOException
 * @throws IsilonCollectionException
 */
private UnManagedFileSystem createUnManagedFileSystem(UnManagedFileSystem unManagedFileSystem, String unManagedFileSystemNativeGuid, StorageSystem storageSystem, StoragePool pool, NASServer nasServer, FileShare fileSystem) throws IOException, IsilonCollectionException {
    if (null == unManagedFileSystem) {
        unManagedFileSystem = new UnManagedFileSystem();
        unManagedFileSystem.setId(URIUtil.createId(UnManagedFileSystem.class));
        unManagedFileSystem.setNativeGuid(unManagedFileSystemNativeGuid);
        unManagedFileSystem.setStorageSystemUri(storageSystem.getId());
        if (null != pool) {
            unManagedFileSystem.setStoragePoolUri(pool.getId());
        }
        unManagedFileSystem.setHasExports(false);
        unManagedFileSystem.setHasShares(false);
        unManagedFileSystem.setHasNFSAcl(false);
    }
    if (null == unManagedFileSystem.getExtensions()) {
        unManagedFileSystem.setExtensions(new StringMap());
    }
    Map<String, StringSet> unManagedFileSystemInformation = new HashMap<String, StringSet>();
    StringMap unManagedFileSystemCharacteristics = new StringMap();
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_SNAP_SHOT.toString(), FALSE);
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_THINLY_PROVISIONED.toString(), TRUE);
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_FILESYSTEM_EXPORTED.toString(), FALSE);
    if (null != pool) {
        StringSet pools = new StringSet();
        pools.add(pool.getId().toString());
        unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_POOL.toString(), pools);
        StringSet matchedVPools = DiscoveryUtils.getMatchedVirtualPoolsForPool(_dbClient, pool.getId(), unManagedFileSystemCharacteristics.get(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_THINLY_PROVISIONED.toString()));
        _log.debug("Matched Pools : {}", Joiner.on("\t").join(matchedVPools));
        if (null == matchedVPools || matchedVPools.isEmpty()) {
            // clear all existing supported vpools.
            unManagedFileSystem.getSupportedVpoolUris().clear();
        } else {
            // replace with new StringSet
            unManagedFileSystem.getSupportedVpoolUris().replace(matchedVPools);
            _log.info("Replaced Pools :" + Joiner.on("\t").join(unManagedFileSystem.getSupportedVpoolUris()));
        }
    }
    if (null != nasServer) {
        StringSet storagePorts = new StringSet();
        if (nasServer.getStoragePorts() != null && !nasServer.getStoragePorts().isEmpty()) {
            storagePorts.addAll(nasServer.getStoragePorts());
            unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.STORAGE_PORT.toString(), storagePorts);
            _log.info("StoragePorts :" + Joiner.on("\t").join(storagePorts));
        }
        StringSet nasServerSet = new StringSet();
        nasServerSet.add(nasServer.getId().toString());
        unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NAS.toString(), nasServerSet);
        _log.debug("nasServer uri id {}", nasServer.getId().toString());
    }
    unManagedFileSystemCharacteristics.put(UnManagedFileSystem.SupportedFileSystemCharacterstics.IS_INGESTABLE.toString(), TRUE);
    if (null != storageSystem) {
        StringSet systemTypes = new StringSet();
        systemTypes.add(storageSystem.getSystemType());
        unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SYSTEM_TYPE.toString(), systemTypes);
    }
    // Set attributes of FileSystem
    StringSet fsPath = new StringSet();
    fsPath.add(fileSystem.getNativeId());
    StringSet fsMountPath = new StringSet();
    fsMountPath.add(fileSystem.getMountPath());
    StringSet fsName = new StringSet();
    fsName.add(fileSystem.getName());
    StringSet fsId = new StringSet();
    fsId.add(fileSystem.getNativeId());
    StringSet softLimit = new StringSet();
    softLimit.add(fileSystem.getSoftLimit().toString());
    StringSet softGrace = new StringSet();
    softGrace.add(fileSystem.getSoftGracePeriod().toString());
    StringSet notificationLimit = new StringSet();
    notificationLimit.add(fileSystem.getNotificationLimit().toString());
    unManagedFileSystem.setLabel(fileSystem.getName());
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NAME.toString(), fsName);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NATIVE_ID.toString(), fsId);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.DEVICE_LABEL.toString(), fsName);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PATH.toString(), fsPath);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.MOUNT_PATH.toString(), fsMountPath);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SOFT_LIMIT.toString(), softLimit);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.SOFT_GRACE.toString(), softGrace);
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.NOTIFICATION_LIMIT.toString(), notificationLimit);
    StringSet provisionedCapacity = new StringSet();
    long capacity = 0;
    if (fileSystem.getCapacity() != null) {
        capacity = fileSystem.getCapacity();
    }
    provisionedCapacity.add(String.valueOf(capacity));
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.PROVISIONED_CAPACITY.toString(), provisionedCapacity);
    StringSet allocatedCapacity = new StringSet();
    long usedCapacity = 0;
    if (fileSystem.getUsedCapacity() != null) {
        usedCapacity = fileSystem.getUsedCapacity();
    }
    allocatedCapacity.add(String.valueOf(usedCapacity));
    unManagedFileSystemInformation.put(UnManagedFileSystem.SupportedFileSystemInformation.ALLOCATED_CAPACITY.toString(), allocatedCapacity);
    String quotaId = fileSystem.getExtensions().get(QUOTA);
    if (quotaId != null) {
        unManagedFileSystem.getExtensions().put(QUOTA, quotaId);
    }
    _log.debug("Quota : {}  : {}", quotaId, fileSystem.getPath());
    // Add fileSystemInformation and Characteristics.
    unManagedFileSystem.addFileSystemInformation(unManagedFileSystemInformation);
    unManagedFileSystem.addFileSystemCharacterstcis(unManagedFileSystemCharacteristics);
    // Initialize ExportMap
    unManagedFileSystem.setFsUnManagedExportMap(new UnManagedFSExportMap());
    // Initialize SMBMap
    unManagedFileSystem.setUnManagedSmbShareMap(new UnManagedSMBShareMap());
    return unManagedFileSystem;
}
Also used : StringMap(com.emc.storageos.db.client.model.StringMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) UnManagedSMBShareMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBShareMap) StringSet(com.emc.storageos.db.client.model.StringSet) UnManagedFileSystem(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem) UnManagedFSExportMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap)

Example 8 with UnManagedFSExportMap

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

the class DataDomainCommunicationInterface method createExportMap.

private void createExportMap(DDExportInfoDetail export, UnManagedFileSystem unManagedFS, List<StoragePort> ports) {
    Map<String, List<String>> endPointMap = new HashMap<String, List<String>>();
    for (DDExportClient client : export.getClients()) {
        List<String> clients = endPointMap.get(client.getOptions());
        if (clients == null) {
            clients = new ArrayList<String>();
            endPointMap.put(client.getOptions(), clients);
        }
        clients.add(client.getName());
    }
    UnManagedFSExportMap exportMap = unManagedFS.getFsUnManagedExportMap();
    if (exportMap == null) {
        exportMap = new UnManagedFSExportMap();
        unManagedFS.setFsUnManagedExportMap(exportMap);
    }
    Set<String> options = endPointMap.keySet();
    for (String option : options) {
        UnManagedFSExport fExport = new UnManagedFSExport();
        fExport.setNativeId(export.getId());
        fExport.setMountPath(export.getPath());
        fExport.setMountPoint(export.getPath());
        fExport.setPath(export.getPath());
        fExport.setClients(endPointMap.get(option));
        DDOptionInfo optionInfo = DDOptionInfo.parseOptions(option);
        fExport.setPermissions(optionInfo.permission);
        fExport.setProtocol(NFS);
        fExport.setRootUserMapping(optionInfo.rootMapping);
        fExport.setSecurityType(optionInfo.security);
        // need to find the port which was used to create this export.
        // Right now DD API does not contain any info on that.
        Collections.shuffle(ports);
        fExport.setStoragePort(ports.get(0).getId().toString());
        fExport.setStoragePortName(ports.get(0).getPortName());
        String exportKey = fExport.getFileExportKey();
        exportMap.put(exportKey, fExport);
    }
}
Also used : UnManagedFSExport(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport) HashMap(java.util.HashMap) DDExportClient(com.emc.storageos.datadomain.restapi.model.DDExportClient) DDOptionInfo(com.emc.storageos.datadomain.restapi.DDOptionInfo) DDMTreeList(com.emc.storageos.datadomain.restapi.model.DDMTreeList) DDNetworkList(com.emc.storageos.datadomain.restapi.model.DDNetworkList) List(java.util.List) DDExportList(com.emc.storageos.datadomain.restapi.model.DDExportList) DDSystemList(com.emc.storageos.datadomain.restapi.model.DDSystemList) ArrayList(java.util.ArrayList) DDShareList(com.emc.storageos.datadomain.restapi.model.DDShareList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) UnManagedFSExportMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap)

Example 9 with UnManagedFSExportMap

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

the class PropertySetterUtil method convertUnManagedExportMapToManaged.

/**
 * extract value from a String Set
 * This method is used, to get value from a StringSet of size 1.
 *
 * @param key
 * @param volumeInformation
 * @return String
 */
public static FSExportMap convertUnManagedExportMapToManaged(UnManagedFSExportMap unManagedFSExportMap, StoragePort storagePort, StorageHADomain dataMover) {
    FSExportMap fsExportMap = new FSExportMap();
    if (unManagedFSExportMap == null) {
        return fsExportMap;
    }
    for (UnManagedFSExport export : unManagedFSExportMap.values()) {
        FileExport fsExport = new FileExport();
        if (null != export.getIsilonId()) {
            fsExport.setIsilonId(export.getIsilonId());
        }
        if (null != export.getNativeId()) {
            fsExport.setNativeId(export.getNativeId());
        }
        if (null != storagePort) {
            fsExport.setStoragePort(storagePort.getPortName());
            if ((export.getMountPath() != null) && (export.getMountPath().length() > 0)) {
                fsExport.setMountPoint(ExportUtils.getFileMountPoint(storagePort.getPortNetworkId(), export.getMountPath()));
            } else {
                fsExport.setMountPoint(ExportUtils.getFileMountPoint(storagePort.getPortNetworkId(), export.getPath()));
            }
        } else if (null != export.getStoragePort()) {
            fsExport.setStoragePort(export.getStoragePort());
            if (null != export.getMountPoint()) {
                fsExport.setMountPoint(export.getMountPoint());
            }
        }
        if (null != dataMover) {
            fsExport.setStoragePortName(dataMover.getName());
        } else if (null != storagePort) {
            fsExport.setStoragePortName(storagePort.getPortName());
        } else if (null != export.getStoragePortName()) {
            fsExport.setStoragePortName(export.getStoragePortName());
        }
        if (null != export.getMountPath()) {
            fsExport.setMountPath(export.getMountPath());
        }
        fsExport.setPath(export.getPath());
        fsExport.setPermissions(export.getPermissions());
        fsExport.setProtocol(export.getProtocol());
        fsExport.setRootUserMapping(export.getRootUserMapping());
        fsExport.setSecurityType(export.getSecurityType());
        fsExport.setClients(export.getClients());
        fsExportMap.put(fsExport.getFileExportKey(), fsExport);
    }
    return fsExportMap;
}
Also used : UnManagedFSExport(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport) FileExport(com.emc.storageos.db.client.model.FileExport) UnManagedFSExportMap(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap) FSExportMap(com.emc.storageos.db.client.model.FSExportMap)

Aggregations

UnManagedFSExportMap (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap)9 HashMap (java.util.HashMap)6 StringMap (com.emc.storageos.db.client.model.StringMap)5 UnManagedFileSystem (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem)5 ArrayList (java.util.ArrayList)5 UnManagedSMBShareMap (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBShareMap)4 StoragePort (com.emc.storageos.db.client.model.StoragePort)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)3 StringSet (com.emc.storageos.db.client.model.StringSet)3 UnManagedFSExport (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport)3 UnManagedFileExportRule (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileExportRule)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 NetAppException (com.emc.storageos.netapp.NetAppException)3 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 ExportsRuleInfo (com.iwave.ext.netapp.model.ExportsRuleInfo)3 IOException (java.io.IOException)3 URI (java.net.URI)3 Map (java.util.Map)3 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)3 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)2