Search in sources :

Example 6 with UnManagedFSExport

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

the class NetAppFileCommunicationInterface method createUnManagedExport.

private UnManagedFSExport createUnManagedExport(ExportsRuleInfo export, List<ExportsHostnameInfo> typeHosts, String permission, String port) {
    List<String> clientList = new ArrayList<String>();
    UnManagedFSExport tempUnManagedFSExport = null;
    if ((null != typeHosts) && !typeHosts.isEmpty()) {
        for (ExportsHostnameInfo client : typeHosts) {
            if ((null != client.getName() && !(clientList.contains(client.getName())))) {
                if (!clientList.contains(client.getName())) {
                    clientList.add(client.getName());
                }
            } else if ((null != client.getAllHosts()) && (client.getAllHosts())) {
                // All hosts means empty clientList in ViPR.
                clientList.clear();
                _logger.info("Settng ClientList to empty as the export is meant to be accsible to all hosts");
            }
        }
        String anon = export.getSecurityRuleInfos().get(0).getAnon();
        if ((null != anon) && (anon.equals(ROOT_UID))) {
            anon = ROOT_USER_ACCESS;
        } else {
            anon = DEFAULT_ANONMOUS_ACCESS;
        }
        tempUnManagedFSExport = new UnManagedFSExport(clientList, port, port + ":" + export.getPathname(), export.getSecurityRuleInfos().get(0).getSecFlavor(), permission, anon, NFS, port, export.getPathname(), export.getPathname());
    }
    return tempUnManagedFSExport;
}
Also used : UnManagedFSExport(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport) ArrayList(java.util.ArrayList) ExportsHostnameInfo(com.iwave.ext.netapp.model.ExportsHostnameInfo)

Example 7 with UnManagedFSExport

use of com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport 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 8 with UnManagedFSExport

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

the class VNXFileCommunicationInterface method createUnManagedExportWithAccessHosts.

private UnManagedFSExport createUnManagedExportWithAccessHosts(List<String> accessHosts, List<String> rwHosts, String mountPath, String security, StoragePort storagePort, String anonUser, String protocol) {
    UnManagedFSExport unManagedfileExport = new UnManagedFSExport();
    setupUnManagedFSExportProperties(unManagedfileExport, mountPath, security, storagePort, anonUser, protocol);
    unManagedfileExport.setClients(accessHosts);
    if (rwHosts == null) {
        unManagedfileExport.setPermissions(VNXFileConstants.RW);
    } else {
        unManagedfileExport.setPermissions(VNXFileConstants.RO);
    }
    return unManagedfileExport;
}
Also used : UnManagedFSExport(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport)

Example 9 with UnManagedFSExport

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

the class VNXFileCommunicationInterface method createUnManagedExportWithRoHosts.

private UnManagedFSExport createUnManagedExportWithRoHosts(List<String> roHosts, List<String> accessHosts, String mountPath, String security, StoragePort storagePort, String anonUser, String protocol) {
    UnManagedFSExport unManagedfileExport = new UnManagedFSExport();
    setupUnManagedFSExportProperties(unManagedfileExport, mountPath, security, storagePort, anonUser, protocol);
    List<String> readOnlyHosts = roHosts;
    if (accessHosts != null) {
        for (String accHost : accessHosts) {
            if (!(readOnlyHosts.contains(accHost))) {
                readOnlyHosts.add(accHost);
            }
        }
    }
    unManagedfileExport.setClients(readOnlyHosts);
    unManagedfileExport.setPermissions(VNXFileConstants.RO);
    return unManagedfileExport;
}
Also used : UnManagedFSExport(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport)

Example 10 with UnManagedFSExport

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

the class NetAppClusterModeCommIntf method createUnManagedExport.

private UnManagedFSExport createUnManagedExport(ExportsRuleInfo export, List<ExportsHostnameInfo> typeHosts, String permission, String port) {
    List<String> clientList = new ArrayList<String>();
    UnManagedFSExport tempUnManagedFSExport = null;
    if ((null != typeHosts) && (!typeHosts.isEmpty())) {
        for (ExportsHostnameInfo client : typeHosts) {
            boolean negate = false;
            if (client.getNegate() != null) {
                negate = client.getNegate();
            }
            if (!negate) {
                if ((null != client.getName() && !(clientList.contains(client.getName())))) {
                    if (!clientList.contains(client.getName())) {
                        clientList.add(client.getName());
                    }
                } else if ((null != client.getAllHosts()) && (client.getAllHosts())) {
                    // All hosts means empty clientList in ViPR.
                    clientList.clear();
                    _logger.info("Settng ClientList to empty as the export is meant to be accsible to all hosts");
                }
            }
        }
        String anon = export.getSecurityRuleInfos().get(0).getAnon();
        if ((null != anon) && (anon.equals(ROOT_UID))) {
            anon = ROOT_USER_ACCESS;
        } else {
            anon = DEFAULT_ANONMOUS_ACCESS;
        }
        tempUnManagedFSExport = new UnManagedFSExport(clientList, port, port + ":" + export.getPathname(), export.getSecurityRuleInfos().get(0).getSecFlavor(), permission, anon, NFS, port, export.getPathname(), export.getPathname());
    }
    return tempUnManagedFSExport;
}
Also used : UnManagedFSExport(com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport) ArrayList(java.util.ArrayList) ExportsHostnameInfo(com.iwave.ext.netapp.model.ExportsHostnameInfo)

Aggregations

UnManagedFSExport (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExport)12 ArrayList (java.util.ArrayList)5 ExportsHostnameInfo (com.iwave.ext.netapp.model.ExportsHostnameInfo)4 UnManagedFSExportMap (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap)3 StringSet (com.emc.storageos.db.client.model.StringSet)2 DDOptionInfo (com.emc.storageos.datadomain.restapi.DDOptionInfo)1 DDExportClient (com.emc.storageos.datadomain.restapi.model.DDExportClient)1 DDExportList (com.emc.storageos.datadomain.restapi.model.DDExportList)1 DDMTreeList (com.emc.storageos.datadomain.restapi.model.DDMTreeList)1 DDNetworkList (com.emc.storageos.datadomain.restapi.model.DDNetworkList)1 DDShareList (com.emc.storageos.datadomain.restapi.model.DDShareList)1 DDSystemList (com.emc.storageos.datadomain.restapi.model.DDSystemList)1 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 FSExportMap (com.emc.storageos.db.client.model.FSExportMap)1 FileExport (com.emc.storageos.db.client.model.FileExport)1 UnManagedFileExportRule (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileExportRule)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 IsilonExport (com.emc.storageos.isilon.restapi.IsilonExport)1