Search in sources :

Example 51 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class DellSCCloning method restoreFromClone.

/**
 * Restore from the volume clone.
 *
 * @param clones The clones to restore.
 * @return The restore task.
 */
public DriverTask restoreFromClone(List<VolumeClone> clones) {
    LOG.info("Restore from clone not currently supported.");
    DriverTask task = new DellSCDriverTask("restoreVolumeClone");
    task.setStatus(TaskStatus.FAILED);
    task.setMessage("Restore from clone not currently supported.");
    return null;
}
Also used : DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask)

Example 52 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class DellSCMirroring method createVolumeMirror.

/**
 * Create volume mirrors.
 *
 * @param mirrors The volume mirrors to create.
 * @return The creation task.
 */
public DriverTask createVolumeMirror(List<VolumeMirror> mirrors) {
    LOG.info("Creating volume mirror");
    DriverTask task = new DellSCDriverTask("createVolumeMirror");
    StringBuilder errBuffer = new StringBuilder();
    int mirrorsCreated = 0;
    for (VolumeMirror mirror : mirrors) {
        LOG.debug("Creating mirror of volume {}", mirror.getParentId());
        String ssn = mirror.getStorageSystemId();
        try {
            StorageCenterAPI api = connectionManager.getConnection(ssn);
            ScVolume srcVol = api.getVolume(mirror.getParentId());
            ScVolume destVol = api.createVolume(ssn, mirror.getDisplayName(), srcVol.storageType.instanceId, SizeUtil.byteToMeg(SizeUtil.sizeStrToBytes(srcVol.configuredSize)), null);
            ScCopyMirrorMigrate scCmm = api.createMirror(ssn, srcVol.instanceId, destVol.instanceId);
            mirror.setNativeId(scCmm.instanceId);
            mirror.setSyncState(SynchronizationState.COPYINPROGRESS);
            mirrorsCreated++;
            LOG.info("Created volume mirror '{}'", scCmm.instanceId);
        } catch (StorageCenterAPIException | DellSCDriverException dex) {
            String error = String.format("Error creating volume mirror %s: %s", mirror.getDisplayName(), dex);
            LOG.error(error);
            errBuffer.append(String.format("%s%n", error));
        }
    }
    task.setMessage(errBuffer.toString());
    if (mirrorsCreated == mirrors.size()) {
        task.setStatus(TaskStatus.READY);
    } else if (mirrorsCreated == 0) {
        task.setStatus(TaskStatus.FAILED);
    } else {
        task.setStatus(TaskStatus.PARTIALLY_FAILED);
    }
    return task;
}
Also used : DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) DriverTask(com.emc.storageos.storagedriver.DriverTask) ScVolume(com.emc.storageos.driver.dellsc.scapi.objects.ScVolume) StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) ScCopyMirrorMigrate(com.emc.storageos.driver.dellsc.scapi.objects.ScCopyMirrorMigrate) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException) VolumeMirror(com.emc.storageos.storagedriver.model.VolumeMirror)

Example 53 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class DellSCDriverTaskTest method testAbort.

/**
 * Test method for {@link com.emc.storageos.driver.dellsc.DellSCDriverTask#abort(com.emc.storageos.storagedriver.DriverTask)}.
 */
@Test
public void testAbort() {
    DriverTask task = new DellSCDriverTask("test");
    task = task.abort(task);
    // This should fail the abort
    Assert.assertTrue(task.getStatus() == TaskStatus.FAILED);
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) Test(org.junit.Test)

Example 54 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method createConsistencyGroup.

@Override
public DriverTask createConsistencyGroup(VolumeConsistencyGroup consistencyGroup) {
    consistencyGroup.setNativeId(consistencyGroup.getDisplayName());
    consistencyGroup.setDeviceLabel(consistencyGroup.getDisplayName());
    String taskType = "create-volume-cg";
    String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    task.setStatus(DriverTask.TaskStatus.READY);
    String msg = String.format("StorageDriver: createConsistencyGroup information for storage system %s, consistencyGroup nativeId %s - end", consistencyGroup.getStorageSystemId(), consistencyGroup.getNativeId());
    _log.info(msg);
    task.setMessage(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Example 55 with DriverTask

use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.

the class StorageDriverSimulator method deleteVolumeSnapshot.

@Override
public DriverTask deleteVolumeSnapshot(VolumeSnapshot snapshot) {
    String taskType = "delete-volume-snapshot";
    String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    task.setStatus(DriverTask.TaskStatus.READY);
    String msg = String.format("StorageDriver: deleteVolumSnapshot for storage system %s, " + "snapshots nativeId %s - end", snapshot.getStorageSystemId(), snapshot.toString());
    _log.info(msg);
    task.setMessage(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Aggregations

DriverTask (com.emc.storageos.storagedriver.DriverTask)80 BlockStorageDriver (com.emc.storageos.storagedriver.BlockStorageDriver)26 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)26 ArrayList (java.util.ArrayList)26 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)22 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)21 Volume (com.emc.storageos.db.client.model.Volume)15 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)15 IOException (java.io.IOException)15 URI (java.net.URI)15 HashMap (java.util.HashMap)13 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)10 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)9 HashSet (java.util.HashSet)9 VolumeClone (com.emc.storageos.storagedriver.model.VolumeClone)7 VolumeSnapshot (com.emc.storageos.storagedriver.model.VolumeSnapshot)7 BlockObject (com.emc.storageos.db.client.model.BlockObject)6 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)6 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)6 ExportMask (com.emc.storageos.db.client.model.ExportMask)6