/** * Create a snapshot of the volume * * @param volId The volume ID * @param snapshotName The snapshot name * @param systemId * @return * @throws Exception */ public ScaleIOSnapshotVolumeResponse snapshotVolume( String volId, String snapshotName, String systemId) throws Exception { String uri = ScaleIOConstants.getSnapshotVolumesURI(systemId); ScaleIOSnapshotVolumes spVol = new ScaleIOSnapshotVolumes(); spVol.addSnapshot(volId, snapshotName); ClientResponse response = post(URI.create(uri), getJsonForEntity(spVol)); return getResponseObject(ScaleIOSnapshotVolumeResponse.class, response); }
/** * Create multiple snapshots in a consistency group * * @param id2snapshot Volume ID to snapshotName map * @param systemId The system ID * @return The result of the snapshots created * @throws Exception */ public ScaleIOSnapshotVolumeResponse snapshotMultiVolume( Map<String, String> id2snapshot, String systemId) throws Exception { String uri = ScaleIOConstants.getSnapshotVolumesURI(systemId); ScaleIOSnapshotVolumes spVol = new ScaleIOSnapshotVolumes(); for (Map.Entry<String, String> entry : id2snapshot.entrySet()) { spVol.addSnapshot(entry.getKey(), entry.getValue()); } ClientResponse response = post(URI.create(uri), getJsonForEntity(spVol)); return getResponseObject(ScaleIOSnapshotVolumeResponse.class, response); }