Search in sources :

Example 1 with CreateVolumeCloneDriverTask

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

the class CreateVolumeCloneExternalDeviceJob method doTaskSucceeded.

/**
 * {@inheritDoc}
 */
@Override
protected void doTaskSucceeded(DriverTask driverTask, DbClient dbClient) throws Exception {
    // Get the ViPR volume representing the clone.
    s_logger.info(String.format("Successfully created volume clone %s:%s", _volumeURI, driverTask.getMessage()));
    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.
    // Note that we know ViPR only allows creation of a single
    // in a given request.
    CreateVolumeCloneDriverTask createCloneDriverTask = (CreateVolumeCloneDriverTask) driverTask;
    List<VolumeClone> updatedClones = createCloneDriverTask.getClones();
    VolumeClone updatedClone = updatedClones.get(0);
    ExternalDeviceUtils.updateNewlyCreatedClone(volume, updatedClone, dbClient);
    try {
        // Update storage pool capacity in database.
        ExternalDeviceUtils.updateStoragePoolCapacityAfterOperationComplete(volume.getPool(), _storageSystemURI, Collections.singletonList(_volumeURI), dbClient);
    } catch (Exception ex) {
        s_logger.error("Failed to update storage pool {} after create clone operation completion.", volume.getPool(), ex);
    }
}
Also used : CreateVolumeCloneDriverTask(com.emc.storageos.storagedriver.task.CreateVolumeCloneDriverTask) Volume(com.emc.storageos.db.client.model.Volume) VolumeClone(com.emc.storageos.storagedriver.model.VolumeClone) DeviceControllerException(com.emc.storageos.exceptions.DeviceControllerException)

Example 2 with CreateVolumeCloneDriverTask

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

the class CreateVolumeCloneSimulatorOperation 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.
        CreateVolumeCloneDriverTask createCloneTask = (CreateVolumeCloneDriverTask) _task;
        clones = createCloneTask.getClones();
    }
    return String.format("StorageDriver: createVolumeClone information for storage system %s, clone nativeIds %s - end", clones.get(0).getStorageSystemId(), clones.toString());
}
Also used : CreateVolumeCloneDriverTask(com.emc.storageos.storagedriver.task.CreateVolumeCloneDriverTask) VolumeClone(com.emc.storageos.storagedriver.model.VolumeClone)

Example 3 with CreateVolumeCloneDriverTask

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

the class CreateVolumeCloneSimulatorOperation method updateOnAsynchronousSuccess.

@Override
public void updateOnAsynchronousSuccess() {
    CreateVolumeCloneDriverTask createCloneTask = (CreateVolumeCloneDriverTask) _task;
    updateCloneInfo(createCloneTask.getClones());
}
Also used : CreateVolumeCloneDriverTask(com.emc.storageos.storagedriver.task.CreateVolumeCloneDriverTask)

Example 4 with CreateVolumeCloneDriverTask

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

the class CreateVolumeCloneSimulatorOperation method createDriverTask.

/**
 * Create the create volume clone task that is returned by the request.
 *
 * @param clones A list of the clones to be created.
 */
private void createDriverTask(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 CreateVolumeCloneDriverTask(taskId, clones);
    _task.setStatus(DriverTask.TaskStatus.PROVISIONING);
}
Also used : CreateVolumeCloneDriverTask(com.emc.storageos.storagedriver.task.CreateVolumeCloneDriverTask)

Aggregations

CreateVolumeCloneDriverTask (com.emc.storageos.storagedriver.task.CreateVolumeCloneDriverTask)4 VolumeClone (com.emc.storageos.storagedriver.model.VolumeClone)2 Volume (com.emc.storageos.db.client.model.Volume)1 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)1