Search in sources :

Example 1 with GlusterVolumeReplaceBrickActionParameters

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

the class VolumeBrickListModel method onReplaceConfirmation.

private void onReplaceConfirmation() {
    cancelConfirmation();
    ReplaceBrickModel replaceBrickModel = (ReplaceBrickModel) getWindow();
    GlusterVolumeEntity volumeEntity = getEntity();
    GlusterBrickEntity existingBrick = getSelectedItem();
    if (replaceBrickModel == null || volumeEntity == null || existingBrick == null) {
        return;
    }
    if (!replaceBrickModel.validate()) {
        return;
    }
    VDS server = replaceBrickModel.getServers().getSelectedItem();
    if (server == null) {
        return;
    }
    GlusterBrickEntity newBrick = new GlusterBrickEntity();
    newBrick.setVolumeId(volumeEntity.getId());
    newBrick.setServerId(server.getId());
    newBrick.setServerName(server.getHostName());
    newBrick.setBrickDirectory(replaceBrickModel.getBrickDirectory().getEntity());
    replaceBrickModel.startProgress();
    GlusterVolumeReplaceBrickActionParameters parameter = new GlusterVolumeReplaceBrickActionParameters(volumeEntity.getId(), existingBrick, newBrick);
    Frontend.getInstance().runAction(ActionType.ReplaceGlusterVolumeBrick, parameter, result -> {
        ReplaceBrickModel localModel = (ReplaceBrickModel) result.getState();
        localModel.stopProgress();
        setWindow(null);
    }, replaceBrickModel);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeReplaceBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters)

Aggregations

GlusterVolumeReplaceBrickActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1