Search in sources :

Example 6 with ModifyFileSystemParam

use of com.emc.storageos.vnxe.models.ModifyFileSystemParam in project coprhd-controller by CoprHD.

the class VNXeApiClient method removeCifsShare.

/**
 * Delete cifsShare
 *
 * @param cifsShareId
 *            cifsShare Id
 * @param fsId
 *            file system Id
 * @return VNXeCommandJob
 */
public VNXeCommandJob removeCifsShare(String cifsShareId, String fsId) {
    VNXeCommandJob job = null;
    _logger.info("deleting cifs share" + cifsShareId);
    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 cifsShare delete parm
    CifsShareDeleteParam deleteParam = new CifsShareDeleteParam();
    VNXeBase share = new VNXeBase();
    share.setId(cifsShareId);
    deleteParam.setCifsShare(share);
    List<CifsShareDeleteParam> deleteList = new ArrayList<CifsShareDeleteParam>();
    deleteList.add(deleteParam);
    modifyFSParm.setCifsShareDelete(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) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) CifsShareDeleteParam(com.emc.storageos.vnxe.models.CifsShareDeleteParam) 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 7 with ModifyFileSystemParam

use of com.emc.storageos.vnxe.models.ModifyFileSystemParam in project coprhd-controller by CoprHD.

the class VNXeApiClient method createCIFSShare.

/**
 * create cifsShare
 */
public VNXeCommandJob createCIFSShare(String fsId, String cifsName, String permission, String path) throws VNXeException {
    _logger.info("creating CIFS share:" + 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();
    CifsShareParam cifsParam = new CifsShareParam();
    /*
         * CifsShareACE ace = new CifsShareACE();
         * ace.setAccessLevel(4);
         * ace.setAccessType(1);
         * ace.setSid("S-1-5-21-3623811015-3361044348-30300820-1014");
         * List<CifsShareACE> aceList = new ArrayList<CifsShareACE>();
         * aceList.add(ace);
         * cifsParam.setAddACE(aceList);
         */
    cifsParam.setIsACEEnabled(false);
    if (permission != null && !permission.isEmpty() && permission.equalsIgnoreCase(AccessEnum.READ.name())) {
        cifsParam.setIsReadOnly(true);
    } else {
        cifsParam.setIsReadOnly(false);
    }
    CifsShareCreateParam cifsCreate = new CifsShareCreateParam();
    cifsCreate.setName(cifsName);
    cifsCreate.setPath(path);
    _logger.info("Creating VNXe CIFS share by name: {} for path: {}", cifsName, path);
    List<VNXeCifsServer> cifsServers = getCifsServers(fs.getNasServer().getId());
    if (cifsServers == null || cifsServers.isEmpty()) {
        throw VNXeException.exceptions.vnxeCommandFailed("The nasServer is not configured to support CIFS");
    }
    VNXeBase cifsServer = new VNXeBase();
    cifsServer.setId(cifsServers.get(0).getId());
    cifsCreate.setCifsServer(cifsServer);
    cifsCreate.setCifsShareParameters(cifsParam);
    netBios = cifsServers.get(0).getNetbiosName();
    List<CifsShareCreateParam> cifsCreateList = new ArrayList<CifsShareCreateParam>();
    cifsCreateList.add(cifsCreate);
    modifyFSParm.setCifsShareCreate(cifsCreateList);
    FileSystemActionRequest req = new FileSystemActionRequest(_khClient);
    return req.modifyFileSystemAsync(modifyFSParm, resourceId);
}
Also used : CifsShareParam(com.emc.storageos.vnxe.models.CifsShareParam) CifsShareCreateParam(com.emc.storageos.vnxe.models.CifsShareCreateParam) FileSystemRequest(com.emc.storageos.vnxe.requests.FileSystemRequest) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) VNXeCifsServer(com.emc.storageos.vnxe.models.VNXeCifsServer) ArrayList(java.util.ArrayList) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) FileSystemActionRequest(com.emc.storageos.vnxe.requests.FileSystemActionRequest)

Example 8 with ModifyFileSystemParam

use of com.emc.storageos.vnxe.models.ModifyFileSystemParam in project coprhd-controller by CoprHD.

the class FileSystemActionRequestTest method modifyFileSystem.

// @Test
public void modifyFileSystem() {
    ModifyFileSystemParam parm = new ModifyFileSystemParam();
    NfsShareCreateParam nfsShareParm = new NfsShareCreateParam();
    nfsShareParm.setName("fs-21-share-1");
    nfsShareParm.setPath("/");
    NfsShareParam shareParm = new NfsShareParam();
    List<VNXeBase> hosts = new ArrayList<VNXeBase>();
    VNXeBase host = new VNXeBase();
    host.setId("Host_1");
    hosts.add(host);
    shareParm.setReadWriteHosts(hosts);
    nfsShareParm.setNfsShareParameters(shareParm);
    List<NfsShareCreateParam> nfsList = new ArrayList<NfsShareCreateParam>();
    nfsList.add(nfsShareParm);
    parm.setNfsShareCreate(nfsList);
    FileSystemActionRequest req = new FileSystemActionRequest(_client);
    VNXeCommandJob job = req.modifyFileSystemAsync(parm, "res_4");
    System.out.println(job.getId());
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) ArrayList(java.util.ArrayList) NfsShareParam(com.emc.storageos.vnxe.models.NfsShareParam) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) NfsShareCreateParam(com.emc.storageos.vnxe.models.NfsShareCreateParam)

Aggregations

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