Search in sources :

Example 1 with NFSSecurityStyle

use of com.iwave.ext.netapp.NFSSecurityStyle in project coprhd-controller by CoprHD.

the class NetAppApi method exportFS.

public Boolean exportFS(String mountPath, String exportPath, List<String> rootHosts, List<String> rwHosts, List<String> roHosts, String root_user, String securityStyle) throws NetAppException {
    try {
        if ((null == roHosts) && (null == rwHosts) && (null == rootHosts)) {
            _logger.debug("End points list is null...");
            return false;
        } else {
            // Add all root hosts to rw hosts as well (currently NTP GUI
            // takes care of this).
            addRootToHosts(rootHosts, rwHosts);
            // TODO: Handle multiple security Types here
            List<NFSSecurityStyle> secruityStyleList = new ArrayList<NFSSecurityStyle>();
            String lcaseSecruityStyle = securityStyle.toLowerCase();
            secruityStyleList.add(NFSSecurityStyle.valueOfLabel(ntpSecMap.get(lcaseSecruityStyle)));
            // Handle all the hosts permissions here.
            boolean roAddAll = false;
            boolean rwAddAll = false;
            boolean rootAddAll = false;
            // TODO: Handle all root and anonymous user mappings here.
            int rootMappingUid = 0;
            if (root_user.equals(ROOT_USER)) {
                rootMappingUid = 0;
            } else if (root_user.equals(NO_ROOT_USERS)) {
                rootMappingUid = DISABLE_ROOT_ACCESS_CODE;
            } else {
                // If UID is specified other than root or nobody default it
                // to this value.
                rootMappingUid = DEFAULT_ANONMOUS_ROOT_ACCESS;
            }
            // Finally fire up export.
            netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https, _vFilerName);
            List<String> FsList = netAppFacade.addNFSShare(null, mountPath, rootMappingUid, roHosts, roAddAll, rwHosts, rwAddAll, rootHosts, rootAddAll, secruityStyleList);
            if (FsList.isEmpty()) {
                return false;
            }
        }
    } catch (Exception e) {
        throw NetAppException.exceptions.exportFSFailed(mountPath, exportPath, e.getMessage());
    }
    return true;
}
Also used : NFSSecurityStyle(com.iwave.ext.netapp.NFSSecurityStyle) NetAppFacade(com.iwave.ext.netapp.NetAppFacade) ArrayList(java.util.ArrayList)

Aggregations

NFSSecurityStyle (com.iwave.ext.netapp.NFSSecurityStyle)1 NetAppFacade (com.iwave.ext.netapp.NetAppFacade)1 ArrayList (java.util.ArrayList)1