Search in sources :

Example 1 with QuotaStatus

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

the class NetAppApi method createQtree.

// New QTree methods
public void createQtree(String qtreeName, String volumeName, Boolean opLocks, String securityStyle, Long size, String vfilerName) throws NetAppException {
    try {
        netAppFacade = new NetAppFacade(_ipAddress, _portNumber, _userName, _password, _https, vfilerName);
        netAppFacade.createQtree(qtreeName, volumeName);
        /*
             * Set the security style; if input is default we do not set it.
             * In that case, the qtree inherits the parent volume's security
             * style.
             */
        String qtreePath = null;
        if (volumeName.contains(VOL_ROOT)) {
            if (volumeName.endsWith("/")) {
                // i.e. volume name is something like /vol/lookAtMe/
                qtreePath = volumeName + qtreeName;
            } else {
                // i.e. volume name is something like /vol/lookAtMe
                qtreePath = volumeName + "/" + qtreeName;
            }
        } else {
            // i.e. volume name is something like "lookAtMe"
            qtreePath = "/vol/" + volumeName + "/" + qtreeName;
        }
        _logger.info("NetAppApi::createQtree -> qtreePath = {}", qtreePath);
        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);
        }
        /*
             * Set qtree 'oplocks'
             */
        if (opLocks.booleanValue() == true) {
            netAppFacade.setQTreeOplocks(qtreePath, ENABLE);
        } else {
            netAppFacade.setQTreeOplocks(qtreePath, DISABLE);
        }
        /*
             * Set the size - Quota
             */
        if (size > 0) {
            netAppFacade.addDiskLimitTreeQuota(volumeName, qtreePath, size / SIZE_KB, 0);
            // especially, when we create quota on multi-store environment.
            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) {
        _logger.info("NetAppApi::createQtree -> e.getMessage() = {}", e.getMessage());
        throw NetAppException.exceptions.createQtreeFailed(qtreeName, e.getMessage());
    }
}
Also used : NetAppFacade(com.iwave.ext.netapp.NetAppFacade) QuotaStatus(com.iwave.ext.netapp.QuotaCommands.QuotaStatus)

Example 2 with QuotaStatus

use of com.iwave.ext.netapp.QuotaCommands.QuotaStatus 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 3 with QuotaStatus

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

the class NetAppClusterApi method createQtree.

// New QTree methods
public void createQtree(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.createQtree(qtreeName, volumeName, opLocks, securityStyle);
        String qtreePath = constructQtreePath(volumeName, qtreeName);
        // Set the size - Quota
        if (size > 0) {
            netAppClusterFacade.addDiskLimitTreeQuota(volumeName, qtreePath, size / SIZE_KB, 0);
            // especially, when we create quota on multi-store environment.
            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);
                }
                _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) {
        _logger.info("NetAppClusterApi::createQtree -> e.getMessage() = {}", e.getMessage());
        throw NetAppCException.exceptions.createQtreeFailed(qtreeName, e.getMessage());
    }
}
Also used : NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade) QuotaStatus(com.iwave.ext.netapp.QuotaCommands.QuotaStatus)

Example 4 with QuotaStatus

use of com.iwave.ext.netapp.QuotaCommands.QuotaStatus 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)

Aggregations

QuotaStatus (com.iwave.ext.netapp.QuotaCommands.QuotaStatus)4 NetAppFacade (com.iwave.ext.netapp.NetAppFacade)2 NetAppClusterFacade (com.iwave.ext.netappc.NetAppClusterFacade)2