use of com.emc.storageos.storagedriver.model.StoragePool in project coprhd-controller by CoprHD.
the class DellSCUtil method getStoragePoolFromStorageType.
/**
* Gets a StoragePool object for a storage type.
*
* @param api The Storage Center API connection.
* @param storageType The storage type.
* @param pool The StoragePool object to populate or null.
* @return The StoragePool.
*/
public StoragePool getStoragePoolFromStorageType(StorageCenterAPI api, ScStorageType storageType, StoragePool pool) {
if (pool == null) {
pool = new StoragePool();
}
pool.setNativeId(storageType.instanceId);
pool.setStorageSystemId(storageType.scSerialNumber);
LOG.info("Discovered Pool {}, storageSystem {}", pool.getNativeId(), pool.getStorageSystemId());
pool.setDeviceLabel(storageType.name);
pool.setDisplayName(storageType.name);
pool.setPoolName(storageType.name);
pool.setCapabilities(new ArrayList<>(0));
// Get the supported transport protocols
Set<StoragePool.Protocols> protocols = new HashSet<>();
List<String> transportProtocols = getSupportedProtocols(api, storageType.scSerialNumber);
if (transportProtocols.contains(Protocol.FC.toString())) {
protocols.add(StoragePool.Protocols.FC);
}
if (transportProtocols.contains(Protocol.iSCSI.toString())) {
protocols.add(StoragePool.Protocols.iSCSI);
}
pool.setProtocols(protocols);
pool.setPoolServiceType(StoragePool.PoolServiceType.block);
pool.setMaximumThickVolumeSize(0L);
pool.setMinimumThickVolumeSize(0L);
// Max 512 TB
pool.setMaximumThinVolumeSize(549755813888L);
// Min 1 GB
pool.setMinimumThinVolumeSize(1048576L);
pool.setSupportedResourceType(StoragePool.SupportedResourceType.THIN_ONLY);
ScStorageTypeStorageUsage su = api.getStorageTypeStorageUsage(storageType.instanceId);
LOG.info("Space info: {} {} {}", su.allocatedSpace, su.freeSpace, su.usedSpace);
pool.setSubscribedCapacity(SizeUtil.sizeStrToKBytes(su.usedSpace));
pool.setFreeCapacity(SizeUtil.sizeStrToKBytes(su.freeSpace));
pool.setTotalCapacity(SizeUtil.sizeStrToKBytes(su.allocatedSpace));
pool.setOperationalStatus(StoragePool.PoolOperationalStatus.READY);
return pool;
}
use of com.emc.storageos.storagedriver.model.StoragePool 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;
}
Aggregations