Search in sources :

Example 1 with NfsShareRequests

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

the class VNXeApiClient method getNfsShareById.

/**
 * Find nfsShare using share Id
 *
 * @param shareId
 *            NFS Share Id
 * @return nfsShare
 */
public VNXeNfsShare getNfsShareById(String shareId) {
    _logger.info("finding nfsShare id: {} ", shareId);
    NfsShareRequests req = new NfsShareRequests(_khClient);
    VNXeNfsShare share = req.getShareById(shareId);
    if (share != null) {
        _logger.info("Got the nfsShare: {}", share.getId());
    } else {
        _logger.info("Could not find nfsShare by Id: {}", shareId);
    }
    return share;
}
Also used : NfsShareRequests(com.emc.storageos.vnxe.requests.NfsShareRequests) VNXeNfsShare(com.emc.storageos.vnxe.models.VNXeNfsShare)

Example 2 with NfsShareRequests

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

the class VNXeApiClient method findNfsShare.

/**
 * Find nfsShare using file system Id and vipr exportKey
 *
 * @param fsId
 *            file system Id
 * @param exportKey
 *            vipr exportKey
 * @return nfsShare Id
 */
public VNXeNfsShare findNfsShare(String fsId, String shareName) {
    _logger.info("finding nfsShare id for file system id: {}, and nameKey: {} ", fsId, shareName);
    NfsShareRequests req = new NfsShareRequests(_khClient);
    VNXeNfsShare share = req.findNfsShare(fsId, shareName, getBasicSystemInfo().getSoftwareVersion());
    return share;
}
Also used : NfsShareRequests(com.emc.storageos.vnxe.requests.NfsShareRequests) VNXeNfsShare(com.emc.storageos.vnxe.models.VNXeNfsShare)

Example 3 with NfsShareRequests

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

the class VNXeApiClient method createNfsShareForSnap.

/**
 * Create Nfs share for snapshot
 *
 * @param snapId
 *            snapshot id
 * @param endpoints
 *            hosts
 * @param access
 *            READ, WRITE, ROOT
 * @param path
 * @param exportKey
 * @return VNXeCommandJob
 * @throws VNXeException
 */
public VNXeCommandJob createNfsShareForSnap(String snapId, List<String> roEndpoints, List<String> rwEndpoints, List<String> rootEndpoints, AccessEnum access, String path, String shareName, String comments) throws VNXeException {
    _logger.info("creating nfs share for the snap: " + snapId);
    NfsShareRequests request = new NfsShareRequests(_khClient);
    String softwareVersion = getBasicSystemInfo().getSoftwareVersion();
    FileSystemSnapRequests req = new FileSystemSnapRequests(_khClient, softwareVersion);
    VNXeFileSystemSnap snapshot = req.getFileSystemSnap(snapId, softwareVersion);
    if (snapshot == null) {
        _logger.info("Could not find snapshot in the vxne");
        throw VNXeException.exceptions.vnxeCommandFailed("Could not find snapshot in the vnxe for: " + snapId);
    }
    NfsShareCreateForSnapParam nfsCreateParam = new NfsShareCreateForSnapParam();
    VNXeBase snap = new VNXeBase(snapId);
    if (!VNXeUtils.isHigherVersion(softwareVersion, VNXeConstants.VNXE_BASE_SOFT_VER)) {
        nfsCreateParam.setFilesystemSnap(snap);
    } else {
        nfsCreateParam.setSnap(snap);
    }
    List<VNXeBase> roHosts = getHosts(roEndpoints);
    List<VNXeBase> rwHosts = getHosts(rwEndpoints);
    List<VNXeBase> rootHosts = getHosts(rootEndpoints);
    VNXeCommandJob job = null;
    VNXeNfsShare nfsShareFound = request.findSnapNfsShare(snapId, shareName, softwareVersion);
    if (nfsShareFound == null) {
        // new export
        nfsCreateParam.setReadOnlyHosts(roHosts);
        nfsCreateParam.setReadWriteHosts(rwHosts);
        nfsCreateParam.setRootAccessHosts(rootHosts);
        nfsCreateParam.setName(shareName);
        nfsCreateParam.setPath(path);
        if (comments != null) {
            nfsCreateParam.setDescription(comments);
        }
        request.unsetQueryParameters();
        job = request.createShareForSnapshot(nfsCreateParam);
    } else {
        String nfsShareId = nfsShareFound.getId();
        NFSShareDefaultAccessEnum nfsShareDefaultAccess = nfsShareFound.getDefaultAccess();
        NfsShareModifyForShareParam nfsModifyParam = new NfsShareModifyForShareParam();
        List<VNXeBase> hosts = new ArrayList<VNXeBase>();
        nfsModifyParam.setReadOnlyHosts(roHosts);
        nfsModifyParam.setReadWriteHosts(rwHosts);
        nfsModifyParam.setRootAccessHosts(rootHosts);
        if (comments != null) {
            nfsModifyParam.setDescription(comments);
        }
        if (access == null) {
            if (nfsShareFound != null) {
                hosts.addAll(nfsShareFound.getNoAccessHosts());
                hosts.addAll(nfsShareFound.getRootAccessHosts());
                hosts.addAll(nfsShareFound.getReadWriteHosts());
                hosts.addAll(nfsShareFound.getReadOnlyHosts());
            }
            if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.ROOT)) {
                if (!hosts.isEmpty()) {
                    nfsModifyParam.setRootAccessHosts(hosts);
                } else {
                    nfsModifyParam.setRootAccessHosts(null);
                }
                nfsModifyParam.setNoAccessHosts(null);
                nfsModifyParam.setReadWriteHosts(null);
                nfsModifyParam.setReadOnlyHosts(null);
            } else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READONLY)) {
                if (!hosts.isEmpty()) {
                    nfsModifyParam.setReadOnlyHosts(hosts);
                } else {
                    nfsModifyParam.setReadOnlyHosts(null);
                }
                nfsModifyParam.setNoAccessHosts(null);
                nfsModifyParam.setReadWriteHosts(null);
                nfsModifyParam.setRootAccessHosts(null);
            } else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.READWRITE)) {
                if (!hosts.isEmpty()) {
                    nfsModifyParam.setReadWriteHosts(hosts);
                } else {
                    nfsModifyParam.setReadWriteHosts(null);
                }
                nfsModifyParam.setNoAccessHosts(null);
                nfsModifyParam.setReadOnlyHosts(null);
                nfsModifyParam.setRootAccessHosts(null);
            } else if (nfsShareDefaultAccess.equals(NFSShareDefaultAccessEnum.NONE)) {
                if (!hosts.isEmpty()) {
                    nfsModifyParam.setNoAccessHosts(hosts);
                } else {
                    nfsModifyParam.setNoAccessHosts(null);
                }
                nfsModifyParam.setReadWriteHosts(null);
                nfsModifyParam.setReadOnlyHosts(null);
                nfsModifyParam.setRootAccessHosts(null);
            }
        }
        request.unsetQueryParameters();
        job = request.modifyShareForSnapshot(nfsShareId, nfsModifyParam);
    }
    return job;
}
Also used : VNXeFileSystemSnap(com.emc.storageos.vnxe.models.VNXeFileSystemSnap) VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) FileSystemSnapRequests(com.emc.storageos.vnxe.requests.FileSystemSnapRequests) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) NfsShareRequests(com.emc.storageos.vnxe.requests.NfsShareRequests) NFSShareDefaultAccessEnum(com.emc.storageos.vnxe.models.NfsShareParam.NFSShareDefaultAccessEnum) NfsShareModifyForShareParam(com.emc.storageos.vnxe.models.NfsShareModifyForShareParam) VNXeNfsShare(com.emc.storageos.vnxe.models.VNXeNfsShare) ArrayList(java.util.ArrayList) NfsShareCreateForSnapParam(com.emc.storageos.vnxe.models.NfsShareCreateForSnapParam)

