Search in sources :

Example 36 with VNXeCommandJob

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

the class ApiClientTest method deleteLunsFromLunGroup.

// @Test
public void deleteLunsFromLunGroup() {
    List<String> luns = new ArrayList<String>();
    luns.add("sv_46");
    VNXeCommandJob result = apiClient.deleteLunsFromLunGroup("res_20", luns);
    System.out.println(result.getId());
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) ArrayList(java.util.ArrayList)

Example 37 with VNXeCommandJob

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

the class FileSystemActionRequestTest method createFileSystem.

@Test
public void createFileSystem() {
    CreateFileSystemParam parm = new CreateFileSystemParam();
    parm.setName("test-file-03");
    FileSystemParam fsParm = new FileSystemParam();
    fsParm.setIsThinEnabled(true);
    VNXeBase nasServer = new VNXeBase();
    nasServer.setId("nas_1");
    fsParm.setNasServer(nasServer);
    VNXeBase pool = new VNXeBase();
    pool.setId("pool_1");
    fsParm.setPool(pool);
    fsParm.setSize(2200000000L);
    fsParm.setSupportedProtocols(0);
    fsParm.setIsCacheDisabled(true);
    fsParm.setSupportedProtocols(VNXeFSSupportedProtocolEnum.NFS_CIFS.getValue());
    parm.setFsParameters(fsParm);
    FileSystemActionRequest req = new FileSystemActionRequest(_client);
    VNXeCommandJob response = null;
    try {
        response = req.createFileSystemAsync(parm);
    } catch (VNXeException e) {
        // TODO Auto-generated catch block
        logger.error("VNXeException occured", e);
    }
    System.out.println(response.getId() + "state: " + response.getState());
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) FileSystemParam(com.emc.storageos.vnxe.models.FileSystemParam) CreateFileSystemParam(com.emc.storageos.vnxe.models.CreateFileSystemParam) VNXeException(com.emc.storageos.vnxe.VNXeException) CreateFileSystemParam(com.emc.storageos.vnxe.models.CreateFileSystemParam) Test(org.junit.Test)

Example 38 with VNXeCommandJob

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

the class FileSystemActionRequestTest method expandFileSystem.

// @Test
public void expandFileSystem() {
    String resourceId = "res_4";
    long newSize = 2000000000L;
    ModifyFileSystemParam modifyFSParm = new ModifyFileSystemParam();
    // set fileSystemParam
    FileSystemParam fsParm = new FileSystemParam();
    fsParm.setSize(newSize);
    modifyFSParm.setFsParameters(fsParm);
    FileSystemActionRequest req = new FileSystemActionRequest(_client);
    VNXeCommandJob job = req.modifyFileSystemAsync(modifyFSParm, resourceId);
    System.out.println(job.getId());
}
Also used : VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam) FileSystemParam(com.emc.storageos.vnxe.models.FileSystemParam) CreateFileSystemParam(com.emc.storageos.vnxe.models.CreateFileSystemParam) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam)

Example 39 with VNXeCommandJob

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

the class FileSystemActionRequestTest method removeNfsShare.

// @Test
public void removeNfsShare() {
    ModifyFileSystemParam parm = new ModifyFileSystemParam();
    NfsShareDeleteParam nfsShareParm = new NfsShareDeleteParam();
    VNXeBase nfs = new VNXeBase();
    nfs.setId("NFSShare_1");
    nfsShareParm.setNfsShare(nfs);
    List<NfsShareDeleteParam> shares = new ArrayList<NfsShareDeleteParam>();
    shares.add(nfsShareParm);
    parm.setNfsShareDelete(shares);
    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) NfsShareDeleteParam(com.emc.storageos.vnxe.models.NfsShareDeleteParam) VNXeBase(com.emc.storageos.vnxe.models.VNXeBase) ArrayList(java.util.ArrayList) ModifyFileSystemParam(com.emc.storageos.vnxe.models.ModifyFileSystemParam)

Example 40 with VNXeCommandJob

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

the class VNXUnityRestoreSnapshotJob method updateStatus.

