Search in sources :

Example 61 with DriverTask

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

the class StorageDriverSimulator method discoverStoragePools.

@Override
public DriverTask discoverStoragePools(StorageSystem storageSystem, List<StoragePool> storagePools) {
    _log.info("Discovery of storage pools for storage system {} .", storageSystem.getNativeId());
    String taskType = "discover-storage-pools";
    String taskId = String.format("%s+%s+%s", DRIVER_NAME, taskType, UUID.randomUUID().toString());
    DriverTask task = new DriverSimulatorTask(taskId);
    AutoTieringPolicyCapabilityDefinition capabilityDefinition = new AutoTieringPolicyCapabilityDefinition();
    try {
        // Get connection information.
        Map<String, List<String>> connectionInfo = driverRegistry.getDriverAttributesForKey("StorageDriverSimulator", storageSystem.getNativeId());
        _log.info("Storage system connection info: {} : {}", storageSystem.getNativeId(), connectionInfo);
        for (int i = 0; i <= 2; i++) {
            StoragePool pool = new StoragePool();
            pool.setNativeId("pool-1234577-" + i + storageSystem.getNativeId());
            pool.setStorageSystemId(storageSystem.getNativeId());
            _log.info("Discovered Pool {}, storageSystem {}", pool.getNativeId(), pool.getStorageSystemId());
            pool.setDeviceLabel("er-pool-1234577" + i + storageSystem.getNativeId());
            pool.setPoolName(pool.getDeviceLabel());
            Set<StoragePool.Protocols> protocols = new HashSet<>();
            protocols.add(StoragePool.Protocols.FC);
            protocols.add(StoragePool.Protocols.iSCSI);
            // protocols.add(StoragePool.Protocols.ScaleIO);
            pool.setProtocols(protocols);
            pool.setPoolServiceType(StoragePool.PoolServiceType.block);
            pool.setMaximumThickVolumeSize(3000000L);
            pool.setMinimumThickVolumeSize(1000L);
            pool.setMaximumThinVolumeSize(5000000L);
            pool.setMinimumThinVolumeSize(1000L);
            if (i % 2 == 0) {
                pool.setSupportedResourceType(StoragePool.SupportedResourceType.THIN_ONLY);
            } else {
                pool.setSupportedResourceType(StoragePool.SupportedResourceType.THICK_ONLY);
            }
            pool.setSubscribedCapacity(5000000L);
            pool.setFreeCapacity(45000000L);
            pool.setTotalCapacity(48000000L);
            pool.setOperationalStatus(StoragePool.PoolOperationalStatus.READY);
            Set<StoragePool.SupportedDriveTypes> supportedDriveTypes = new HashSet<>();
            supportedDriveTypes.add(StoragePool.SupportedDriveTypes.FC);
            supportedDriveTypes.add(StoragePool.SupportedDriveTypes.SATA);
            pool.setSupportedDriveTypes(supportedDriveTypes);
            // Set<StoragePool.RaidLevels> raidLevels = new HashSet<>();
            // raidLevels.add(StoragePool.RaidLevels.RAID5);
            // raidLevels.add(StoragePool.RaidLevels.RAID6);
            // pool.setSupportedRaidLevels(raidLevels);
            List<CapabilityInstance> capabilities = new ArrayList<>();
            for (int j = 1; j <= 2; j++) {
                String policyId = "Auto-Tier-Policy-" + i + j;
                Map<String, List<String>> props = new HashMap<>();
                props.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.POLICY_ID.name(), Arrays.asList(policyId));
                String provisioningType;
                if (i % 2 == 0) {
                    provisioningType = StoragePool.AutoTieringPolicyProvisioningType.ThinlyProvisioned.name();
                } else {
                    provisioningType = StoragePool.AutoTieringPolicyProvisioningType.ThicklyProvisioned.name();
                }
                props.put(AutoTieringPolicyCapabilityDefinition.PROPERTY_NAME.PROVISIONING_TYPE.name(), Arrays.asList(provisioningType));
                CapabilityInstance capabilityInstance = new CapabilityInstance(capabilityDefinition.getId(), policyId, props);
                capabilities.add(capabilityInstance);
            }
            pool.setCapabilities(capabilities);
            storagePools.add(pool);
        }
        task.setStatus(DriverTask.TaskStatus.READY);
        _log.info("StorageDriver: discoverStoragePools information for storage system {}, nativeId {} - end", storageSystem.getIpAddress(), storageSystem.getNativeId());
    } catch (Exception e) {
        task.setStatus(DriverTask.TaskStatus.FAILED);
        e.printStackTrace();
    }
    return task;
}
Also used : StoragePool(com.emc.storageos.storagedriver.model.StoragePool) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) BeansException(org.springframework.beans.BeansException) DriverTask(com.emc.storageos.storagedriver.DriverTask) CapabilityInstance(com.emc.storageos.storagedriver.storagecapabilities.CapabilityInstance) ArrayList(java.util.ArrayList) List(java.util.List) AutoTieringPolicyCapabilityDefinition(com.emc.storageos.storagedriver.storagecapabilities.AutoTieringPolicyCapabilityDefinition) HashSet(java.util.HashSet)

