Search in sources :

Example 6 with VNXeFileSystem

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

the class VNXeExpandFileSystemJob method updateFS.

/**
 * update FileShare after expanded in VNXe
 *
 * @param fsId fileShare uri in vipr
 * @param dbClient DbClient
 * @param logMsgBuilder string builder for logging
 * @param vnxeApiClient VNXeApiClient
 */
private void updateFS(FileShare fsObj, DbClient dbClient, StringBuilder logMsgBuilder, VNXeApiClient vnxeApiClient) {
    VNXeFileSystem vnxeFS = null;
    vnxeFS = vnxeApiClient.getFileSystemByFSId(fsObj.getNativeId());
    if (vnxeFS != null) {
        fsObj.setCapacity(vnxeFS.getSizeTotal());
        logMsgBuilder.append(String.format("Expand file system successfully for NativeId: %s, URI: %s", fsObj.getNativeId(), getTaskCompleter().getId()));
        dbClient.persistObject(fsObj);
    } else {
        logMsgBuilder.append("Could not find corresponding file system in the VNXe, using the fs ID: ");
        logMsgBuilder.append(fsObj.getNativeId());
        logMsgBuilder.append(" having name: ");
        logMsgBuilder.append(fsObj.getName());
    }
}
Also used : VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem)

Example 7 with VNXeFileSystem

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

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

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

the class FileSystemListRequest method getByStorageResource.

/**
 * Get file system using its storageResourceId
 *
 * @param storageResourceId
 * @return
 */
public VNXeFileSystem getByStorageResource(String storageResourceId) {
    MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
    queryParams.add(VNXeConstants.FILTER, VNXeConstants.STORAGE_RESOURCE_FILTER + "\"" + storageResourceId + "\"");
    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 storage resource id: " + storageResourceId);
    }
    return result;
}
Also used : VNXeFileSystem(com.emc.storageos.vnxe.models.VNXeFileSystem) MultivaluedMapImpl(com.sun.jersey.core.util.MultivaluedMapImpl)

Example 10 with VNXeFileSystem

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

the class FileSystemListRequestTest method getTest.

@Test
public void getTest() {
    FileSystemListRequest req = new FileSystemListRequest(_client);
    List<VNXeFileSystem> list = req.get();
    for (VNXeFileSystem fs : list) {
        String id = fs.getId();
        System.out.println(id);
    }
    VNXeFileSystem fs1 = req.getByStorageResource("res_19");
    System.out.println(fs1.getName());
/*
         * VNXeFileSystem fs2 = req.getByFSName("ProviderTenant_fskh02_5bb3ac40-65f3-4ce1-b629-0c2f0775647c");
         * System.out.println(fs2.getId());
         */
}
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