use of com.emc.storageos.cinder.model.VolumeTypesRestResp in project coprhd-controller by CoprHD.
the class TypeService method getVolumeTypes.
/**
* Get volume types
*
* @prereq none
*
* @param tenant_id the URN of the tenant
*
* @brief List volume types
* @return Volume types list
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getVolumeTypes(@PathParam("tenant_id") URI openstack_tenant_id, @Context HttpHeaders header) {
// Here we ignore the openstack tenant id
_log.info("START get list of volume types");
VolumeTypesRestResp types = new VolumeTypesRestResp();
StorageOSUser user = getUserFromContext();
URI tenantId = URI.create(user.getTenantId());
List<URI> vpools = _dbClient.queryByType(VirtualPool.class, true);
for (URI vpool : vpools) {
VirtualPool pool = _dbClient.queryObject(VirtualPool.class, vpool);
_log.debug("Looking up vpool {}", pool.getLabel());
if (pool != null && pool.getType().equalsIgnoreCase(VirtualPool.Type.block.name())) {
if (_permissionsHelper.tenantHasUsageACL(tenantId, pool)) {
_log.debug("Adding vpool {}", pool.getLabel());
VolumeType type = new VolumeType();
type.id = pool.getId().toString();
type.name = pool.getLabel();
type.extra_specs = new HashMap<String, String>();
types.getVolume_types().add(type);
}
}
}
_log.info("END get list of volume types");
return CinderApiUtils.getCinderResponse(types, header, false, CinderConstants.STATUS_OK);
}
Aggregations