Search in sources :

Example 6 with ExportsRuleInfo

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

the class MiscTests method test2.

@Test
public void test2() {
    // NaElement result = server.invoke("nfs-exportfs-list-rules");
    // NetAppUtils.output(result);
    List<ExportsRuleInfo> bla = netAppFacade.listNFSExportRules(null);
    for (ExportsRuleInfo exportsRuleInfo : bla) {
        System.out.println("Pathname: " + exportsRuleInfo.getPathname());
        System.out.println("Actual Pathname: " + exportsRuleInfo.getActualPathname());
        for (SecurityRuleInfo securityRuleInfo : exportsRuleInfo.getSecurityRuleInfos()) {
            System.out.println(" -- anon: " + securityRuleInfo.getAnon());
            System.out.println(" -- nosuid: " + securityRuleInfo.getNosuid());
            System.out.println(" -- sec-flavor: " + securityRuleInfo.getSecFlavor());
            for (ExportsHostnameInfo exportsHostnameInfo : securityRuleInfo.getReadOnly()) {
                System.out.println(" ---- ReadOnly: " + exportsHostnameInfo.getAllHosts() + " " + exportsHostnameInfo.getName() + " " + exportsHostnameInfo.getNegate());
            }
            for (ExportsHostnameInfo exportsHostnameInfo : securityRuleInfo.getReadWrite()) {
                System.out.println(" ---- ReadWrite: " + exportsHostnameInfo.getAllHosts() + " " + exportsHostnameInfo.getName() + " " + exportsHostnameInfo.getNegate());
            }
            for (ExportsHostnameInfo exportsHostnameInfo : securityRuleInfo.getRoot()) {
                System.out.println(" ---- Root: " + exportsHostnameInfo.getAllHosts() + " " + exportsHostnameInfo.getName() + " " + exportsHostnameInfo.getNegate());
            }
        }
    }
}
Also used : SecurityRuleInfo(com.iwave.ext.netapp.model.SecurityRuleInfo) ExportsRuleInfo(com.iwave.ext.netapp.model.ExportsRuleInfo) ExportsHostnameInfo(com.iwave.ext.netapp.model.ExportsHostnameInfo) Test(org.junit.Test)

Example 7 with ExportsRuleInfo

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

the class NetAppClusterApi method deleteNFS.

public Boolean deleteNFS(String volName) throws NetAppCException {
    String exportPath = volName;
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        if (volName != null && !volName.isEmpty() && !volName.startsWith("/")) {
            exportPath = "/" + volName;
        }
        List<ExportsRuleInfo> exportRules = listNFSExportRules(volName);
        if (exportRules.isEmpty()) {
            _logger.info("Export doesn't exist on the array to delete {}", exportPath);
            return true;
        }
        List<String> deletedPaths = netAppClusterFacade.deleteNFSShare(exportPath, false);
        if ((deletedPaths == null) || (1 >= deletedPaths.size())) {
            _logger.error("exportPath deletion failed");
            return false;
        }
        return true;
    } catch (Exception e) {
        throw NetAppCException.exceptions.deleteNFSFailed(volName, _ipAddress, e.getMessage());
    }
}
Also used : NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade) ExportsRuleInfo(com.iwave.ext.netapp.model.ExportsRuleInfo)

Aggregations

ExportsRuleInfo (com.iwave.ext.netapp.model.ExportsRuleInfo)7 ArrayList (java.util.ArrayList)5 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)3 StringMap (com.emc.storageos.db.client.model.StringMap)3 UnManagedFSExportMap (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFSExportMap)3 UnManagedFileSystem (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem)3 UnManagedSMBShareMap (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBShareMap)3 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)3 NetAppException (com.emc.storageos.netapp.NetAppException)3 BaseCollectionException (com.emc.storageos.plugins.BaseCollectionException)3 ExportsHostnameInfo (com.iwave.ext.netapp.model.ExportsHostnameInfo)3 SecurityRuleInfo (com.iwave.ext.netapp.model.SecurityRuleInfo)3 IOException (java.io.IOException)3 URI (java.net.URI)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 StoragePort (com.emc.storageos.db.client.model.StoragePort)2 UnManagedFileExportRule (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileExportRule)2 NetAppApi (com.emc.storageos.netapp.NetAppApi)2 NetAppFileCollectionException (com.emc.storageos.plugins.metering.netapp.NetAppFileCollectionException)2