Search in sources :

Example 1 with FileSystemRequest

use of com.emc.storageos.vnxe.requests.FileSystemRequest in project coprhd-controller by CoprHD.

the class VNXeApiClient method expandFileSystem.

/**
 * expand file system
 *
 * @param fsId
 *            fileSystem Id
 * @param newSize
 *            new capacity
 * @return VNXeCommandJob
 */
public VNXeCommandJob expandFileSystem(String fsId, long newSize) {
    VNXeCommandJob job = null;
    _logger.info("expanding file system:" + fsId);
    FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
    VNXeFileSystem fs = fsRequest.get();
    if (fs == null) {
        _logger.info("Could not find file system in the vxne");
        throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
    }
    String resourceId = fs.getStorageResource().getId();
    ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
    // set fileSystemParam
    FileSystemParam fsParm = new FileSystemParam();
    fsParm.setSize(newSize);
    fsParm.setIsThinEnabled(fs.getIsThinEnabled());
    fsParm.setIsFLREnabled(fs.getIsFLREnabled());
    fsParm.setSupportedProtocols(fs.getSupportedProtocols());
    fsParm.setSizeAllocated(fs.getSizeAllocated());
    modifyFSParm.setFsParameters(fsParm);
    FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
    job = req.modifyFileSystemAsync(modifyFSParm, resourceId);
    return job;
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) FileSystemRequest(com.emc.storageos.vnxe.requests.FileSystemRequest) FileSystemParam(com.emc.storageos.vnxe.models.FileSystemParam) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) CreateFileSystemParam(com.emc.storageos.vnxe.models.CreateFileSystemParam) VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) FileSystemActionRequest(com.emc.storageos.vnxe.requests.FileSystemActionRequest)

Example 2 with FileSystemRequest

use of com.emc.storageos.vnxe.requests.FileSystemRequest in project coprhd-controller by CoprHD.

the class VNXeApiClient method removeNfsShare.

/**
 * Delete nfsShare
 *
 * @param nfsShareId
 *            nfsShare Id
 * @param fsId
 *            file system Id
 * @return VNXeCommandJob
 */
public VNXeCommandJob removeNfsShare(String nfsShareId, String fsId) {
    VNXeCommandJob job = null;
    _logger.info("unexporting file system:" + fsId);
    FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
    VNXeFileSystem fs = fsRequest.get();
    if (fs == null) {
        _logger.error("Could not find file system in the vxne");
        throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
    }
    if (nfsShareId == null || nfsShareId.isEmpty()) {
        _logger.error("NfsShareId is empty.");
        throw VNXeException.exceptions.vnxeCommandFailed("NfsShareId is empty. ");
    }
    String resourceId = fs.getStorageResource().getId();
    ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
    // set NfsShare delete parm
    NfsShareDeleteParam deleteParam = new NfsShareDeleteParam();
    VNXeBase share = new VNXeBase();
    share.setId(nfsShareId);
    deleteParam.setNfsShare(share);
    List<NfsShareDeleteParam> deleteList = new ArrayList<NfsShareDeleteParam>();
    deleteList.add(deleteParam);
    modifyFSParm.setNfsShareDelete(deleteList);
    FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
    job = req.modifyFileSystemAsync(modifyFSParm, resourceId);
    return job;
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) FileSystemRequest(com.emc.storageos.vnxe.requests.FileSystemRequest) NfsShareDeleteParam(com.emc.storageos.vnxe.models.NfsShareDeleteParam) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) ArrayList(java.util.ArrayList) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) FileSystemActionRequest(com.emc.storageos.vnxe.requests.FileSystemActionRequest)

Example 3 with FileSystemRequest

use of com.emc.storageos.vnxe.requests.FileSystemRequest in project coprhd-controller by CoprHD.

the class VNXeApiClient method getFileSystemByFSId.

/**
 * get file system based on file system id
 */
public VNXeFileSystem getFileSystemByFSId(String fsId) {
    _logger.info("getting file system by the file system id: " + fsId);
    FileSystemRequest req = new FileSystemRequest(_khClient, fsId);
    return req.get();
}
Also used : FileSystemRequest(com.emc.storageos.vnxe.requests.FileSystemRequest)

Example 4 with FileSystemRequest

use of com.emc.storageos.vnxe.requests.FileSystemRequest in project coprhd-controller by CoprHD.

the class VNXeApiClient method createCifsShareForSnap.

/**
 * Create CIFS share for snapshot
 *
 * @param snapId
 *            snapshot id
 * @param shareName
 *            CIFS share name
 * @param permission
 *            READ, CHANGE, FULL
 * @return VNXeCommandJob
 * @throws VNXeException
 */