public void updateStatus(JobContext jobContext) throws Exception {
    DbClient dbClient = jobContext.getDbClient();
    try {
        if (_status == JobStatus.IN_PROGRESS) {
            return;
        }
        String opId = getTaskCompleter().getOpId();
        _logger.info(String.format("Updating status of job %s to %s", opId, _status.name()));
        URI snapId = getTaskCompleter().getId();
        BlockSnapshot snapshotObj = dbClient.queryObject(BlockSnapshot.class, snapId);
        URI projectUri = snapshotObj.getProject().getURI();
        StorageSystem storage = dbClient.queryObject(StorageSystem.class, getStorageSystemUri());
        if (_status == JobStatus.SUCCESS && snapshotObj != null) {
            VNXeApiClient vnxeApiClient = getVNXeClient(jobContext);
            VNXeCommandJob vnxeJob = vnxeApiClient.getJob(getJobIds().get(0));
            ParametersOut output = vnxeJob.getParametersOut();
            // get the id of the backup snapshot created before restore operation
            String backUpSnapId = output.getBackup().getId();
            Snap backupSnap = vnxeApiClient.getSnapshot(backUpSnapId);
            if (NullColumnValueGetter.isNotNullValue(snapshotObj.getReplicationGroupInstance())) {
                List<BlockSnapshot> snapshots = ControllerUtils.getSnapshotsPartOfReplicationGroup(snapshotObj, dbClient);
                // Create a snapshot corresponding to the backup snap for each volume in the consistency group
                final List<BlockSnapshot> snapshotList = new ArrayList<BlockSnapshot>();
                Map<String, BlockSnapshot> volumeToSnapMap = new HashMap<String, BlockSnapshot>();
                int count = 1;
                String setLabel = backupSnap.getName();
                for (BlockSnapshot snapshot : snapshots) {
                    BlockObject parent = BlockObject.fetch(dbClient, snapshot.getParent().getURI());
                    String label = String.format("%s-%s", setLabel, count++);
                    final BlockSnapshot newSnap = initSnapshot(parent, label, setLabel, projectUri);
                    newSnap.setOpStatus(new OpStatusMap());
                    snapshotList.add(newSnap);
                    volumeToSnapMap.put(parent.getNativeId(), newSnap);
                }
                List<Snap> snaps = vnxeApiClient.getSnapshotsBySnapGroup(backUpSnapId);
                for (Snap snap : snaps) {
                    String lunId = snap.getLun().getId();
                    BlockSnapshot snapshot = volumeToSnapMap.get(lunId);
                    snapshot.setReplicationGroupInstance(backUpSnapId);
                    createSnapshot(snapshot, snap, storage, dbClient);
                }
            } else {
                Volume vol = dbClient.queryObject(Volume.class, snapshotObj.getParent());
                final BlockSnapshot newSnap = initSnapshot(vol, backupSnap.getName(), backupSnap.getName(), projectUri);
                createSnapshot(newSnap, backupSnap, storage, dbClient);
            }
            getTaskCompleter().ready(dbClient);
        } else if (_status == JobStatus.FAILED && snapshotObj != null) {
            _logger.info(String.format("Task %s failed to restore volume snapshot: %s", opId, snapshotObj.getLabel()));
        }
    } catch (Exception e) {
        _logger.error("Caught an exception while trying to updateStatus for VNXeBlockRestoreSnapshotJob", e);
        setErrorStatus("Encountered an internal error during snapshot restore job status processing : " + e.getMessage());
    } finally {
        super.updateStatus(jobContext);
    }
}
Also used : DbClient(com.emc.storageos.db.client.DbClient) VNXeApiClient(com.emc.storageos.vnxe.VNXeApiClient) HashMap(java.util.HashMap) BlockSnapshot(com.emc.storageos.db.client.model.BlockSnapshot) ArrayList(java.util.ArrayList) OpStatusMap(com.emc.storageos.db.client.model.OpStatusMap) ParametersOut(com.emc.storageos.vnxe.models.ParametersOut) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) Snap(com.emc.storageos.vnxe.models.Snap) VNXeCommandJob(com.emc.storageos.vnxe.models.VNXeCommandJob) Volume(com.emc.storageos.db.client.model.Volume) BlockObject(com.emc.storageos.db.client.model.BlockObject) StorageSystem(com.emc.storageos.db.client.model.StorageSystem)

Aggregations

VNXeCommandJob (com.emc.storageos.vnxe.models.VNXeCommandJob)73 VNXeApiClient (com.emc.storageos.vnxe.VNXeApiClient)48 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)41 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)40 VNXeException (com.emc.storageos.vnxe.VNXeException)40 QueueJob (com.emc.storageos.volumecontroller.impl.job.QueueJob)40 ControllerException (com.emc.storageos.volumecontroller.ControllerException)30 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)24 Snapshot (com.emc.storageos.db.client.model.Snapshot)18 VNXeFileTaskCompleter (com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeFileTaskCompleter)18 ArrayList (java.util.ArrayList)18 FileShare (com.emc.storageos.db.client.model.FileShare)17 SMBFileShare (com.emc.storageos.db.client.model.SMBFileShare)16 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)16 Volume (com.emc.storageos.db.client.model.Volume)13 URI (java.net.URI)10 VNXeBase (com.emc.storageos.vnxe.models.VNXeBase)9 FileExport (com.emc.storageos.db.client.model.FileExport)8 FileShareExport (com.emc.storageos.volumecontroller.FileShareExport)8 DbClient (com.emc.storageos.db.client.DbClient)7