Search in sources :

Example 1 with NetAppClusterFacade

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

the class NetAppClusterApi method listSVM.

public List<StorageVirtualMachineInfo> listSVM() {
    List<StorageVirtualMachineInfo> svms = null;
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https);
        svms = netAppClusterFacade.listSVM();
    } catch (Exception e) {
        _logger.info("No vSevrers discovered.");
    }
    return svms;
}
Also used : NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade) StorageVirtualMachineInfo(com.iwave.ext.netappc.StorageVirtualMachineInfo)

Example 2 with NetAppClusterFacade

use of com.iwave.ext.netappc.NetAppClusterFacade 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 3 with NetAppClusterFacade

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

the class NetAppClusterApi method modifyShare.

public void modifyShare(String shareName, Map<String, String> attrs) throws NetAppCException {
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        netAppClusterFacade.changeCIFSShare(shareName, attrs);
    } catch (Exception e) {
        throw NetAppCException.exceptions.modifyShareNameFailed(shareName, _ipAddress, e.getMessage());
    }
}
Also used : NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade)

Example 4 with NetAppClusterFacade

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

the class NetAppClusterApi method createVolume.

public Boolean createVolume(String volName, String aggregate, String path, String size, Boolean isThin) {
    netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
    String spaceReserve = "";
    if (isThin) {
        spaceReserve = "none";
    }
    Boolean status = netAppClusterFacade.createFlexibleVolume(volName, aggregate, path, size, spaceReserve, VOL_PERMISSION);
    if (status) {
        Collection<String> attrs = new ArrayList<String>();
        attrs.add(VOL_ATTR_NAME);
        for (int i = 0; i <= 3; i++) {
            List<Map<String, String>> fileSystemCharacterics = netAppClusterFacade.listVolumeInfo(volName, attrs);
            Map<String, String> fileSystemChar = fileSystemCharacterics.get(0);
            String fsName = fileSystemChar.get(VOL_ATTR_RESULT_NAME);
            if (volName.equals(fsName)) {
                _logger.info("FS {} has been created successfully on the array", fsName);
                status = true;
                break;
            } else {
                _logger.info("FS not seen on the array yet, check back in few seconds");
                status = false;
                try {
                    Thread.sleep(3);
                } catch (InterruptedException e) {
                    _logger.info("Failed to sleep after FS creation");
                }
                continue;
            }
        }
    } else {
        _logger.info("FS creation failed");
        status = false;
    }
    return status;
}
Also used : NetAppClusterFacade(com.iwave.ext.netappc.NetAppClusterFacade) ArrayList(java.util.ArrayList) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with NetAppClusterFacade

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

the class NetAppClusterApi method setVolumeSize.

public Boolean setVolumeSize(String volume, String newSize) throws NetAppCException {
    try {
        netAppClusterFacade = new NetAppClusterFacade(_ipAddress, _portNumber, _userName, _password, _https, true, _svmName);
        String cmdResult = netAppClusterFacade.setVolumeSize(volume, newSize);
        // Return value is a empty string if the operation is not success
        if (cmdResult == null || cmdResult.equalsIgnoreCase("")) {
            return false;
        } else {
            return true;
        }
    } catch (Exception e) {
        throw NetAppCException.exceptions.setVolumeSizeFailed(volume, newSize);
    }
}
Also used : 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