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);
}
}
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());
}
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());
}
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);
}
Aggregations