Search in sources :

Example 1 with GlusterVolumeActionParameters

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

the class VolumeListModel method onRemoveVolume.

private void onRemoveVolume() {
    if (getWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
        list.add(new GlusterVolumeActionParameters(volume.getId(), false));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.DeleteGlusterVolume, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Example 2 with GlusterVolumeActionParameters

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

the class VolumeListModel method onStop.

public void onStop() {
    if (getWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
        list.add(new GlusterVolumeActionParameters(volume.getId(), false));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.StopGlusterVolume, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Example 3 with GlusterVolumeActionParameters

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

the class RestoreGlusterVolumeSnapshotCommand method stopVolume.

private boolean stopVolume(GlusterVolumeEntity volume) {
    if (volume != null && volume.getStatus() == GlusterStatus.UP) {
        ActionReturnValue retVal = runInternalAction(ActionType.StopGlusterVolume, new GlusterVolumeActionParameters(volume.getId(), true));
        if (!retVal.getSucceeded()) {
            handleVdsError(AuditLogType.GLUSTER_VOLUME_STOP_FAILED, retVal.getExecuteFailedMessages().toString());
            setSucceeded(false);
            return false;
        }
    }
    return true;
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Example 4 with GlusterVolumeActionParameters

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

the class VolumeListModel method prepareForStartVolume.

private void prepareForStartVolume(boolean noForceStart) {
    boolean force = false;
    ConfirmationModel cModel;
    if (getConfirmWindow() != null) {
        cModel = (ConfirmationModel) getConfirmWindow();
        closeConfirmationWindow();
        force = cModel.getForce().getEntity();
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
        VolumeStatus status = GlusterVolumeUtils.getVolumeStatus(volume);
        if (!noForceStart && (status == VolumeStatus.ALL_BRICKS_DOWN || status == VolumeStatus.SOME_BRICKS_DOWN)) {
            list.add(new GlusterVolumeActionParameters(volume.getId(), force));
        } else if (noForceStart && status == VolumeStatus.DOWN) {
            list.add(new GlusterVolumeActionParameters(volume.getId(), false));
        }
    }
    onStartVolume(list);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) VolumeStatus(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Example 5 with GlusterVolumeActionParameters

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

the class RestoreGlusterVolumeSnapshotCommand method startVolume.

private boolean startVolume(Guid volumeId) {
    ActionReturnValue retVal = runInternalAction(ActionType.StartGlusterVolume, new GlusterVolumeActionParameters(volumeId, true));
    if (!retVal.getSucceeded()) {
        handleVdsError(AuditLogType.GLUSTER_VOLUME_START_FAILED, retVal.getExecuteFailedMessages().toString());
        setSucceeded(false);
        return false;
    }
    return true;
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Aggregations

GlusterVolumeActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)6 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)4 ArrayList (java.util.ArrayList)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)3 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 VolumeStatus (org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus)1