Search in sources :

Example 11 with DellSCDriverException

use of com.emc.storageos.driver.dellsc.DellSCDriverException in project coprhd-controller by CoprHD.

the class DellSCProvisioning method expandVolume.

/**
 * Expand volume to a new size.
 * Before completion of the request, set all required data for expanded
 * volume in "volume" parameter.
 *
 * @param storageVolume Volume to expand. Type: Input/Output argument.
 * @param newCapacity Requested capacity. Type: input argument.
 * @return The volume expansion task.
 */
public DriverTask expandVolume(StorageVolume storageVolume, long newCapacity) {
    DriverTask task = new DellSCDriverTask("expandVolume");
    try {
        StorageCenterAPI api = connectionManager.getConnection(storageVolume.getStorageSystemId());
        ScVolume scVol = api.expandVolume(storageVolume.getNativeId(), SizeUtil.byteToMeg(newCapacity));
        storageVolume.setProvisionedCapacity(SizeUtil.sizeStrToBytes(scVol.configuredSize));
        task.setStatus(TaskStatus.READY);
        LOG.info("Expanded volume '{}'", scVol.name);
    } catch (DellSCDriverException | StorageCenterAPIException dex) {
        String error = String.format("Error expanding volume %s: %s", storageVolume.getDisplayName(), dex);
        LOG.error(error);
        task.setMessage(error);
        task.setStatus(TaskStatus.FAILED);
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) 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) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Example 12 with DellSCDriverException

use of com.emc.storageos.driver.dellsc.DellSCDriverException in project coprhd-controller by CoprHD.

the class DellSCCloning method deleteVolumeClone.

/**
 * Delete volume clone.
 *
 * @param clone The clone to delete.
 * @return The delete task.
 */
public DriverTask deleteVolumeClone(VolumeClone clone) {
    LOG.info("Deleting volume clone {}", clone);
    DellSCDriverTask task = new DellSCDriverTask("deleteVolumeClone");
    try {
        StorageCenterAPI api = connectionManager.getConnection(clone.getStorageSystemId());
        api.deleteVolume(clone.getNativeId());
        task.setStatus(TaskStatus.READY);
    } catch (StorageCenterAPIException | DellSCDriverException dex) {
        String error = String.format("Error deleting volume clone %s: %s", clone.getNativeId(), dex);
        LOG.error(error);
        task.setFailed(error);
    }
    return task;
}
Also used : StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Example 13 with DellSCDriverException

use of com.emc.storageos.driver.dellsc.DellSCDriverException in project coprhd-controller by CoprHD.

the class DellSCConsistencyGroups method createConsistencyGroupSnapshot.

/**
 * Create consistency group snapshots.
 *
 * @param volumeConsistencyGroup The consistency group.
 * @param snapshots The snapshots.
 * @param capabilities The requested capabilities.
 * @return The create task.
 */
public DriverTask createConsistencyGroupSnapshot(VolumeConsistencyGroup volumeConsistencyGroup, List<VolumeSnapshot> snapshots, List<CapabilityInstance> capabilities) {
    DellSCDriverTask task = new DellSCDriverTask("createCGSnapshot");
    try {
        StorageCenterAPI api = connectionManager.getConnection(volumeConsistencyGroup.getStorageSystemId());
        // Make sure all of our volumes are active for the automated tests that try to
        // snap right away before writing anything to them.
        ScVolume[] volumes = api.getConsistencyGroupVolumes(volumeConsistencyGroup.getNativeId());
        for (ScVolume volume : volumes) {
            api.checkAndInitVolume(volume.instanceId);
        }
        ScReplay[] replays = api.createConsistencyGroupSnapshots(volumeConsistencyGroup.getNativeId());
        if (populateCgSnapshotInfo(snapshots, replays)) {
            task.setStatus(TaskStatus.READY);
        } else {
            task.setStatus(TaskStatus.PARTIALLY_FAILED);
        }
    } catch (StorageCenterAPIException | DellSCDriverException dex) {
        String error = String.format("Error creating CG snapshots %s: %s", volumeConsistencyGroup.getDisplayName(), dex);
        LOG.error(error);
        task.setFailed(error);
    }
    return task;
}
Also used : 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) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException) ScReplay(com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)

