Search in sources :

Example 1 with Weights

use of org.ovirt.engine.api.model.Weights in project ovirt-engine by oVirt.

the class BackendWeightsResource method list.

@Override
public Weights list() {
    ClusterPolicy clusterPolicy = getClusterPolicy();
    Weights weights = new Weights();
    if (clusterPolicy.getFunctions() != null) {
        for (Pair<Guid, Integer> weightPair : clusterPolicy.getFunctions()) {
            Weight weight = new Weight();
            weight.setId(weightPair.getFirst().toString());
            weight.setFactor(weightPair.getSecond());
            weights.getWeights().add(addLinks(map(clusterPolicy, weight)));
        }
    }
    return weights;
}
Also used : Weights(org.ovirt.engine.api.model.Weights) Guid(org.ovirt.engine.core.compat.Guid) ClusterPolicy(org.ovirt.engine.core.common.scheduling.ClusterPolicy) Weight(org.ovirt.engine.api.model.Weight)

Example 2 with Weights

use of org.ovirt.engine.api.model.Weights in project ovirt-engine by oVirt.

the class V3WeightsInAdapter method adapt.

@Override
public Weights adapt(V3Weights from) {
    Weights to = new Weights();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getWeights().addAll(adaptIn(from.getWeights()));
    return to;
}
Also used : V3Weights(org.ovirt.engine.api.v3.types.V3Weights) Weights(org.ovirt.engine.api.model.Weights)

Aggregations

Weights (org.ovirt.engine.api.model.Weights)2 Weight (org.ovirt.engine.api.model.Weight)1 V3Weights (org.ovirt.engine.api.v3.types.V3Weights)1 ClusterPolicy (org.ovirt.engine.core.common.scheduling.ClusterPolicy)1 Guid (org.ovirt.engine.core.compat.Guid)1