public VNXeCommandJob createCifsShareForSnap(String snapId, String shareName, String permission, String path, String fsId) throws VNXeException {
    _logger.info("Creating CIFS snapshot share name: {} for path: {}", shareName, path);
    // to get NETBIOS of CIFS Server file system is used as for snapshot
    FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
    VNXeFileSystem fs = fsRequest.get();
    List<VNXeCifsServer> cifsServers = getCifsServers(fs.getNasServer().getId());
    netBios = cifsServers.get(0).getNetbiosName();
    CifsShareRequests req = new CifsShareRequests(_khClient);
    CifsShareCreateForSnapParam param = new CifsShareCreateForSnapParam();
    param.setPath(path);
    VNXeBase snap = new VNXeBase();
    snap.setId(snapId);
    if (!VNXeUtils.isHigherVersion(getBasicSystemInfo().getSoftwareVersion(), VNXeConstants.VNXE_BASE_SOFT_VER)) {
        param.setFilesystemSnap(snap);
    } else {
        param.setSnap(snap);
    }
    param.setName(shareName);
    if (permission != null && !permission.isEmpty() && permission.equalsIgnoreCase(AccessEnum.READ.name())) {
        param.setIsReadOnly(true);
    } else {
        param.setIsReadOnly(false);
    }
    return req.createShareForSnapshot(param);
}
Also used : FileSystemRequest(com.emc.storageos.vnxe.requests.FileSystemRequest) CifsShareRequests(com.emc.storageos.vnxe.requests.CifsShareRequests) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) VNXeCifsServer(com.emc.storageos.vnxe.models.VNXeCifsServer) CifsShareCreateForSnapParam(com.emc.storageos.vnxe.models.CifsShareCreateForSnapParam)

Example 5 with FileSystemRequest

use of com.emc.storageos.vnxe.requests.FileSystemRequest in project coprhd-controller by CoprHD.

the class VNXeApiClient method exportFileSystem.

/**
 * NFS export
 *
 * @param fsId
 *            file system KH id
 * @param endpoints
 *            list of host ipaddresses export to
 * @param access
 *            access right
 * @return VNXeCommandJob
 * @throws VNXeException
 */
