Search in sources :

Example 21 with DriverTask

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

the class DellSCStorageDriver method deleteConsistencyGroupSnapshot.

/**
 * Delete a consistency group snapshot set.
 *
 * @param snapshots The snapshots to delete.
 * @return The delete task.
 */
@Override
public DriverTask deleteConsistencyGroupSnapshot(List<VolumeSnapshot> snapshots) {
    LOG.info("Deleting consistency group snapshot");
    DellSCDriverTask task = new DellSCDriverTask("deleteConsistencyGroupSnapshot");
    StringBuilder errBuffer = new StringBuilder();
    int deletedCount = 0;
    for (VolumeSnapshot snapshot : snapshots) {
        DriverTask subTask = snapshotHelper.deleteVolumeSnapshot(snapshot);
        if (subTask.getStatus() == TaskStatus.FAILED) {
            errBuffer.append(String.format("%s%n", subTask.getMessage()));
        } else {
            deletedCount++;
        }
    }
    task.setMessage(errBuffer.toString());
    if (deletedCount == snapshots.size()) {
        task.setStatus(TaskStatus.READY);
    } else if (deletedCount == 0) {
        task.setStatus(TaskStatus.FAILED);
    } else {
        task.setStatus(TaskStatus.PARTIALLY_FAILED);
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) VolumeSnapshot(com.emc.storageos.storagedriver.model.VolumeSnapshot)

Example 22 with DriverTask

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

the class DellSCStorageDriver method deleteConsistencyGroupMirror.

/*
     * (non-Javadoc)
     * 
     * @see com.emc.storageos.storagedriver.DefaultStorageDriver#deleteConsistencyGroupMirror(java.util.List)
     */
@Override
public DriverTask deleteConsistencyGroupMirror(List<VolumeMirror> mirrors) {
    DellSCDriverTask task = new DellSCDriverTask("deleteConsistencyGroupMirror");
    StringBuilder errBuffer = new StringBuilder();
    int deletedCount = 0;
    for (VolumeMirror mirror : mirrors) {
        DriverTask subTask = mirrorHelper.deleteVolumeMirror(mirror);
        if (subTask.getStatus() == TaskStatus.FAILED) {
            errBuffer.append(String.format("%s%n", subTask.getMessage()));
        } else {
            deletedCount++;
        }
    }
    task.setMessage(errBuffer.toString());
    if (deletedCount == mirrors.size()) {
        task.setStatus(TaskStatus.READY);
    } else if (deletedCount == 0) {
        task.setStatus(TaskStatus.FAILED);
    } else {
        task.setStatus(TaskStatus.PARTIALLY_FAILED);
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) VolumeMirror(com.emc.storageos.storagedriver.model.VolumeMirror)

Example 23 with DriverTask

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

the class DellSCCloning method detachVolumeClone.

/**
 * Detach volume clones.
 *
 * @param clones The clones to detach.
 * @return The detach task.
 */
public DriverTask detachVolumeClone(List<VolumeClone> clones) {
    LOG.info("Detaching volume clone");
    // Clones are not connected to the original volume, so already "detached".
    // Potential future optimization: One volume can only have so many snapshots.
    // We could use this to perform a migrate operation to a new volume to make
    // the clone completely independent of the source and reduce the snapshot count.
    DriverTask task = new DellSCDriverTask("detachVolumeClone");
    task.setStatus(TaskStatus.READY);
    return task;
}
Also used : DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask)

Example 24 with DriverTask

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

the class DellSCDiscovery method discoverStorageSystem.

/**
 * Discover storage systems and their capabilities.
 *
 * @param storageSystem Storage system to discover.
 * @return The discovery task.
 */
public DriverTask discoverStorageSystem(StorageSystem storageSystem) {
    DriverTask task = new DellSCDriverTask("discover");
    try {
        LOG.info("Getting information for storage system [{}] - {}", storageSystem.getIpAddress(), storageSystem.getSystemName());
        String sn = storageSystem.getSerialNumber();
        if (sn == null || sn.length() == 0) {
            // Directly added system, no SSN yet so we use the name field
            sn = storageSystem.getSystemName();
            // name with provider_name+serial_number
            if (sn.contains("+")) {
                String[] parts = sn.split("\\+");
                sn = parts[1];
            }
        }
        int port = storageSystem.getPortNumber();
        if (port == 0) {
            port = 3033;
        }
        StorageCenterAPI api = connectionManager.getConnection(storageSystem.getIpAddress(), port, storageSystem.getUsername(), storageSystem.getPassword(), false);
        // Populate the SC information
        StorageCenter sc = api.findStorageCenter(sn);
        util.getStorageSystemFromStorageCenter(api, sc, storageSystem);
        storageSystem.setSystemType(driverName);
        task.setStatus(DriverTask.TaskStatus.READY);
    } catch (Exception e) {
        String msg = String.format("Exception encountered getting storage system information: %s", e);
        LOG.error(msg);
        task.setMessage(msg);
        task.setStatus(DriverTask.TaskStatus.FAILED);
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenter(com.emc.storageos.driver.dellsc.scapi.objects.StorageCenter) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Example 25 with DriverTask

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

the class DellSCMirroring method resumeVolumeMirror.

/**
 * Resume volume mirrors. Not supported as once a mirror is split,
 * we no longer have any way of knowing what the target was.
 *
 * @param mirrors The mirrors to resume.
 * @return The mirror task.
 */
public DriverTask resumeVolumeMirror(List<VolumeMirror> mirrors) {
    LOG.info("Resuming volume mirror not supported.");
    DriverTask task = new DellSCDriverTask("resumeVolumeMirror");
    task.setStatus(TaskStatus.FAILED);
    return null;
}
Also used : DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask)

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