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