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