Search in sources :

Example 6 with NetAppFacade

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

the class NetAppApi method deleteQtree.

public void deleteQtree(String qtreeName, String volumeName, String vfilerName) throws NetAppException {
    try {
        netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https, vfilerName);
        /*
             * Path of an existing qtree. The path should be in this format:
             * 
             * /vol/< volume name >/< qtree name >
             */
        String qtreePath = "/vol/" + volumeName + "/" + qtreeName;
        /*
             * Before deleting the qtree, delete the quota associated with the tree.
             */
        if (netAppFacade.getTreeQuota(volumeName, qtreePath) != null) {
            netAppFacade.deleteTreeQuota(volumeName, qtreePath);
        }
        /*
             * Now delete the qtree.
             */
        netAppFacade.deleteQtree(qtreePath, true);
    } catch (Exception e) {
        throw NetAppException.exceptions.deleteQtreeFailed(qtreeName, e.getMessage());
    }
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade)

Example 7 with NetAppFacade

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

the class NetAppApi method listCIFSShareAcl.

public List<CifsAcl> listCIFSShareAcl(String ShareName) throws NetAppException {
    try {
        if (netAppFacade == null) {
            _logger.warn("Invalid Facade found {} creating now...", netAppFacade);
            netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https);
            _logger.warn("Facade created : {} ", netAppFacade);
        }
        List<CifsAcl> oldacls = netAppFacade.listCIFSAcls(ShareName);
        return oldacls;
    } catch (Exception e) {
        _logger.error("Error Occured {} ", e.getMessage(), e);
        throw NetAppException.exceptions.listCIFSShareAclFailed(ShareName, e.getMessage());
    }
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade) CifsAcl(com.iwave.ext.netapp.model.CifsAcl)

Example 8 with NetAppFacade

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

the class NetAppApi method updateQtree.

public void updateQtree(String qtreeName, String volumeName, Boolean opLocks, String securityStyle, Long size, String vfilerName) throws NetAppException {
    try {
        netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https, vfilerName);
        String qtreePath = "/vol/" + volumeName + "/" + qtreeName;
        // Update the security style
        if (securityStyle.equalsIgnoreCase("unix")) {
            netAppFacade.setQTreeSecurityStyle(qtreePath, "unix");
        } else if (securityStyle.equalsIgnoreCase("ntfs")) {
            netAppFacade.setQTreeSecurityStyle(qtreePath, "ntfs");
        } else if (securityStyle.equalsIgnoreCase("mixed")) {
            netAppFacade.setQTreeSecurityStyle(qtreePath, "mixed");
        }
        /*
             * Update qtree 'oplocks'
             */
        if (opLocks.booleanValue() == true) {
            netAppFacade.setQTreeOplocks(qtreePath, "enable");
        } else {
            netAppFacade.setQTreeOplocks(qtreePath, "disable");
        }
        // Modify the quota
        if (size > 0) {
            netAppFacade.setDiskLimitTreeQuota(volumeName, qtreePath, size / SIZE_KB, 0);
            try {
                QuotaStatus quotaStatus = netAppFacade.getQuotaStatus(volumeName);
                if (quotaStatus.OFF == quotaStatus) {
                    netAppFacade.turnQuotaOn(volumeName);
                } else {
                    // Resizing only works for certain types of changes to the quotas file.
                    // For other changes, you need to reinitialize quotas.
                    netAppFacade.reintializeQuota(volumeName);
                }
                // QuotaStatus quotaStatus = netAppFacade.getQuotaStatus(volumeName);
                _logger.info("Quota status on volume {} is {}. ", volumeName, quotaStatus.toString());
            } catch (Exception e) {
                _logger.warn("Quota status on volume {} is not stable. ", volumeName);
            }
        }
    } catch (Exception e) {
        throw NetAppException.exceptions.createQtreeFailed(qtreeName, e.getMessage());
    }
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade) QuotaStatus(com.iwave.ext.netapp.QuotaCommands.QuotaStatus)

Example 9 with NetAppFacade

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

the class NetAppApi method listSnapshots.

@SuppressWarnings("findbugs:ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
public List<String> listSnapshots(String volumeName) throws NetAppException {
    List<String> snapshots = null;
    try {
        netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https);
        snapshots = (List<String>) netAppFacade.listSnapshots(volumeName);
    } catch (Exception e) {
        String[] params = { volumeName, e.getMessage() };
        _logger.info("Failed to retrieve list of snapshots for {} due to {}", params);
    }
    return snapshots;
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade)

Example 10 with NetAppFacade

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

the class NetAppApi method doShare.

public Boolean doShare(String mntpath, String shareName, String comment, int maxusers, String permission, String forcegroup) throws NetAppException {
    try {
        String mountPath;
        if (mntpath.startsWith("/vol")) {
            mountPath = mntpath;
        } else {
            mountPath = "/vol" + mntpath;
        }
        netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https, _vFilerName);
        if (!netAppFacade.addCIFSShare(mountPath, shareName, comment, maxusers, forcegroup)) {
            return false;
        }
        Map<String, String> CIFS_Config = netAppFacade.listCIFSConfig();
        this.NetBIOSName = CIFS_Config.get("NetBIOS-servername");
        return true;
    } catch (Exception e) {
        throw NetAppException.exceptions.doShareFailed(mntpath, shareName, _ipAddress, e.getMessage());
    }
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade)

Aggregations

NetAppFacade (com.iwave.ext.netapp.NetAppFacade)24 ArrayList (java.util.ArrayList)5 CifsAcl (com.iwave.ext.netapp.model.CifsAcl)4 ExportRule (com.emc.storageos.model.file.ExportRule)2 QuotaStatus (com.iwave.ext.netapp.QuotaCommands.QuotaStatus)2 HashMap (java.util.HashMap)2 NFSSecurityStyle (com.iwave.ext.netapp.NFSSecurityStyle)1 VFilerInfo (com.iwave.ext.netapp.VFilerInfo)1 VolumeOptionType (com.iwave.ext.netapp.VolumeOptionType)1 Qtree (com.iwave.ext.netapp.model.Qtree)1 List (java.util.List)1 Map (java.util.Map)1