public VNXeCommandJob exportFileSystem(String fsId, List<String> roEndpoints, List<String> rwEndpoints, List<String> rootEndpoints, AccessEnum access, String path, String shareName, String shareId, String comments) throws VNXeException {
    _logger.info("Exporting file system:" + fsId);
    FileSystemRequest fsRequest = new FileSystemRequest(_khClient, fsId);
    VNXeFileSystem fs = fsRequest.get();
    if (fs == null) {
        _logger.info("Could not find file system in the vxne");
        throw VNXeException.exceptions.vnxeCommandFailed("Could not find file system in the vnxe for: " + fsId);
    }
    String resourceId = fs.getStorageResource().getId();
    ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
    List<VNXeBase> roHosts = getHosts(roEndpoints);
    List<VNXeBase> rwHosts = getHosts(rwEndpoints);
    List<VNXeBase> rootHosts = getHosts(rootEndpoints);
    VNXeNfsShare nfsShareFound = null;
    if (shareName != null) {
        nfsShareFound = findNfsShare(fsId, shareName);
    } else {
        nfsShareFound = getNfsShareById(shareId);
    }
    String nfsShareId = null;
    List<VNXeBase> hosts = new ArrayList<VNXeBase>();
    if (nfsShareFound != null) {
        nfsShareId = nfsShareFound.getId();
    }
    NfsShareParam shareParm = new NfsShareParam();
    shareParm.setReadOnlyHosts(roHosts);
    shareParm.setReadWriteHosts(rwHosts);
    shareParm.setRootAccessHosts(rootHosts);
    if (comments != null) {
        shareParm.setDescription(comments);
    }
    if (access == null) {
        if (nfsShareFound != null) {
            hosts.addAll(nfsShareFound.getNoAccessHosts());
            hosts.addAll(nfsShareFound.getRootAccessHosts());
            hosts.addAll(nfsShareFound.getReadWriteHosts());
            hosts.addAll(nfsShareFound.getReadOnlyHosts());
        }
        NFSShareDefaultAccessEnum nfsShareDefaultAccess = NFSShareDefaultAccessEnum.NONE;
        if (nfsShareFound != null) {
            nfsShareDefaultAccess = nfsShareFound.getDefaultAccess();
        }
        if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.ROOT)) {
            if (!hosts.isEmpty()) {
                shareParm.setRootAccessHosts(hosts);
            } else {
                shareParm.setRootAccessHosts(null);
            }
            shareParm.setNoAccessHosts(null);
            shareParm.setReadWriteHosts(null);
            shareParm.setReadOnlyHosts(null);
        } else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READONLY)) {
            if (!hosts.isEmpty()) {
                shareParm.setReadOnlyHosts(hosts);
            } else {
                shareParm.setReadOnlyHosts(null);
            }
            shareParm.setNoAccessHosts(null);
            shareParm.setReadWriteHosts(null);
            shareParm.setRootAccessHosts(null);
        } else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READWRITE)) {
            if (!hosts.isEmpty()) {
                shareParm.setReadWriteHosts(hosts);
            } else {
                shareParm.setReadWriteHosts(null);
            }
            shareParm.setNoAccessHosts(null);
            shareParm.setReadOnlyHosts(null);
            shareParm.setRootAccessHosts(null);
        } else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.NONE)) {
            if (!hosts.isEmpty()) {
                shareParm.setNoAccessHosts(hosts);
            } else {
                shareParm.setNoAccessHosts(null);
            }
            shareParm.setReadWriteHosts(null);
            shareParm.setReadOnlyHosts(null);
            shareParm.setRootAccessHosts(null);
        }
    }
    if (nfsShareId == null) {
        // not found, new export
        if (!isUnityClient()) {
            shareParm.setDefaultAccess(NFSShareDefaultAccessEnum.NONE);
        }
        NfsShareCreateParam nfsShareCreateParm = new NfsShareCreateParam();
        nfsShareCreateParm.setName(shareName);
        nfsShareCreateParm.setPath(path);
        nfsShareCreateParm.setNfsShareParameters(shareParm);
        List<NfsShareCreateParam> nfsList = new ArrayList<NfsShareCreateParam>();
        nfsList.add(nfsShareCreateParm);
        modifyFSParm.setNfsShareCreate(nfsList);
    } else {
        // update export
        NfsShareModifyParam nfsShareModifyParam = new NfsShareModifyParam();
        VNXeBase nfsShare = new VNXeBase();
        nfsShare.setId(nfsShareId);
        nfsShareModifyParam.setNfsShare(nfsShare);
        nfsShareModifyParam.setNfsShareParameters(shareParm);
        List<NfsShareModifyParam> nfsModifyList = new ArrayList<NfsShareModifyParam>();
        nfsModifyList.add(nfsShareModifyParam);
        modifyFSParm.setNfsShareModify(nfsModifyList);
    }
    FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
    return req.modifyFileSystemAsync(modifyFSParm, resourceId);
}
Also used : VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) NFSShareDefaultAccessEnum(com.emc.storageos.vnxe.models.NfsShareParam.NFSShareDefaultAccessEnum) ArrayList(java.util.ArrayList) NfsShareCreateParam(com.emc.storageos.vnxe.models.NfsShareCreateParam) NfsShareModifyParam(com.emc.storageos.vnxe.models.NfsShareModifyParam) FileSystemRequest(com.emc.storageos.vnxe.requests.FileSystemRequest) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeNfsShare(com.emc.storageos.vnxe.models.VNXeNfsShare) NfsShareParam(com.emc.storageos.vnxe.models.NfsShareParam) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) FileSystemActionRequest(com.emc.storageos.vnxe.requests.FileSystemActionRequest)

Aggregations

FileSystemRequest (com.emc.storageos.vnxe.requests.FileSystemRequest)8 VNXeFileSystem (com.emc.storageos.vnxe.models.VNXeFileSystem)7 ModifyFileSystemParam (com.emc.storageos.vnxe.models.ModifyFileSystemParam)5 VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)5 FileSystemActionRequest (com.emc.storageos.vnxe.requests.FileSystemActionRequest)5 ArrayList (java.util.ArrayList)4 VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)3 VNXeCifsServer (com.emc.storageos.vnxe.models.VNXeCifsServer)2 CifsShareCreateForSnapParam (com.emc.storageos.vnxe.models.CifsShareCreateForSnapParam)1 CifsShareCreateParam (com.emc.storageos.vnxe.models.CifsShareCreateParam)1 CifsShareDeleteParam (com.emc.storageos.vnxe.models.CifsShareDeleteParam)1 CifsShareParam (com.emc.storageos.vnxe.models.CifsShareParam)1 CreateFileSystemParam (com.emc.storageos.vnxe.models.CreateFileSystemParam)1 FileSystemParam (com.emc.storageos.vnxe.models.FileSystemParam)1 NfsShareCreateParam (com.emc.storageos.vnxe.models.NfsShareCreateParam)1 NfsShareDeleteParam (com.emc.storageos.vnxe.models.NfsShareDeleteParam)1 NfsShareModifyParam (com.emc.storageos.vnxe.models.NfsShareModifyParam)1 NfsShareParam (com.emc.storageos.vnxe.models.NfsShareParam)1 NFSShareDefaultAccessEnum (com.emc.storageos.vnxe.models.NfsShareParam.NFSShareDefaultAccessEnum)1 VNXeNfsShare (com.emc.storageos.vnxe.models.VNXeNfsShare)1