Search in sources :

Example 1 with GlusterServiceParameters

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

the class ClusterGeneralModel method onManageGlusterSwiftServices.

private void onManageGlusterSwiftServices() {
    if (getWindow() == null) {
        return;
    }
    ManageGlusterSwiftModel glusterSwiftModel = (ManageGlusterSwiftModel) getWindow();
    glusterSwiftModel.startProgress();
    if (glusterSwiftModel.getIsManageServerLevel().getEntity()) {
        ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
        for (Object model : glusterSwiftModel.getHostServicesList().getItems()) {
            GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) model;
            GlusterSwiftAction action = getGlusterSwiftAction(swiftServiceModel.getStartSwift().getEntity(), swiftServiceModel.getStopSwift().getEntity(), swiftServiceModel.getRestartSwift().getEntity());
            if (action != null) {
                GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getId(), swiftServiceModel.getEntity().getServerId(), ServiceType.GLUSTER_SWIFT, action.name().toLowerCase());
                parametersList.add(parameters);
            }
        }
        // should check what is the required behaviour and return to true if required.
        if (!parametersList.isEmpty()) {
            Frontend.getInstance().runMultipleAction(ActionType.ManageGlusterService, parametersList, false, result -> {
                ManageGlusterSwiftModel innerGlusterSwiftModel = (ManageGlusterSwiftModel) result.getState();
                innerGlusterSwiftModel.stopProgress();
                cancel();
                updateGlusterDetails();
            }, glusterSwiftModel);
        } else {
            glusterSwiftModel.stopProgress();
            glusterSwiftModel.setMessage(ConstantsManager.getInstance().getConstants().noActionSelectedManageGlusterSwift());
        }
    } else {
        GlusterSwiftAction action = getGlusterSwiftAction(glusterSwiftModel.getStartSwift().getEntity(), glusterSwiftModel.getStopSwift().getEntity(), glusterSwiftModel.getRestartSwift().getEntity());
        if (action != null) {
            GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getId(), null, ServiceType.GLUSTER_SWIFT, action.name().toLowerCase());
            Frontend.getInstance().runAction(ActionType.ManageGlusterService, parameters, result -> {
                ManageGlusterSwiftModel innerGlusterSwiftModel = (ManageGlusterSwiftModel) result.getState();
                innerGlusterSwiftModel.stopProgress();
                if (result.getReturnValue().getSucceeded()) {
                    cancel();
                    updateGlusterDetails();
                }
            }, glusterSwiftModel);
        } else {
            glusterSwiftModel.stopProgress();
            glusterSwiftModel.setMessage(ConstantsManager.getInstance().getConstants().noActionSelectedManageGlusterSwift());
        }
    }
}
Also used : ArrayList(java.util.ArrayList) GlusterServiceParameters(org.ovirt.engine.core.common.action.gluster.GlusterServiceParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with GlusterServiceParameters

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

the class HostGeneralModel method restartGluster.

public void restartGluster() {
    // call restart gluster
    GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getClusterId(), getEntity().getId(), ServiceType.GLUSTER, // $NON-NLS-1$
    "restart");
    Frontend.getInstance().runAction(ActionType.ManageGlusterService, parameters);
}
Also used : GlusterServiceParameters(org.ovirt.engine.core.common.action.gluster.GlusterServiceParameters)

Example 3 with GlusterServiceParameters

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

the class HostGlusterSwiftListModel method manageSwift.

private void manageSwift(String action) {
    GlusterServiceParameters parameters = new GlusterServiceParameters(getEntity().getClusterId(), getEntity().getId(), ServiceType.GLUSTER_SWIFT, action);
    Frontend.getInstance().runAction(ActionType.ManageGlusterService, parameters);
}
Also used : GlusterServiceParameters(org.ovirt.engine.core.common.action.gluster.GlusterServiceParameters)

Aggregations

GlusterServiceParameters (org.ovirt.engine.core.common.action.gluster.GlusterServiceParameters)3 ArrayList (java.util.ArrayList)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1