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;
}
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);
}
Aggregations