Search in sources :

Example 1 with CifsShareCreateForSnapParam

use of com.emc.storageos.vnxe.models.CifsShareCreateForSnapParam 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)

Aggregations

CifsShareCreateForSnapParam (com.emc.storageos.vnxe.models.CifsShareCreateForSnapParam)1 VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)1 VNXeCifsServer (com.emc.storageos.vnxe.models.VNXeCifsServer)1 VNXeFileSystem (com.emc.storageos.vnxe.models.VNXeFileSystem)1 CifsShareRequests (com.emc.storageos.vnxe.requests.CifsShareRequests)1 FileSystemRequest (com.emc.storageos.vnxe.requests.FileSystemRequest)1