Search in sources :

Example 11 with RestResult

use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.

the class StorageCenterAPI method getConsistencyGroupVolumes.

/**
 * Gets the volumes that are part of a consistency group.
 *
 * @param instanceId The CG ID.
 * @return The volumes.
 * @throws StorageCenterAPIException
 */
public ScVolume[] getConsistencyGroupVolumes(String instanceId) throws StorageCenterAPIException {
    LOG.debug("Getting volume for consistency group {}", instanceId);
    RestResult rr = restClient.get(String.format("StorageCenter/ScReplayProfile/%s/VolumeList", instanceId));
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScVolume[].class);
    }
    throw new StorageCenterAPIException(rr.getErrorMsg());
}
Also used : ScVolume(com.emc.storageos.driver.dellsc.scapi.objects.ScVolume) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 12 with RestResult

use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.

the class StorageCenterAPI method deleteConsistencyGroup.

/**
 * Deletes a consistency group.
 *
 * @param instanceId The replay profile instance ID.
 * @throws StorageCenterAPIException
 */
public void deleteConsistencyGroup(String instanceId) throws StorageCenterAPIException {
    LOG.debug("Deleting consistency group '{}'", instanceId);
    RestResult rr = restClient.delete(String.format("StorageCenter/ScReplayProfile/%s", instanceId));
    if (!checkResults(rr)) {
        String msg = String.format("Error deleting CG %s: %s", instanceId, rr.getErrorMsg());
        LOG.error(msg);
        throw new StorageCenterAPIException(msg);
    }
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 13 with RestResult

use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.

the class StorageCenterAPI method deleteVolume.

/**
 * Delete a volume.
 *
 * If the volume can't be found we return success assuming the volume has been deleted
 * by some other means.
 *
 * @param instanceId the instance id of the volume.
 * @throws StorageCenterAPIException if error encountered deleting the volume.
 */
public void deleteVolume(String instanceId) throws StorageCenterAPIException {
    ScVolume vol = getVolume(instanceId);
    if (vol == null) {
        LOG.warn("Volume delete request for {}, volume not found. Assuming deleted.", instanceId);
        return;
    }
    RestResult rr = restClient.delete(String.format("StorageCenter/ScVolume/%s", instanceId));
    if (!checkResults(rr)) {
        String msg = String.format("Error deleting volume %s", instanceId);
        LOG.error(msg);
        throw new StorageCenterAPIException(msg);
    }
}
Also used : ScVolume(com.emc.storageos.driver.dellsc.scapi.objects.ScVolume) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult)

Example 14 with RestResult

use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.

the class StorageCenterAPI method findReplayView.

/**
 * Finds a view volume for a given replay.
 *
 * @param instanceId The replay instance ID.
 * @return The volume or null if not found.
 */
public ScVolume findReplayView(String instanceId) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("notes", instanceId);
    RestResult rr = restClient.post("StorageCenter/ScVolumeConfiguration/GetList", filter.toJson());
    if (checkResults(rr)) {
        ScVolumeConfiguration[] config = gson.fromJson(rr.getResult(), ScVolumeConfiguration[].class);
        rr = restClient.get(String.format("StorageCenter/ScVolume/%s", config[0].volume.instanceId));
        if (checkResults(rr)) {
            return gson.fromJson(rr.getResult(), ScVolume.class);
        } else {
            LOG.warn(rr.getErrorMsg());
        }
    } else {
        LOG.warn(rr.getErrorMsg());
    }
    return null;
}
Also used : ScVolumeConfiguration(com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeConfiguration) RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)

Example 15 with RestResult

use of com.emc.storageos.driver.dellsc.scapi.rest.RestResult in project coprhd-controller by CoprHD.

the class StorageCenterAPI method getServerHbas.

/**
 * Gets all defined HBAs for a server definition.
 *
 * @param ssn The Storage Center serial number.
 * @param serverInstanceId The server definition.
 * @return The HBAs.
 */
public ScServerHba[] getServerHbas(String ssn, String serverInstanceId) {
    PayloadFilter filter = new PayloadFilter();
    filter.append("scSerialNumber", ssn);
    filter.append("Server", serverInstanceId);
    RestResult rr = restClient.post("StorageCenter/ScServerHba/GetList", filter.toJson());
    if (checkResults(rr)) {
        return gson.fromJson(rr.getResult(), ScServerHba[].class);
    }
    return new ScServerHba[0];
}
Also used : RestResult(com.emc.storageos.driver.dellsc.scapi.rest.RestResult) PayloadFilter(com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter) ScServerHba(com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)

Aggregations

RestResult (com.emc.storageos.driver.dellsc.scapi.rest.RestResult)44 Parameters (com.emc.storageos.driver.dellsc.scapi.rest.Parameters)16 PayloadFilter (com.emc.storageos.driver.dellsc.scapi.rest.PayloadFilter)12 ScVolume (com.emc.storageos.driver.dellsc.scapi.objects.ScVolume)4 ScServerHba (com.emc.storageos.driver.dellsc.scapi.objects.ScServerHba)3 ScVolumeConfiguration (com.emc.storageos.driver.dellsc.scapi.objects.ScVolumeConfiguration)3 ArrayList (java.util.ArrayList)3 ScControllerPort (com.emc.storageos.driver.dellsc.scapi.objects.ScControllerPort)2 ScMapping (com.emc.storageos.driver.dellsc.scapi.objects.ScMapping)2 ScMappingProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScMappingProfile)2 ScObject (com.emc.storageos.driver.dellsc.scapi.objects.ScObject)2 ScReplay (com.emc.storageos.driver.dellsc.scapi.objects.ScReplay)2 ScServer (com.emc.storageos.driver.dellsc.scapi.objects.ScServer)2 ScStorageType (com.emc.storageos.driver.dellsc.scapi.objects.ScStorageType)2 ScFaultDomain (com.emc.storageos.driver.dellsc.scapi.objects.ScFaultDomain)1 ScReplayConsistencyGroup (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayConsistencyGroup)1 ScReplayProfile (com.emc.storageos.driver.dellsc.scapi.objects.ScReplayProfile)1 ScServerOperatingSystem (com.emc.storageos.driver.dellsc.scapi.objects.ScServerOperatingSystem)1