Search in sources :

Example 36 with DriverTask

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

the class StorageDriverSimulator method getStorageVolumes.

@Override
public DriverTask getStorageVolumes(StorageSystem storageSystem, List<StorageVolume> storageVolumes, MutableInt token) {
    // all volumes on the same page belong to the same consistency group
    if (token.intValue() == 0) {
        arrayToVolumeToVolumeExportInfoMap.clear();
    }
    List<StoragePort> ports = new ArrayList<>();
    discoverStoragePorts(storageSystem, ports);
    for (int vol = 0; vol < NUMBER_OF_VOLUMES_ON_PAGE; vol++) {
        StorageVolume driverVolume = new StorageVolume();
        driverVolume.setStorageSystemId(storageSystem.getNativeId());
        driverVolume.setStoragePoolId("pool-1234577-" + token.intValue() + storageSystem.getNativeId());
        driverVolume.setNativeId("driverSimulatorVolume-1234567-" + token.intValue() + "-" + vol);
        if (VOLUMES_IN_CG) {
            driverVolume.setConsistencyGroup("driverSimulatorCG-" + token.intValue());
        }
        driverVolume.setAccessStatus(StorageVolume.AccessStatus.READ_WRITE);
        driverVolume.setThinlyProvisioned(true);
        driverVolume.setThinVolumePreAllocationSize(3000L);
        driverVolume.setProvisionedCapacity(3 * 1024 * 1024 * 1024L);
        driverVolume.setAllocatedCapacity(50000L);
        driverVolume.setDeviceLabel(driverVolume.getNativeId());
        driverVolume.setWwn(String.format("%s%s", driverVolume.getStorageSystemId(), driverVolume.getNativeId()));
        storageVolumes.add(driverVolume);
        _log.info("Unmanaged volume info: pool {}, volume {}", driverVolume.getStoragePoolId(), driverVolume);
        if (GENERATE_EXPORT_DATA) {
            // get host for this page
            for (String hostName : pageToHostMap.get(token.intValue())) {
                _log.info("Process host {}", hostName);
                generateExportDataForVolume(hostName, driverVolume.getStorageSystemId(), driverVolume.getNativeId(), vol, ports, token.intValue());
            }
        }
    }
    String taskType = "create-storage-volumes";
    String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    task.setStatus(DriverTask.TaskStatus.READY);
    task.setMessage("Get storage volumes: page " + token);
    _log.info("StorageDriver: get storage volumes information for storage system {}, token  {} - end", storageSystem.getNativeId(), token);
    // set next value
    if (token.intValue() < NUMBER_OF_VOLUME_PAGES - 1) {
        // each page has different consistency group
        token.setValue(token.intValue() + 1);
    // token.setValue(0); // last page
    } else {
        // last page
        token.setValue(0);
    }
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) StoragePort(com.emc.storageos.storagedriver.model.StoragePort) ArrayList(java.util.ArrayList)

Example 37 with DriverTask

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

the class StorageDriverSimulator method createVolumeSnapshot.

@Override
public DriverTask createVolumeSnapshot(List<VolumeSnapshot> snapshots, StorageCapabilities capabilities) {
    String snapTimestamp = Long.toString(System.currentTimeMillis());
    for (VolumeSnapshot snapshot : snapshots) {
        snapshot.setNativeId("snap-" + snapshot.getParentId() + UUID.randomUUID().toString());
        snapshot.setConsistencyGroup(snapTimestamp);
        snapshot.setAllocatedCapacity(1000L);
        snapshot.setProvisionedCapacity(2000L);
    }
    String taskType = "create-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);
    _log.info("StorageDriver: createVolumeSnapshot information for storage system {}, snapshots nativeIds {} - end", snapshots.get(0).getStorageSystemId(), snapshots.toString());
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) VolumeSnapshot(com.emc.storageos.storagedriver.model.VolumeSnapshot)

Example 38 with DriverTask

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

the class StorageDriverSimulator method deleteVolumeClone.

@Deprecated
public DriverTask deleteVolumeClone(VolumeClone clone) {
    String taskType = "delete-volume-clone";
    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: deleteVolumeClone for storage system %s, " + "clones nativeId %s - end", clone.getStorageSystemId(), clone.toString());
    _log.info(msg);
    task.setMessage(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Example 39 with DriverTask

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

the class StorageDriverSimulator method exportVolumesToInitiators.

@Override
public DriverTask exportVolumesToInitiators(List<Initiator> initiators, List<StorageVolume> volumes, Map<String, String> volumeToHLUMap, List<StoragePort> recommendedPorts, List<StoragePort> availablePorts, StorageCapabilities capabilities, MutableBoolean usedRecommendedPorts, List<StoragePort> selectedPorts) {
    usedRecommendedPorts.setValue(true);
    selectedPorts.addAll(recommendedPorts);
    String taskType = "export-volumes-to-initiators";
    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: exportVolumesToInitiators: export type %s, initiators %s .", initiators.get(0).getInitiatorType(), initiators.toString());
    _log.info(msg);
    task.setMessage(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

Example 40 with DriverTask

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

the class StorageDriverSimulator method createVolumes.

@Override
public DriverTask createVolumes(List<StorageVolume> volumes, StorageCapabilities capabilities) {
    // String newVolumes = "";
    Set<String> newVolumes = new HashSet<>();
    for (StorageVolume volume : volumes) {
        volume.setNativeId("driverSimulatorVolume" + UUID.randomUUID().toString());
        volume.setAccessStatus(StorageVolume.AccessStatus.READ_WRITE);
        volume.setProvisionedCapacity(volume.getRequestedCapacity());
        volume.setAllocatedCapacity(volume.getRequestedCapacity());
        volume.setDeviceLabel(volume.getNativeId());
        volume.setWwn(String.format("%s%s", volume.getStorageSystemId(), volume.getNativeId()));
        // newVolumes = newVolumes + volume.getNativeId() + " ";
        newVolumes.add(volume.getNativeId());
    }
    String taskType = "create-storage-volumes";
    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: createVolumes information for storage system %s, volume nativeIds %s - end", volumes.get(0).getStorageSystemId(), newVolumes.toString());
    _log.info(msg);
    task.setMessage(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) StorageVolume(com.emc.storageos.storagedriver.model.StorageVolume) HashSet(java.util.HashSet)

Aggregations

DriverTask (com.emc.storageos.storagedriver.DriverTask)80 BlockStorageDriver (com.emc.storageos.storagedriver.BlockStorageDriver)26 StorageVolume (com.emc.storageos.storagedriver.model.StorageVolume)26 ArrayList (java.util.ArrayList)26 ServiceError (com.emc.storageos.svcs.errorhandling.model.ServiceError)22 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)21 Volume (com.emc.storageos.db.client.model.Volume)15 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)15 IOException (java.io.IOException)15 URI (java.net.URI)15 HashMap (java.util.HashMap)13 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)10 BlockConsistencyGroup (com.emc.storageos.db.client.model.BlockConsistencyGroup)9 HashSet (java.util.HashSet)9 VolumeClone (com.emc.storageos.storagedriver.model.VolumeClone)7 VolumeSnapshot (com.emc.storageos.storagedriver.model.VolumeSnapshot)7 BlockObject (com.emc.storageos.db.client.model.BlockObject)6 BlockSnapshot (com.emc.storageos.db.client.model.BlockSnapshot)6 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)6 ExportMask (com.emc.storageos.db.client.model.ExportMask)6