Example 62 with DriverTask

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

the class StorageDriverSimulator method detachVolumeClone.

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

Example 63 with DriverTask

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

the class StorageDriverSimulator method expandVolume.

@Override
public DriverTask expandVolume(StorageVolume volume, long newCapacity) {
    ExpandVolumeSimulatorOperation expandVolumeSimulatorOperation = new ExpandVolumeSimulatorOperation(volume, newCapacity);
    if (simulatorConfig.getSimulateAsynchronousResponses()) {
        DriverTask driverTask = expandVolumeSimulatorOperation.getDriverTask();
        taskOperationMap.put(driverTask.getTaskId(), expandVolumeSimulatorOperation);
        return driverTask;
    } else if (simulatorConfig.getSimulateFailures()) {
        String failMsg = expandVolumeSimulatorOperation.getFailureMessage();
        return expandVolumeSimulatorOperation.doFailure(failMsg);
    } else {
        expandVolumeSimulatorOperation.updateVolumeInfo(volume, newCapacity);
        String successMsg = expandVolumeSimulatorOperation.getSuccessMessage(volume);
        return expandVolumeSimulatorOperation.doSuccess(successMsg);
    }
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask) ExpandVolumeSimulatorOperation(com.emc.storageos.driver.driversimulator.operations.ExpandVolumeSimulatorOperation)

Example 64 with DriverTask

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

the class StorageDriverSimulator method createConsistencyGroupSnapshot.

@Override
public DriverTask createConsistencyGroupSnapshot(VolumeConsistencyGroup consistencyGroup, List<VolumeSnapshot> snapshots, List<CapabilityInstance> capabilities) {
    String snapTimestamp = Long.toString(System.currentTimeMillis());
    for (VolumeSnapshot snapshot : snapshots) {
        snapshot.setNativeId("snap-" + snapshot.getParentId() + consistencyGroup.getDisplayName() + UUID.randomUUID().toString());
        snapshot.setConsistencyGroup(snapTimestamp);
        snapshot.setSnapSetId(snapTimestamp);
    }
    String taskType = "create-group-snapshot";
    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("Created snapshots for consistency group " + snapshots.get(0).getConsistencyGroup());
    _log.info("StorageDriver: createGroupSnapshot 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 65 with DriverTask

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

the class StorageDriverSimulator method addVolumesToConsistencyGroup.

@Override
public DriverTask addVolumesToConsistencyGroup(List<StorageVolume> volumes, StorageCapabilities capabilities) {
    _log.info("Adding {} Volumes to Consistency Group {}", volumes.toString(), volumes.get(0).getConsistencyGroup());
    String taskType = "add-volumes-to-consistency-groupd";
    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: addVolumesToConsistencyGroup information for storage system %s, volume nativeIds %s, Consistency Group - end", volumes.get(0).getStorageSystemId(), volumes.toString());
    _log.info(msg);
    task.setMessage(msg);
    return task;
}
Also used : DriverTask(com.emc.storageos.storagedriver.DriverTask)

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