Search in sources :

Example 1 with CreateGroupCloneDriverTask

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

the class CreateGroupCloneSimulatorOperation method getSuccessMessage.

@SuppressWarnings("unchecked")
@Override
public String getSuccessMessage(Object... args) {
    List<VolumeClone> clones;
    if ((args != null) && (args.length > 0)) {
        clones = (List<VolumeClone>) args[0];
    } else {
        // Must be asynchronous, so updated clones are in the task.
        CreateGroupCloneDriverTask createCloneTask = (CreateGroupCloneDriverTask) _task;
        clones = createCloneTask.getClones();
    }
    return String.format("StorageDriver: createGroupClone information for group %s on storage system %s, clones nativeIds %s - end", clones.get(0).getConsistencyGroup(), clones.get(0).getStorageSystemId(), clones.toString());
}
Also used : CreateGroupCloneDriverTask(com.emc.storageos.storagedriver.task.CreateGroupCloneDriverTask) VolumeClone(com.emc.storageos.storagedriver.model.VolumeClone)

Example 2 with CreateGroupCloneDriverTask

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

the class CreateGroupCloneSimulatorOperation method updateOnAsynchronousSuccess.

@Override
public void updateOnAsynchronousSuccess() {
    CreateGroupCloneDriverTask createCloneTask = (CreateGroupCloneDriverTask) _task;
    List<VolumeClone> clones = createCloneTask.getClones();
    VolumeConsistencyGroup consistencyGroup = createCloneTask.getConsistencyGroup();
    updateGroupCloneInfo(consistencyGroup, clones);
}
Also used : VolumeConsistencyGroup(com.emc.storageos.storagedriver.model.VolumeConsistencyGroup) CreateGroupCloneDriverTask(com.emc.storageos.storagedriver.task.CreateGroupCloneDriverTask) VolumeClone(com.emc.storageos.storagedriver.model.VolumeClone)

Example 3 with CreateGroupCloneDriverTask

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

the class CreateGroupCloneExternalDeviceJob method doTaskSucceeded.

/**
 * {@inheritDoc}
 */
@Override
protected void doTaskSucceeded(DriverTask driverTask, DbClient dbClient) throws Exception {
    s_logger.info(String.format("Successfully created group clone: %s", driverTask.getMessage()));
    // Update the ViPR volumes representing the clone with the
    // corresponding driver clone.
    List<Volume> updatedVolumes = new ArrayList<>();
    for (URI volumeURI : _volumeURIs) {
        Volume volume = dbClient.queryObject(Volume.class, volumeURI);
        if (volume == null) {
            s_logger.error(String.format("Failed to find volume %s", volumeURI));
            throw DeviceControllerException.exceptions.objectNotFound(volumeURI);
        }
        // Update the ViPR clone with the driver clone information.
        CreateGroupCloneDriverTask createCloneDriverTask = (CreateGroupCloneDriverTask) driverTask;
        List<VolumeClone> updatedClones = createCloneDriverTask.getClones();
        for (VolumeClone updatedClone : updatedClones) {
            if (ExternalDeviceUtils.isVolumeExternalDeviceClone(volume, updatedClone, dbClient)) {
                ExternalDeviceUtils.updateNewlyCreatedGroupClone(volume, updatedClone, _cgURI, dbClient);
                updatedVolumes.add(volume);
                break;
            }
        }
    }
    dbClient.updateObject(updatedVolumes);
    try {
        // post process storage pool capacity for clone's pools
        // map clones to their storage pool
        updateStoragePoolCapacityAfterOperationComplete(updatedVolumes, dbClient);
    } catch (Exception ex) {
        s_logger.error("Failed to update storage pool after create group clone operation completion.", ex);
    }
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) ArrayList(java.util.ArrayList) CreateGroupCloneDriverTask(com.emc.storageos.storagedriver.task.CreateGroupCloneDriverTask) VolumeClone(com.emc.storageos.storagedriver.model.VolumeClone) URI(java.net.URI) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 4 with CreateGroupCloneDriverTask

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

the class CreateGroupCloneSimulatorOperation method createDriverTask.

/**
 * Create the create consistency group clone task that is returned by the request.
 *
 * @param consistencyGroup A reference to the consistency group.
 * @param clones A list of the clones to be created.
 */
private void createDriverTask(VolumeConsistencyGroup consistencyGroup, List<VolumeClone> clones) {
    String taskId = String.format("%s+%s+%s", StorageDriverSimulator.DRIVER_NAME, OP_NAME, UUID.randomUUID().toString());
    _log.info("Creating task {} for operation of type {}", taskId, OP_NAME);
    _task = new CreateGroupCloneDriverTask(taskId, consistencyGroup, clones);
    _task.setStatus(DriverTask.TaskStatus.PROVISIONING);
}
Also used : CreateGroupCloneDriverTask(com.emc.storageos.storagedriver.task.CreateGroupCloneDriverTask)

Aggregations

CreateGroupCloneDriverTask (com.emc.storageos.storagedriver.task.CreateGroupCloneDriverTask)4 VolumeClone (com.emc.storageos.storagedriver.model.VolumeClone)3 Volume (com.emc.storageos.db.client.model.Volume)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1 VolumeConsistencyGroup (com.emc.storageos.storagedriver.model.VolumeConsistencyGroup)1 URI (java.net.URI)1 ArrayList (java.util.ArrayList)1