use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class ClusterPolicyDaoTest method testGetNegative.
@Test
public void testGetNegative() {
ClusterPolicy result = dao.get(Guid.newGuid(), Collections.emptyMap());
assertNull(result);
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class SchedulingManager method canSchedule.
public List<VDS> canSchedule(Cluster cluster, VM vm, List<Guid> vdsBlackList, List<Guid> vdsWhiteList, List<String> messages) {
List<VDS> vdsList = vdsDao.getAllForClusterWithStatus(cluster.getId(), VDSStatus.Up);
vdsList = removeBlacklistedHosts(vdsList, vdsBlackList);
vdsList = keepOnlyWhitelistedHosts(vdsList, vdsWhiteList);
refreshCachedPendingValues(vdsList);
ClusterPolicy policy = policyMap.get(cluster.getClusterPolicyId());
Map<String, String> parameters = createClusterPolicyParameters(cluster);
vdsList = runFilters(policy.getFilters(), cluster, vdsList, vm, parameters, policy.getFilterPositionMap(), messages, noWaitingVmDelayer, false, null);
return vdsList;
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy 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;
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class SchedulingPolicyMapper method map.
@Mapping(from = Balance.class, to = ClusterPolicy.class)
public static ClusterPolicy map(Balance model, ClusterPolicy template) {
ClusterPolicy entity = template != null ? template : new ClusterPolicy();
if (model.isSetSchedulingPolicyUnit() && model.getSchedulingPolicyUnit().isSetId()) {
Guid guid = GuidUtils.asGuid(model.getSchedulingPolicyUnit().getId());
entity.setBalance(guid);
}
return entity;
}
use of org.ovirt.engine.core.common.scheduling.ClusterPolicy in project ovirt-engine by oVirt.
the class ClusterPolicyDaoTest method testSave.
@Test
public void testSave() {
dao.save(dummyPolicy);
ClusterPolicy result = dao.get(dummyPolicy.getId(), Collections.emptyMap());
assertEquals(result, dummyPolicy);
dao.remove(dummyPolicy.getId());
}
Aggregations