Search in sources :

Example 6 with NetAppClusterFacade

use of com.iwave.ext.netappc.NetAppClusterFacade in project coprhd-controller by CoprHD.

the class NetAppClusterApi method updateQtree.

public void updateQtree(String qtreeName, String volumeName, Boolean opLocks, String securityStyle, Long size, String vfilerName) throws NetAppCException {
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        netAppClusterFacade.updateQtree(qtreeName, volumeName, opLocks, securityStyle);
        String qtreePath = constructQtreePath(volumeName, qtreeName);
        // Modify the quota
        if (size > 0) {
            netAppClusterFacade.setDiskLimitTreeQuota(volumeName, qtreePath, size / SIZE_KB, 0);
            try {
                QuotaStatus quotaStatus = netAppClusterFacade.getQuotaStatus(volumeName);
                if (quotaStatus.OFF == quotaStatus) {
                    netAppClusterFacade.turnQuotaOn(volumeName);
                } else {
                    // Resizing only works for certain types of changes to the quotas file.
                    // For other changes, you need to reinitialize quotas.
                    netAppClusterFacade.reintializeQuota(volumeName);
                }
                // QuotaStatus quotaStatus = netAppClusterFacade.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 NetAppCException.exceptions.createQtreeFailed(qtreeName, e.getMessage());
    }
}
Also used : NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade) QuotaStatus(com.iwave.ext.netapp.QuotaCommands.QuotaStatus)

Example 7 with NetAppClusterFacade

use of com.iwave.ext.netappc.NetAppClusterFacade in project coprhd-controller by CoprHD.

the class NetAppClusterApi method deleteAllQTrees.

public Boolean deleteAllQTrees(String volName) throws NetAppCException {
    String qtreeName = null;
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        List<Qtree> qtrees = netAppClusterFacade.listQtrees(volName);
        if (qtrees != null && !qtrees.isEmpty()) {
            for (Qtree qtree : qtrees) {
                qtreeName = qtree.getQtree();
                // Skip the unnamed Qtree.
                if (qtreeName != null && !qtreeName.isEmpty()) {
                    deleteQtree(qtreeName, volName, _svmName);
                }
            }
        }
        return true;
    } catch (Exception e) {
        _logger.error("Deleting the qtree {} of filesystem {} failed ", qtreeName, volName);
        throw NetAppCException.exceptions.deleteQtreeFailed(qtreeName, e.getMessage());
    }
}
Also used : Qtree(com.iwave.ext.netapp.model.Qtree) NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade)

Example 8 with NetAppClusterFacade

use of com.iwave.ext.netappc.NetAppClusterFacade in project coprhd-controller by CoprHD.

the class NetAppClusterApi method modifyShare.

public Boolean modifyShare(String mntpath, String shareName, String comment, int maxusers, String permission, String forcegroup) throws NetAppCException {
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        CifsAcl acl = new CifsAcl();
        acl.setShareName(shareName);
        acl.setAccess(CifsAccess.valueOfAccess(cifsPermissionMap.get(permission)));
        acl.setUserName(CIFS_DEFAULT_GROUP);
        netAppClusterFacade.setCIFSAcl(acl);
        return true;
    } catch (Exception e) {
        throw NetAppCException.exceptions.modifyShareFailed(_ipAddress, e.getMessage());
    }
}
Also used : CifsAcl(com.iwave.ext.netappc.model.CifsAcl) NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade)

Example 9 with NetAppClusterFacade

use of com.iwave.ext.netappc.NetAppClusterFacade in project coprhd-controller by CoprHD.

the class NetAppClusterApi method modifyCIFSShareAcl.

public boolean modifyCIFSShareAcl(String shareName, List<CifsAcl> acls) {
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        _logger.info("Facade created : {} ", netAppClusterFacade);
        for (CifsAcl acl : acls) {
            acl.setShareName(shareName);
            netAppClusterFacade.setCIFSAcl(acl);
        }
    } catch (Exception e) {
        _logger.error("Error Occured {} ", e.getMessage(), e);
        throw NetAppCException.exceptions.modifyCifsShareAclFailed(shareName, e.getMessage());
    }
    return true;
}
Also used : CifsAcl(com.iwave.ext.netappc.model.CifsAcl) NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade)

Example 10 with NetAppClusterFacade

use of com.iwave.ext.netappc.NetAppClusterFacade in project coprhd-controller by CoprHD.

the class NetAppClusterApi method deleteCIFSShareAcl.

public boolean deleteCIFSShareAcl(String shareName, List<CifsAcl> acls) {
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        _logger.info("Facade created : {} ", netAppClusterFacade);
        for (CifsAcl acl : acls) {
            acl.setShareName(shareName);
            netAppClusterFacade.deleteCIFSAcl(acl);
        }
    } catch (Exception e) {
        _logger.error("Error Occured {} ", e.getMessage(), e);
        throw NetAppCException.exceptions.deleteCIFSShareAclFailed(shareName, e.getMessage());
    }
    return true;
}
Also used : CifsAcl(com.iwave.ext.netappc.model.CifsAcl) NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade)

Aggregations

NetAppClusterFacade (com.iwave.ext.netappc.NetAppClusterFacade)27 ArrayList (java.util.ArrayList)6 CifsAcl (com.iwave.ext.netappc.model.CifsAcl)5 ExportRule (com.emc.storageos.model.file.ExportRule)3 HashMap (java.util.HashMap)3 QuotaStatus (com.iwave.ext.netapp.QuotaCommands.QuotaStatus)2 Map (java.util.Map)2 ExportsRuleInfo (com.iwave.ext.netapp.model.ExportsRuleInfo)1 Qtree (com.iwave.ext.netapp.model.Qtree)1 NFSSecurityStyle (com.iwave.ext.netappc.NFSSecurityStyle)1 StorageVirtualMachineInfo (com.iwave.ext.netappc.StorageVirtualMachineInfo)1 List (java.util.List)1