use of com.emc.storageos.storagedriver.task.RestoreFromCloneDriverTask in project coprhd-controller by CoprHD.
the class RestoreFromGroupCloneExternalDeviceJob method doTaskSucceeded.
/**
* {@inheritDoc}
*/
@Override
protected void doTaskSucceeded(DriverTask driverTask, DbClient dbClient) throws Exception {
s_logger.info(String.format("Successfully restored group clone: %s", driverTask.getMessage()));
// Update the ViPR volumes representing the clones 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.
RestoreFromCloneDriverTask restoreDriverTask = (RestoreFromCloneDriverTask) driverTask;
List<VolumeClone> updatedClones = restoreDriverTask.getClones();
for (VolumeClone updatedClone : updatedClones) {
if (ExternalDeviceUtils.isVolumeExternalDeviceClone(volume, updatedClone, dbClient)) {
ExternalDeviceUtils.updateRestoredClone(volume, updatedClone, dbClient, false);
updatedVolumes.add(volume);
break;
}
}
}
dbClient.updateObject(updatedVolumes);
}
use of com.emc.storageos.storagedriver.task.RestoreFromCloneDriverTask in project coprhd-controller by CoprHD.
the class RestoreFromCloneSimulatorOperation 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.
RestoreFromCloneDriverTask restoreCloneTask = (RestoreFromCloneDriverTask) _task;
clones = restoreCloneTask.getClones();
}
return String.format("StorageDriver: restoreFromClone : clones %s", clones.toString());
}
use of com.emc.storageos.storagedriver.task.RestoreFromCloneDriverTask in project coprhd-controller by CoprHD.
the class RestoreFromCloneSimulatorOperation method createDriverTask.
/**
* Create the restore from clone task that is returned by the request.
*
* @param clones A list of the clones to be restored.
*/
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 RestoreFromCloneDriverTask(taskId, clones);
_task.setStatus(DriverTask.TaskStatus.PROVISIONING);
}
use of com.emc.storageos.storagedriver.task.RestoreFromCloneDriverTask in project coprhd-controller by CoprHD.
the class RestoreFromCloneExternalDeviceJob 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 restored 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 you to restore a single
// non-group clone at a time.
RestoreFromCloneDriverTask restoreDriverTask = (RestoreFromCloneDriverTask) driverTask;
List<VolumeClone> updatedClones = restoreDriverTask.getClones();
VolumeClone updatedClone = updatedClones.get(0);
ExternalDeviceUtils.updateRestoredClone(volume, updatedClone, dbClient, true);
}
use of com.emc.storageos.storagedriver.task.RestoreFromCloneDriverTask in project coprhd-controller by CoprHD.
the class RestoreFromCloneSimulatorOperation method updateOnAsynchronousSuccess.
@Override
public void updateOnAsynchronousSuccess() {
RestoreFromCloneDriverTask restoreCloneTask = (RestoreFromCloneDriverTask) _task;
updateCloneInfo(restoreCloneTask.getClones());
}
Aggregations