Example 4 with NfsShareRequests

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

the class VNXeApiClient method getNfsSharesForSnap.

/**
 * Find nfsShares for snapshot Id
 *
 * @param snapId
 *            file system snapshot Id
 * @return list of nfsShare
 */
public List<VNXeNfsShare> getNfsSharesForSnap(String snapId) {
    _logger.info("finding nfsShares for snap id: {} ", snapId);
    NfsShareRequests req = new NfsShareRequests(_khClient);
    List<VNXeNfsShare> shares = req.getSharesForFileSystemSnap(snapId);
    return shares;
}
Also used : NfsShareRequests(com.emc.storageos.vnxe.requests.NfsShareRequests) VNXeNfsShare(com.emc.storageos.vnxe.models.VNXeNfsShare)

Example 5 with NfsShareRequests

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

the class VNXeApiClient method getNfsSharesForFileSystem.

/**
 * Find nfsShares for filesystem Id
 *
 * @param fsId
 *            file system Id
 * @return list of nfsShare
 */
public List<VNXeNfsShare> getNfsSharesForFileSystem(String fsId) {
    _logger.info("finding nfsShares for filesystem id: {} ", fsId);
    NfsShareRequests req = new NfsShareRequests(_khClient);
    List<VNXeNfsShare> shares = req.getSharesForFileSystem(fsId);
    return shares;
}
Also used : NfsShareRequests(com.emc.storageos.vnxe.requests.NfsShareRequests) VNXeNfsShare(com.emc.storageos.vnxe.models.VNXeNfsShare)

Aggregations

VNXeNfsShare (com.emc.storageos.vnxe.models.VNXeNfsShare)6 NfsShareRequests (com.emc.storageos.vnxe.requests.NfsShareRequests)6 NfsShareCreateForSnapParam (com.emc.storageos.vnxe.models.NfsShareCreateForSnapParam)1 NfsShareModifyForShareParam (com.emc.storageos.vnxe.models.NfsShareModifyForShareParam)1 NFSShareDefaultAccessEnum (com.emc.storageos.vnxe.models.NfsShareParam.NFSShareDefaultAccessEnum)1 VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)1 VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)1 VNXeFileSystemSnap (com.emc.storageos.vnxe.models.VNXeFileSystemSnap)1 FileSystemSnapRequests (com.emc.storageos.vnxe.requests.FileSystemSnapRequests)1 ArrayList (java.util.ArrayList)1