use of org.ovirt.engine.api.model.GlusterBrick in project ovirt-engine by oVirt.
the class BackendGlusterBrickResource method remove.
@Override
public Response remove() {
get();
GlusterBrick brick = new GlusterBrick();
brick.setId(id);
GlusterBricks bricks = new GlusterBricks();
bricks.getGlusterBricks().add(brick);
Action action = new Action();
action.setBricks(bricks);
return parent.remove(action);
}
use of org.ovirt.engine.api.model.GlusterBrick 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.api.model.GlusterBrick 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.api.model.GlusterBrick 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.api.model.GlusterBrick 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);
}
Aggregations