Example 14 with DellSCDriverException

use of com.emc.storageos.driver.dellsc.DellSCDriverException in project coprhd-controller by CoprHD.

the class DellSCConsistencyGroups method createConsistencyGroup.

/**
 * Create a consistency group.
 *
 * @param volumeConsistencyGroup The group to create.
 * @return The consistency group creation task.
 */
public DriverTask createConsistencyGroup(VolumeConsistencyGroup volumeConsistencyGroup) {
    DellSCDriverTask task = new DellSCDriverTask("createConsistencyGroup");
    String ssn = volumeConsistencyGroup.getStorageSystemId();
    try {
        StorageCenterAPI api = connectionManager.getConnection(ssn);
        ScReplayProfile cg = api.createConsistencyGroup(ssn, volumeConsistencyGroup.getDisplayName());
        util.getVolumeConsistencyGroupFromReplayProfile(cg, volumeConsistencyGroup);
        task.setStatus(TaskStatus.READY);
    } catch (StorageCenterAPIException | DellSCDriverException dex) {
        String error = String.format("Error creating CG %s: %s", volumeConsistencyGroup.getDisplayName(), dex);
        LOG.error(error);
        task.setFailed(error);
    }
    return task;
}
Also used : StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) ScReplayProfile(com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Example 15 with DellSCDriverException

use of com.emc.storageos.driver.dellsc.DellSCDriverException in project coprhd-controller by CoprHD.

the class DellSCConsistencyGroups method addVolumesToConsistencyGroup.

/**
 * Add volumes to consistency groups.
 *
 * @param volumes The volumes to add.
 * @param capabilities The requested capabilities.
 * @return The driver task.
 */
public DriverTask addVolumesToConsistencyGroup(List<StorageVolume> volumes, StorageCapabilities capabilities) {
    DellSCDriverTask task = new DellSCDriverTask("addVolumesToCG");
    StringBuilder errBuffer = new StringBuilder();
    int addCount = 0;
    for (StorageVolume volume : volumes) {
        String ssn = volume.getStorageSystemId();
        try {
            StorageCenterAPI api = connectionManager.getConnection(ssn);
            api.addVolumeToConsistencyGroup(volume.getNativeId(), volume.getConsistencyGroup());
            addCount++;
        } catch (StorageCenterAPIException | DellSCDriverException dex) {
            String error = String.format("Error adding volume %s to consistency group: %s", volume.getNativeId(), dex);
            LOG.warn(error);
            errBuffer.append(String.format("%s%n", error));
        }
    }
    task.setMessage(errBuffer.toString());
    if (addCount == volumes.size()) {
        task.setStatus(TaskStatus.READY);
    } else if (addCount == 0) {
        task.setStatus(TaskStatus.FAILED);
    } else {
        task.setStatus(TaskStatus.PARTIALLY_FAILED);
    }
    return task;
}
Also used : StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Aggregations

DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)22 StorageCenterAPI (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI)21 StorageCenterAPIException (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)20 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)18 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)10 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)6 ArrayList (java.util.ArrayList)5 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)4 DriverTask (com.emc.storageos.storagedriver.DriverTask)4 ScCopyMirrorMigrate (com.emc.storageos.driver.dellsc.scapi.objects.ScCopyMirrorMigrate)3 ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)3 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)3 VolumeMirror (com.emc.storageos.storagedriver.model.VolumeMirror)3 ScMapping (com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)2 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)2 StoragePort (com.emc.storageos.storagedriver.model.StoragePort)2 VolumeSnapshot (com.emc.storageos.storagedriver.model.VolumeSnapshot)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)1