Search in sources :

Example 21 with VNXeFileSystem

use of com.emc.storageos.vnxe.models.VNXeFileSystem 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 22 with VNXeFileSystem

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

the class DeleteStorageResourceRequest method getStorageResourceId.

/**
 * Get storageResource Id using filesystem Id
 *
 * @param fsId fileSystem Id
 * @return storageResource Id
 */
private String getStorageResourceId(String fsId) {
    FileSystemRequest fsReq = new FileSystemRequest(_client, fsId);
    VNXeFileSystem fs = fsReq.get();
    VNXeBase resource = fs.getStorageResource();
    String result = null;
    if (resource != null) {
        result = resource.getId();
    }
    return result;
}
Also used : VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem)

Example 23 with VNXeFileSystem

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

the class FileSystemListRequest method getByFSName.

/**
 * Get file system using its name
 *
 * @param fsName fileSystem name
 * @return VNXeFileSystem
 */
public VNXeFileSystem getByFSName(String fsName) {
    MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
    queryParams.add(VNXeConstants.FILTER, VNXeConstants.NAME_FILTER + "\"" + fsName + "\"");
    setQueryParameters(queryParams);
    VNXeFileSystem result = null;
    List<VNXeFileSystem> fsList = getDataForObjects(VNXeFileSystem.class);
    // it should just return 1
    if (fsList != null && !fsList.isEmpty()) {
        result = fsList.get(0);
    } else {
        _logger.info("No file system found using the name: " + fsName);
    }
    return result;
}
Also used : VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) MultivaluedMapImpl(com.sun.jersey.core.util.MultivaluedMapImpl)

Example 24 with VNXeFileSystem

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

the class FileSystemRequestTest method getTest.

@Test
public void getTest() {
    FileSystemRequest req = new FileSystemRequest(_client, "fs_5");
    VNXeFileSystem fs = req.get();
    String name = fs.getName();
    System.out.println(name);
    String resourceId = fs.getStorageResource().getId();
    System.out.println(resourceId);
}
Also used : VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) Test(org.junit.Test)

Aggregations

VNXeFileSystem (com.emc.storageos.vnxe.models.VNXeFileSystem)24 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)9 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)7 FileSystemRequest (com.emc.storageos.vnxe.requests.FileSystemRequest)7 StoragePort (com.emc.storageos.db.client.model.StoragePort)6 UnManagedFileSystem (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileSystem)6 VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 ModifyFileSystemParam (com.emc.storageos.vnxe.models.ModifyFileSystemParam)5 FileSystemActionRequest (com.emc.storageos.vnxe.requests.FileSystemActionRequest)5 VNXeNfsShare (com.emc.storageos.vnxe.models.VNXeNfsShare)4 VNXeCifsShare (com.emc.storageos.vnxe.models.VNXeCifsShare)3 VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)3 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)2 StoragePool (com.emc.storageos.db.client.model.StoragePool)2 UnManagedCifsShareACL (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedCifsShareACL)2 UnManagedFileExportRule (com.emc.storageos.db.client.model.UnManagedDiscoveredObjects.UnManagedFileExportRule)2 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)2 VNXeException (com.emc.storageos.vnxe.VNXeException)2