use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class BackendGlusterBrickResource method getStatisticsResource.
@Override
public StatisticsResource getStatisticsResource() {
EntityIdResolver<Guid> resolver = new QueryIdResolver<Guid>(QueryType.GetGlusterBrickById, IdQueryParameters.class) {
@Override
public GlusterBrickEntity lookupEntity(Guid id) throws BackendFailureException {
GlusterBrickEntity brickEntity = getEntity(GlusterBrickEntity.class, QueryType.GetGlusterBrickById, new IdQueryParameters(id), null, true);
GlusterVolumeEntity volumeEntity = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(brickEntity.getVolumeId()), null, true);
GlusterVolumeAdvancedDetails detailsEntity = getEntity(GlusterVolumeAdvancedDetails.class, QueryType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsParameters(volumeEntity.getClusterId(), volumeEntity.getId(), brickEntity.getId(), true), null, true);
brickEntity.setBrickDetails(detailsEntity.getBrickDetails().get(0));
return brickEntity;
}
};
BrickStatisticalQuery query = new BrickStatisticalQuery(resolver, newModel(id));
return inject(new BackendStatisticsResource<>(GlusterBrickEntity.class, guid, query));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method add.
@Override
public Response add(GlusterBricks bricks) {
for (GlusterBrick brick : bricks.getGlusterBricks()) {
validateParameters(brick, "serverId", "brickDir");
}
List<GlusterBrickEntity> brickEntities = mapBricks(asGuid(getVolumeId()), bricks);
int replicaCount = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, REPLICA_COUNT, 0, 0);
int stripeCount = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, STRIPE_COUNT, 0, 0);
return performCreationMultiple(ActionType.AddBricksToGlusterVolume, new GlusterVolumeBricksActionParameters(asGuid(getVolumeId()), brickEntities, replicaCount, stripeCount, isForce()), new QueryIdResolver<>(QueryType.GetGlusterBrickById, IdQueryParameters.class));
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method mapBricks.
private List<GlusterBrickEntity> mapBricks(Guid volumeId, GlusterBricks glusterBricks) {
List<GlusterBrickEntity> bricks = new ArrayList<>();
if (glusterBricks.getGlusterBricks().size() > 0) {
for (GlusterBrick brick : glusterBricks.getGlusterBricks()) {
GlusterBrickEntity brickEntity = getMapper(GlusterBrick.class, GlusterBrickEntity.class).map(brick, null);
brickEntity.setVolumeId(volumeId);
bricks.add(brickEntity);
}
}
return bricks;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class BackendGlusterVolumesResource method mapBricks.
private void mapBricks(GlusterVolume volume, GlusterVolumeEntity volumeEntity) {
List<GlusterBrickEntity> bricks = new ArrayList<>();
for (GlusterBrick brick : volume.getBricks().getGlusterBricks()) {
bricks.add(getMapper(GlusterBrick.class, GlusterBrickEntity.class).map(brick, null));
}
volumeEntity.setBricks(bricks);
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity in project ovirt-engine by oVirt.
the class GlusterVolumeGeoRepStatus method getSessionDetails.
protected GlusterGeoRepSessionDetails getSessionDetails(Map<String, Object> innerMap) {
GlusterGeoRepSessionDetails details = new GlusterGeoRepSessionDetails();
Guid masterNodeGlusterId;
if (innerMap.containsKey(HOST_UUID)) {
masterNodeGlusterId = new Guid(innerMap.get(HOST_UUID).toString());
} else {
log.error("Master node uuid is not available");
return null;
}
String masterBrickDir = innerMap.containsKey(BRICK_NAME) ? innerMap.get(BRICK_NAME).toString() : null;
GlusterServer glusterServer = getDbUtils().getServerByUuid(masterNodeGlusterId);
if (glusterServer != null) {
GlusterBrickEntity brick = getDbUtils().getGlusterBrickByServerUuidAndBrickDir(glusterServer.getId(), masterBrickDir);
if (brick != null) {
details.setMasterBrickId(brick.getId());
}
}
if (details.getMasterBrickId() == null) {
log.error("Brick information could not be retrieved for gluster host id {} and brick dir {}", masterNodeGlusterId, masterBrickDir);
}
String slave = innerMap.containsKey(REMOTE_HOST) ? innerMap.get(REMOTE_HOST).toString() : null;
details.setSlaveHostName(slave);
details.setStatus(GeoRepSessionStatus.from((String) innerMap.get(STATUS)));
details.setCrawlStatus(GeoRepCrawlStatus.from((String) innerMap.get(CRAWL_STATUS)));
details.setCheckPointStatus((String) innerMap.get(CHECK_POINT_STATUS));
return details;
}
Aggregations