Search in sources :

Example 1 with ScStorageType

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];
}
Also used : ScStorageType(com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)

Example 2 with ScStorageType

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;
}
Also used : StorageCenterAPI(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI) ScStorageType(com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType) DellSCDriverTask(com.emc.storageos.driver.dellsc.DellSCDriverTask) DellSCDriverException(com.emc.storageos.driver.dellsc.DellSCDriverException) StorageCenterAPIException(com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)

Example 3 with ScStorageType

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);
}
Also used : ScStorageType(com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType) Parameters(com.emc.storageos.driver.dellsc.scapi.rest.Parameters) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Aggregations

ScStorageType (com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType)3 RestResult (com.emc.storageos.driver.dellsc.scapi.rest.RestResult)2 DellSCDriverException (com.emc.storageos.driver.dellsc.DellSCDriverException)1 DellSCDriverTask (com.emc.storageos.driver.dellsc.DellSCDriverTask)1 StorageCenterAPI (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPI)1 StorageCenterAPIException (com.emc.storageos.driver.dellsc.scapi.StorageCenterAPIException)1 Parameters (com.emc.storageos.driver.dellsc.scapi.rest.Parameters)1 PayloadFilter (com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)1