use of com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType in project coprhd-controller by CoprHD.
the class StorageCenterAPI method getStorageTypes.
/**
* Get all storage types from the system.
*
* @param ssn The Storage Center system serial number.
* @return The storage types.
*/
public ScStorageType[] getStorageTypes(String ssn) {
PayloadFilter filter = new PayloadFilter();
if (ssn != null) {
filter.append("scSerialNumber", ssn);
}
RestResult rr = restClient.post("StorageCenter/ScStorageType/GetList", filter.toJson());
if (checkResults(rr)) {
return gson.fromJson(rr.getResult(), ScStorageType[].class);
}
return new ScStorageType[0];
}
use of com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType in project coprhd-controller by CoprHD.
the class DellSCDiscovery method discoverStoragePools.
/**
* Discover storage pools and their capabilities.
*
* @param storageSystem The storage system on which to discover.
* @param storagePools The storage pools.
* @return The discovery task.
*/
public DriverTask discoverStoragePools(StorageSystem storageSystem, List<StoragePool> storagePools) {
LOG.info("Discovering storage pools for [{}] {} {}", storageSystem.getSystemName(), storageSystem.getIpAddress(), storageSystem.getNativeId());
DellSCDriverTask task = new DellSCDriverTask("discoverStoragePools");
try {
StorageCenterAPI api = connectionManager.getConnection(storageSystem.getNativeId());
ScStorageType[] storageTypes = api.getStorageTypes(storageSystem.getNativeId());
for (ScStorageType storageType : storageTypes) {
storagePools.add(util.getStoragePoolFromStorageType(api, storageType, null));
}
task.setStatus(DriverTask.TaskStatus.READY);
} catch (Exception e) {
String failureMessage = String.format("Error getting pool information: %s", e);
task.setFailed(failureMessage);
LOG.warn(failureMessage);
}
return task;
}
use of com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType in project coprhd-controller by CoprHD.
the class StorageCenterAPI method createVolume.
/**
* Creates a volume on the Storage Center.
*
* @param ssn The Storage Center SN on which to create the volume.
* @param name The volume name.
* @param storageType The storage type to use.
* @param sizeInGB The size in GB
* @param cgID The consistency group ID to add volume to or null.
* @return The Storage Center volume.
* @throws StorageCenterAPIException
*/
public ScVolume createVolume(String ssn, String name, String storageType, int sizeInGB, String cgID) throws StorageCenterAPIException {
LOG.debug("Creating {}GB volume: '{}'", sizeInGB, name);
String errorMessage = "";
Parameters params = new Parameters();
params.add("Name", name);
params.add("Notes", NOTES_STRING);
params.add("Size", String.format("%d MB", sizeInGB));
params.add("StorageCenter", ssn);
if (cgID != null && !cgID.isEmpty()) {
String[] ids = { cgID };
params.add("ReplayProfileList", ids);
}
ScStorageType[] storageTypes = getStorageTypes(ssn);
for (ScStorageType storType : storageTypes) {
if (storType.name.equals(storageType)) {
params.add("StorageType", storType.instanceId);
break;
}
}
try {
RestResult result = restClient.post("StorageCenter/ScVolume", params.toJson());
if (checkResults(result)) {
return gson.fromJson(result.getResult(), ScVolume.class);
}
} catch (Exception e) {
errorMessage = String.format("Error creating volume: %s", e);
LOG.warn(errorMessage);
}
if (errorMessage.length() == 0) {
errorMessage = String.format("Unable to create volume %s on SC %s", name, ssn);
}
throw new StorageCenterAPIException(errorMessage);
}
Aggregations