Search in sources :

Example 1 with VolumeDetails

use of com.emc.storageos.cinder.model.VolumeDetails in project coprhd-controller by CoprHD.

the class VolumeService method getDetailedVolumeList.

/**
 * Get the detailed list of all volumes for the given tenant
 *
 * @prereq none
 *
 * @param tenant_id the URN of the tenant
 *
 * @brief List volumes in detail
 * @return Volume detailed list
 */
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
@Path("/detail")
@CheckPermission(roles = { Role.SYSTEM_MONITOR, Role.TENANT_ADMIN }, acls = { ACL.ANY })
public Response getDetailedVolumeList(@PathParam("tenant_id") String openstackTenantId, @HeaderParam("X-Cinder-V1-Call") String isV1Call, @Context HttpHeaders header) {
    _log.debug("START get detailed volume list");
    URIQueryResultList uris = getVolumeUris(openstackTenantId);
    // convert to detailed format
    VolumeDetails volumeDetails = new VolumeDetails();
    if (uris != null) {
        for (URI volumeUri : uris) {
            Volume vol = _dbClient.queryObject(Volume.class, volumeUri);
            if (vol != null && !vol.getInactive()) {
                VolumeDetail volumeDetail = getVolumeDetail(vol, isV1Call, openstackTenantId);
                volumeDetails.getVolumes().add(volumeDetail);
            }
        }
    }
    return CinderApiUtils.getCinderResponse(volumeDetails, header, false, STATUS_OK);
}
Also used : CinderVolume(com.emc.storageos.cinder.model.CinderVolume) Volume(com.emc.storageos.db.client.model.Volume) VolumeDetail(com.emc.storageos.cinder.model.VolumeDetail) VolumeDetails(com.emc.storageos.cinder.model.VolumeDetails) URI(java.net.URI) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Path(javax.ws.rs.Path) 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 VolumeDetail (com.emc.storageos.cinder.model.VolumeDetail)1 VolumeDetails (com.emc.storageos.cinder.model.VolumeDetails)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 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1