use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.
the class DellSCCloning method restoreFromClone.
/**
* Restore from the volume clone.
*
* @param clones The clones to restore.
* @return The restore task.
*/
public DriverTask restoreFromClone(List<VolumeClone> clones) {
LOG.info("Restore from clone not currently supported.");
DriverTask task = new DellSCDriverTask("restoreVolumeClone");
task.setStatus(TaskStatus.FAILED);
task.setMessage("Restore from clone not currently supported.");
return null;
}
use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.
the class DellSCMirroring method createVolumeMirror.
/**
* Create volume mirrors.
*
* @param mirrors The volume mirrors to create.
* @return The creation task.
*/
public DriverTask createVolumeMirror(List<VolumeMirror> mirrors) {
LOG.info("Creating volume mirror");
DriverTask task = new DellSCDriverTask("createVolumeMirror");
StringBuilder errBuffer = new StringBuilder();
int mirrorsCreated = 0;
for (VolumeMirror mirror : mirrors) {
LOG.debug("Creating mirror of volume {}", mirror.getParentId());
String ssn = mirror.getStorageSystemId();
try {
StorageCenterAPI api = connectionManager.getConnection(ssn);
ScVolume srcVol = api.getVolume(mirror.getParentId());
ScVolume destVol = api.createVolume(ssn, mirror.getDisplayName(), srcVol.storageType.instanceId, SizeUtil.byteToMeg(SizeUtil.sizeStrToBytes(srcVol.configuredSize)), null);
ScCopyMirrorMigrate scCmm = api.createMirror(ssn, srcVol.instanceId, destVol.instanceId);
mirror.setNativeId(scCmm.instanceId);
mirror.setSyncState(SynchronizationState.COPYINPROGRESS);
mirrorsCreated++;
LOG.info("Created volume mirror '{}'", scCmm.instanceId);
} catch (StorageCenterAPIException | DellSCDriverException dex) {
String error = String.format("Error creating volume mirror %s: %s", mirror.getDisplayName(), dex);
LOG.error(error);
errBuffer.append(String.format("%s%n", error));
}
}
task.setMessage(errBuffer.toString());
if (mirrorsCreated == mirrors.size()) {
task.setStatus(TaskStatus.READY);
} else if (mirrorsCreated == 0) {
task.setStatus(TaskStatus.FAILED);
} else {
task.setStatus(TaskStatus.PARTIALLY_FAILED);
}
return task;
}
use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.
the class DellSCDriverTaskTest method testAbort.
/**
* Test method for {@link com.emc.storageos.driver.dellsc.DellSCDriverTask#abort(com.emc.storageos.storagedriver.DriverTask)}.
*/
@Test
public void testAbort() {
DriverTask task = new DellSCDriverTask("test");
task = task.abort(task);
// This should fail the abort
Assert.assertTrue(task.getStatus() == TaskStatus.FAILED);
}
use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.
the class StorageDriverSimulator method createConsistencyGroup.
@Override
public DriverTask createConsistencyGroup(VolumeConsistencyGroup consistencyGroup) {
consistencyGroup.setNativeId(consistencyGroup.getDisplayName());
consistencyGroup.setDeviceLabel(consistencyGroup.getDisplayName());
String taskType = "create-volume-cg";
String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
DriverTask task = new DriverSimulatorTask(taskId);
task.setStatus(DriverTask.TaskStatus.READY);
String msg = String.format("StorageDriver: createConsistencyGroup information for storage system %s, consistencyGroup nativeId %s - end", consistencyGroup.getStorageSystemId(), consistencyGroup.getNativeId());
_log.info(msg);
task.setMessage(msg);
return task;
}
use of com.emc.storageos.storagedriver.DriverTask in project coprhd-controller by CoprHD.
the class StorageDriverSimulator method deleteVolumeSnapshot.
@Override
public DriverTask deleteVolumeSnapshot(VolumeSnapshot snapshot) {
String taskType = "delete-volume-snapshot";
String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
DriverTask task = new DriverSimulatorTask(taskId);
task.setStatus(DriverTask.TaskStatus.READY);
String msg = String.format("StorageDriver: deleteVolumSnapshot for storage system %s, " + "snapshots nativeId %s - end", snapshot.getStorageSystemId(), snapshot.toString());
_log.info(msg);
task.setMessage(msg);
return task;
}
Aggregations