use of com.emc.storageos.driver.dellsc.scapi.objects.ScObject in project coprhd-controller by CoprHD.
the class StorageCenterAPI method removeVolumeFromConsistencyGroup.
/**
* Removes a volume from a consistency group.
*
* @param instanceId The volume instance ID.
* @param cgID The consistency group ID.
* @throws StorageCenterAPIException
*/
public void removeVolumeFromConsistencyGroup(String instanceId, String cgID) throws StorageCenterAPIException {
RestResult rr = restClient.get(String.format("StorageCenter/ScVolumeConfiguration/%s", instanceId));
if (!checkResults(rr)) {
throw new StorageCenterAPIException(String.format("Error getting volume configuration: %s", rr.getErrorMsg()));
}
ScVolumeConfiguration volConfig = gson.fromJson(rr.getResult(), ScVolumeConfiguration.class);
List<String> profiles = new ArrayList<>();
for (ScObject profile : volConfig.replayProfileList) {
if (!cgID.equals(profile.instanceId)) {
profiles.add(profile.instanceId);
}
}
Parameters params = new Parameters();
params.add("ReplayProfileList", profiles.toArray(new String[0]));
rr = restClient.put(String.format("StorageCenter/ScVolumeConfiguration/%s", instanceId), params.toJson());
if (!checkResults(rr)) {
throw new StorageCenterAPIException(String.format("Error updating volume replay profile membership: %s", rr.getErrorMsg()));
}
}
use of com.emc.storageos.driver.dellsc.scapi.objects.ScObject in project coprhd-controller by CoprHD.
the class StorageCenterAPI method addVolumeToConsistencyGroup.
/**
* Adds a volume to a consistency group.
*
* @param instanceId The volume instance ID.
* @param cgID The consistency group ID.
* @throws StorageCenterAPIException
*/
public void addVolumeToConsistencyGroup(String instanceId, String cgID) throws StorageCenterAPIException {
RestResult rr = restClient.get(String.format("StorageCenter/ScVolumeConfiguration/%s", instanceId));
if (!checkResults(rr)) {
throw new StorageCenterAPIException(String.format("Error getting volume configuration: %s", rr.getErrorMsg()));
}
ScVolumeConfiguration volConfig = gson.fromJson(rr.getResult(), ScVolumeConfiguration.class);
List<String> profiles = new ArrayList<>();
for (ScObject profile : volConfig.replayProfileList) {
if (!cgID.equals(profile.instanceId)) {
profiles.add(profile.instanceId);
}
}
profiles.add(cgID);
Parameters params = new Parameters();
params.add("ReplayProfileList", profiles.toArray(new String[0]));
rr = restClient.put(String.format("StorageCenter/ScVolumeConfiguration/%s", instanceId), params.toJson());
if (!checkResults(rr)) {
throw new StorageCenterAPIException(String.format("Error updating volume replay profile membership: %s", rr.getErrorMsg()));
}
}
Aggregations