use of com.emc.storageos.cinder.model.VolumesRestResp in project coprhd-controller by CoprHD.
the class VolumeService method getVolumeList.
/**
* Get the summary list of all volumes for the given tenant
*
* @prereq none
*
* @param tenant_id the URN of the tenant
*
* @brief List volumes
* @return Volume list
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public Response getVolumeList(@PathParam("tenant_id") String openstackTenantId, @HeaderParam("X-Cinder-V1-Call") String isV1Call, @Context HttpHeaders header) {
VolumesRestResp volumes = new VolumesRestResp();
URIQueryResultList uris = getVolumeUris(openstackTenantId);
if (uris != null) {
while (uris.iterator().hasNext()) {
URI volumeUri = uris.iterator().next();
Volume volume = _dbClient.queryObject(Volume.class, volumeUri);
if (volume != null && !volume.getInactive()) {
CinderVolume cinder_volume = new CinderVolume();
cinder_volume.id = getCinderHelper().trimId(volume.getId().toString());
cinder_volume.setLink(DbObjectMapper.toLink(volume));
cinder_volume.name = volume.getLabel();
volumes.getVolumes().add(cinder_volume);
}
}
}
return CinderApiUtils.getCinderResponse(volumes, header, false, STATUS_OK);
}
Aggregations