Search in sources :

Example 1 with CinderVolume

use of com.emc.storageos.cinder.model.CinderVolume 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);
}
Also used : CinderVolume(com.emc.storageos.cinder.model.CinderVolume) CinderVolume(com.emc.storageos.cinder.model.CinderVolume) Volume(com.emc.storageos.db.client.model.Volume) VolumesRestResp(com.emc.storageos.cinder.model.VolumesRestResp) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) CheckPermission(com.emc.storageos.security.authorization.CheckPermission)

Aggregations

CinderVolume (com.emc.storageos.cinder.model.CinderVolume)1 VolumesRestResp (com.emc.storageos.cinder.model.VolumesRestResp)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 Volume (com.emc.storageos.db.client.model.Volume)1 CheckPermission (com.emc.storageos.security.authorization.CheckPermission)1 URI (java.net.URI)1 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1