Search in sources :

Example 11 with CifsAcl

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

the class NetAppFileStorageDevice method createNtpShare.

/**
 * create NetApp share with right permissions
 *
 * @param StorageSystem mount path of the fileshare
 * @param args containing input/out arguments of filedevice
 * @param smbFileShare smbFileshare object
 * @param forceGroup Name of the group the fileshare belongs.
 * @return
 */
private Boolean createNtpShare(StorageSystem storage, FileDeviceInputOutput args, SMBFileShare smbFileShare, String forceGroup) throws NetAppException {
    String shareId = null;
    String portGroup = findVfilerName(args.getFs());
    NetAppApi nApi = new NetAppApi.Builder(storage.getIpAddress(), storage.getPortNumber(), storage.getUsername(), storage.getPassword()).https(true).vFiler(portGroup).build();
    shareId = smbFileShare.getPath();
    _log.info("NetAppFileStorageDevice doShare for {} with id {}", shareId, args.getFileObjId());
    if (!nApi.doShare(shareId, smbFileShare.getName(), smbFileShare.getDescription(), smbFileShare.getMaxUsers(), smbFileShare.getPermission(), forceGroup)) {
        _log.info("NetAppFileStorageDevice doShare for {} with id {} - failed", shareId, args.getFileObjId());
        return false;
    } else {
        // share creation is successful,no need to set permission,clear the default one.
        List<CifsAcl> existingAcls = new ArrayList<CifsAcl>();
        CifsAcl defaultAcl = new CifsAcl();
        // By default NetApp share get everyone full access.
        defaultAcl.setUserName("everyone");
        defaultAcl.setAccess(CifsAccess.full);
        existingAcls.add(defaultAcl);
        nApi.deleteCIFSShareAcl(smbFileShare.getName(), existingAcls);
        smbFileShare.setNativeId(shareId);
        if (null != args.getFileObj()) {
            nApi.setQtreemode(args.getFsPath(), NTFS_QTREE_SETTING);
        }
        smbFileShare.setNetBIOSName(nApi.getNetBiosName());
        _log.info("NetAppFileStorageDevice doShare for {} with id {} - complete", shareId, args.getFileObjId());
        return true;
    }
}
Also used : CifsAcl(com.iwave.ext.netapp.model.CifsAcl) ArrayList(java.util.ArrayList) NetAppApi(com.emc.storageos.netapp.NetAppApi)

Aggregations

CifsAcl (com.iwave.ext.netapp.model.CifsAcl)11 ArrayList (java.util.ArrayList)7 ShareACL (com.emc.storageos.model.file.ShareACL)4 NetAppFacade (com.iwave.ext.netapp.NetAppFacade)4 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 NetAppException (com.emc.storageos.netapp.NetAppException)2 ControllerException (com.emc.storageos.volumecontroller.ControllerException)2 UnManagedCifsShareACL (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedCifsShareACL)1 UnManagedSMBFileShare (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedSMBFileShare)1 NetAppApi (com.emc.storageos.netapp.NetAppApi)1 NaAPIFailedException (netapp.manage.NaAPIFailedException)1 NaElement (netapp.manage.NaElement)1