Search in sources :

Example 1 with GlusterVolumeOptionParameters

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

the class VolumeParameterListModel method onSetParameter.

private void onSetParameter() {
    if (getEntity() == null) {
        return;
    }
    GlusterVolumeEntity volume = getEntity();
    VolumeParameterModel model = (VolumeParameterModel) getWindow();
    if (!model.validate()) {
        return;
    }
    GlusterVolumeOptionEntity option = new GlusterVolumeOptionEntity();
    option.setVolumeId(volume.getId());
    option.setKey(model.getKeyList().getSelectedItem());
    option.setValue(model.getValue().getEntity());
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(option), result -> {
        VolumeParameterListModel localModel = (VolumeParameterListModel) result.getState();
        localModel.postOnSetParameter(result.getReturnValue());
    }, this);
}
Also used : GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)

Example 2 with GlusterVolumeOptionParameters

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

the class BackendGlusterVolumeResource method setOption.

@Override
public Response setOption(Action action) {
    Option option = action.getOption();
    validateParameters(option, "name", "value");
    return doAction(ActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(new GlusterVolumeOptionEntity(guid, option.getName(), option.getValue())), action);
}
Also used : GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) Option(org.ovirt.engine.api.model.Option) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)

Example 3 with GlusterVolumeOptionParameters

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

the class CreateGlusterVolumeCommand method setVolumeOptions.

/**
 * Sets all options of a volume by invoking the action {@link ActionType#SetGlusterVolumeOption} in a loop. <br>
 * Errors if any are collected and added to "executeFailedMessages"
 */
private void setVolumeOptions(GlusterVolumeEntity volume) {
    List<String> errors = new ArrayList<>();
    for (GlusterVolumeOptionEntity option : volume.getOptions()) {
        // make sure that volume id is set
        option.setVolumeId(volume.getId());
        ActionReturnValue setOptionReturnValue = runInternalAction(ActionType.SetGlusterVolumeOption, new GlusterVolumeOptionParameters(option), createCommandContext(volume, option));
        if (!setOptionReturnValue.getSucceeded()) {
            setSucceeded(false);
            errors.addAll(setOptionReturnValue.getValidationMessages());
            errors.addAll(setOptionReturnValue.getExecuteFailedMessages());
        }
    }
    if (!errors.isEmpty()) {
        handleVdsErrors(AuditLogType.GLUSTER_VOLUME_OPTION_SET_FAILED, errors);
    }
}
Also used : GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ArrayList(java.util.ArrayList) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)

Aggregations

GlusterVolumeOptionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters)3 GlusterVolumeOptionEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity)3 ArrayList (java.util.ArrayList)1 Option (org.ovirt.engine.api.model.Option)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1