Search in sources :

Example 6 with GlusterVolumeRemoveBricksParameters

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

the class VolumeBrickListModel method onStopRemoveBricks.

private void onStopRemoveBricks() {
    if (getConfirmWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    GlusterVolumeEntity volumeEntity = getVolumeEntity();
    ArrayList<GlusterBrickEntity> list = new ArrayList<>();
    for (Object brickName : model.getItems()) {
        GlusterBrickEntity brick = volumeEntity.getBrickWithQualifiedName((String) brickName);
        if (brick != null) {
            list.add(brick);
        }
    }
    GlusterVolumeRemoveBricksParameters parameter = new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), list);
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.StopRemoveGlusterVolumeBricks, parameter, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        setConfirmWindow(null);
        if (result.getReturnValue().getSucceeded()) {
            showRemoveBricksStatus();
        }
    }, model);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)

Example 7 with GlusterVolumeRemoveBricksParameters

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

the class BackendGlusterBricksResource method toParameters.

private GlusterVolumeRemoveBricksParameters toParameters(GlusterBricks bricks) {
    GlusterVolumeRemoveBricksParameters params = new GlusterVolumeRemoveBricksParameters();
    List<GlusterBrickEntity> entityBricks = new ArrayList<>();
    for (GlusterBrick brick : bricks.getGlusterBricks()) {
        GlusterBrickEntity entity = new GlusterBrickEntity();
        entity.setBrickDirectory(brick.getBrickDir());
        entity.setVolumeId(asGuid(getVolumeId()));
        if (brick.getName() != null) {
            String[] arr = brick.getName().split("\\:");
            if (arr.length > 1) {
                entity.setServerName(arr[0]);
                entity.setBrickDirectory(arr[1]);
            } else {
                continue;
            }
        }
        if (brick.getId() != null) {
            entity.setId(asGuid(brick.getId()));
        }
        entityBricks.add(entity);
    }
    params.setVolumeId(asGuid(getVolumeId()));
    params.setBricks(entityBricks);
    params.setCommandType(ActionType.StartRemoveGlusterVolumeBricks);
    return params;
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) ArrayList(java.util.ArrayList) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) GlusterBrick(org.ovirt.engine.api.model.GlusterBrick)

Example 8 with GlusterVolumeRemoveBricksParameters

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

the class VolumeBrickListModel method onRetainBricks.

private void onRetainBricks() {
    if (getConfirmWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    GlusterVolumeEntity volumeEntity = getVolumeEntity();
    ArrayList<GlusterBrickEntity> list = new ArrayList<>();
    for (Object brickName : model.getItems()) {
        GlusterBrickEntity brick = volumeEntity.getBrickWithQualifiedName((String) brickName);
        if (brick != null) {
            list.add(brick);
        }
    }
    GlusterVolumeRemoveBricksParameters parameter = new GlusterVolumeRemoveBricksParameters(volumeEntity.getId(), list);
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.StopRemoveGlusterVolumeBricks, parameter, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        setConfirmWindow(null);
        if (result.getReturnValue().getSucceeded()) {
            showRemoveBricksStatus();
            disableRemoveBrickStatusPopUpActions();
        }
    }, model);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)

Aggregations

GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)8 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)5 ArrayList (java.util.ArrayList)4 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)4 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)4 GlusterBrick (org.ovirt.engine.api.model.GlusterBrick)2 GlusterBricks (org.ovirt.engine.api.model.GlusterBricks)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1