Search in sources :

Example 1 with QosParametersBase

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

the class EditNetworkQoSModel method executeSave.

@Override
public void executeSave() {
    QosParametersBase<NetworkQoS> parameters = new QosParametersBase<>();
    parameters.setQos(networkQoS);
    Frontend.getInstance().runAction(ActionType.UpdateNetworkQoS, parameters, result -> {
        ActionReturnValue retVal = result.getReturnValue();
        boolean succeeded = false;
        if (retVal != null && retVal.getSucceeded()) {
            succeeded = true;
        }
        postSaveAction(succeeded);
    });
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Example 2 with QosParametersBase

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

the class RemoveNetworkQoSModel method onRemove.

public void onRemove() {
    ArrayList<ActionParametersBase> parameters = new ArrayList<>();
    for (Object networkQoS : sourceListModel.getSelectedItems()) {
        QosParametersBase<NetworkQoS> parameter = new QosParametersBase<>();
        NetworkQoS tempQos = (NetworkQoS) networkQoS;
        parameter.setQos(tempQos);
        parameters.add(parameter);
    }
    Frontend.getInstance().runMultipleAction(ActionType.RemoveNetworkQoS, parameters);
    cancel();
}
Also used : QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 3 with QosParametersBase

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

the class BackendQossResource method add.

@Override
public Response add(Qos qos) {
    validateParameters(qos, "name", "type");
    QosParametersBase<QosBase> params = new QosParametersBase<>();
    org.ovirt.engine.api.model.QosType qosType = qos.getType();
    QosBase qosEntity = createNewQosEntityForQosType(qosType);
    params.setQos(map(qos, qosEntity));
    if (dataCenterId != null) {
        qosEntity.setStoragePoolId(dataCenterId);
    }
    return performCreate(addActionTypeForQosType(qosType), params, new QueryIdResolver<Guid>(QueryType.GetQosById, IdQueryParameters.class));
}
Also used : QosBase(org.ovirt.engine.core.common.businessentities.qos.QosBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) Guid(org.ovirt.engine.core.compat.Guid) QosType(org.ovirt.engine.api.model.QosType)

Example 4 with QosParametersBase

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

the class NewNetworkQoSModel method executeSave.

@Override
protected void executeSave() {
    // New network QoS
    final QosParametersBase<NetworkQoS> parameters = new QosParametersBase<>();
    parameters.setQos(networkQoS);
    Frontend.getInstance().runAction(ActionType.AddNetworkQoS, parameters, result -> {
        ActionReturnValue retVal = result.getReturnValue();
        boolean succeeded = false;
        if (retVal != null && retVal.getSucceeded()) {
            succeeded = true;
            networkQoS.setId((Guid) retVal.getActionReturnValue());
        }
        postSaveAction(succeeded);
    });
}
Also used : ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Example 5 with QosParametersBase

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

the class BackendQosResource method update.

@Override
public Qos update(final Qos incoming) {
    QueryIdResolver<Guid> entityResolver = new QueryIdResolver<>(QueryType.GetQosById, IdQueryParameters.class);
    final QosBase qosBase = getEntity(new QueryIdResolver<>(QueryType.GetQosById, IdQueryParameters.class), true);
    return performUpdate(incoming, entityResolver, updateActionTypeForQosType(qosBase.getQosType()), (model, entity) -> {
        QosParametersBase<QosBase> parameters = new QosParametersBase<>();
        parameters.setQosId(guid);
        parameters.setQos(map(incoming, entity));
        return parameters;
    });
}
Also used : QosBase(org.ovirt.engine.core.common.businessentities.qos.QosBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) QosParametersBase(org.ovirt.engine.core.common.action.QosParametersBase) Guid(org.ovirt.engine.core.compat.Guid)

Aggregations

QosParametersBase (org.ovirt.engine.core.common.action.QosParametersBase)5 NetworkQoS (org.ovirt.engine.core.common.businessentities.network.NetworkQoS)3 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 QosBase (org.ovirt.engine.core.common.businessentities.qos.QosBase)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 Guid (org.ovirt.engine.core.compat.Guid)2 ArrayList (java.util.ArrayList)1 QosType (org.ovirt.engine.api.model.QosType)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1