Search in sources :

Example 1 with GlusterVolumeBricksActionParameters

use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters 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));
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 2 with GlusterVolumeBricksActionParameters

use of org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters in project ovirt-engine by oVirt.

the class VolumeBrickListModel method onAddBricksInternal.

private void onAddBricksInternal() {
    cancelConfirmation();
    VolumeBrickModel volumeBrickModel = (VolumeBrickModel) getWindow();
    GlusterVolumeEntity volumeEntity = getEntity();
    ArrayList<GlusterBrickEntity> brickList = new ArrayList<>();
    for (Object model : volumeBrickModel.getBricks().getItems()) {
        GlusterBrickEntity brickEntity = (GlusterBrickEntity) ((EntityModel) model).getEntity();
        brickEntity.setVolumeId(volumeEntity.getId());
        brickList.add(brickEntity);
    }
    volumeBrickModel.startProgress();
    GlusterVolumeBricksActionParameters parameter = new GlusterVolumeBricksActionParameters(volumeEntity.getId(), brickList, volumeBrickModel.getReplicaCountValue(), volumeBrickModel.getStripeCountValue(), volumeBrickModel.getForce().getEntity());
    Frontend.getInstance().runAction(ActionType.AddBricksToGlusterVolume, parameter, result -> {
        VolumeBrickListModel localModel = (VolumeBrickListModel) result.getState();
        localModel.postOnAddBricks(result.getReturnValue());
    }, this);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList)

Aggregations

GlusterVolumeBricksActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 ArrayList (java.util.ArrayList)1 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1