use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class GlusterBrickValidatorTest method getDistributedVolume.
private GlusterVolumeEntity getDistributedVolume(Guid volumeId, int brickCount) {
GlusterVolumeEntity volumeEntity = new GlusterVolumeEntity();
volumeEntity.setId(volumeId);
volumeEntity.setName("test-vol");
volumeEntity.addAccessProtocol(AccessProtocol.GLUSTER);
volumeEntity.addTransportType(TransportType.TCP);
volumeEntity.setVolumeType(GlusterVolumeType.DISTRIBUTE);
volumeEntity.setBricks(getBricks(volumeId, brickCount));
return volumeEntity;
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity 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.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method remove.
@Override
public Response remove(Action action) {
GlusterBricks bricks = action.getBricks();
if (bricks.getGlusterBricks().size() > 0) {
for (GlusterBrick brick : bricks.getGlusterBricks()) {
validateParameters(brick, "id|name");
}
}
int replicaCount = ParametersHelper.getIntegerParameter(httpHeaders, uriInfo, REPLICA_COUNT, 0, 0);
GlusterVolumeRemoveBricksParameters params = toParameters(bricks);
params.setReplicaCount(replicaCount);
GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), "");
if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) {
return performAction(ActionType.CommitRemoveGlusterVolumeBricks, params);
} else {
return performAction(ActionType.GlusterVolumeRemoveBricks, params);
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method activate.
@Override
public Response activate(Action action) {
validateParameters(action, "bricks");
validateBrickNames(action);
GlusterVolumeEntity volume = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(asGuid(getVolumeId())), "");
if (volume.getAsyncTask() != null && volume.getAsyncTask().getType() == GlusterTaskType.REMOVE_BRICK && volume.getAsyncTask().getStatus() == JobExecutionStatus.FINISHED) {
return stopMigrate(action);
} else {
Fault fault = new Fault();
fault.setReason(localize(Messages.CANNOT_ACTIVATE_UNLESS_MIGRATION_COMPLETED));
throw new WebApplicationException(Response.status(Response.Status.CONFLICT).entity(fault).build());
}
}
use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.
the class BackendGlusterBricksResource method populateAdvancedDetails.
protected GlusterBrick populateAdvancedDetails(GlusterBrick model, GlusterBrickEntity entity) {
GlusterVolumeEntity volumeEntity = getEntity(GlusterVolumeEntity.class, QueryType.GetGlusterVolumeById, new IdQueryParameters(entity.getVolumeId()), null, true);
GlusterVolumeAdvancedDetails detailsEntity = getEntity(GlusterVolumeAdvancedDetails.class, QueryType.GetGlusterVolumeAdvancedDetails, new GlusterVolumeAdvancedDetailsParameters(volumeEntity.getClusterId(), volumeEntity.getId(), entity.getId(), true), null, true);
model = getMapper(GlusterVolumeAdvancedDetails.class, GlusterBrick.class).map(detailsEntity, model);
return model;
}
Aggregations