Search in sources :

Example 1 with SchedulingPolicies

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

the class V3SchedulingPoliciesInAdapter method adapt.

@Override
public SchedulingPolicies adapt(V3SchedulingPolicies from) {
    SchedulingPolicies to = new SchedulingPolicies();
    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.getSchedulingPolicies().addAll(adaptIn(from.getSchedulingPolicy()));
    return to;
}
Also used : SchedulingPolicies(org.ovirt.engine.api.model.SchedulingPolicies) V3SchedulingPolicies(org.ovirt.engine.api.v3.types.V3SchedulingPolicies)

Example 2 with SchedulingPolicies

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

the class V3ClusterHelper method findCompatiblePolicy.

/**
 * Tries to find a V4 scheduling policy that is compatible with the given V3 scheduling policy.
 *
 * @return the compatible scheduling policy, or {@code null} if no such policy can be found
 */
public static SchedulingPolicy findCompatiblePolicy(V3SchedulingPolicy v3Policy) {
    SystemResource systemResource = BackendApiResource.getInstance();
    SchedulingPoliciesResource policiesResource = systemResource.getSchedulingPoliciesResource();
    SchedulingPolicies v4Policies = policiesResource.list();
    return v4Policies.getSchedulingPolicies().stream().filter(v4Policy -> arePoliciesCompatible(v3Policy, v4Policy)).findFirst().orElse(null);
}
Also used : SchedulingPoliciesResource(org.ovirt.engine.api.resource.SchedulingPoliciesResource) SystemResource(org.ovirt.engine.api.resource.SystemResource) SchedulingPolicies(org.ovirt.engine.api.model.SchedulingPolicies)

Aggregations

SchedulingPolicies (org.ovirt.engine.api.model.SchedulingPolicies)2 SchedulingPoliciesResource (org.ovirt.engine.api.resource.SchedulingPoliciesResource)1 SystemResource (org.ovirt.engine.api.resource.SystemResource)1 V3SchedulingPolicies (org.ovirt.engine.api.v3.types.V3SchedulingPolicies)1