use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class VmAffinityFilterPolicyUnitTest method testPositiveAffinityToMultipleHosts.
@Test
public void testPositiveAffinityToMultipleHosts() {
List<VDS> hosts = Arrays.asList(host1, host2, host3);
VM vm1 = createVmRunning(host2);
VM vm2 = createVmRunning(host2);
VM vm3 = createVmRunning(host3);
affinityGroups.add(createAffinityGroup(cluster, EntityAffinityRule.POSITIVE, true, vm1, vm2, vm3, newVm));
assertThat(policyUnit.filter(cluster, hosts, newVm, null, new PerHostMessages())).containsOnly(host2, host3);
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class VmAffinityFilterPolicyUnitTest method testNoAffinityGroups.
@Test
public void testNoAffinityGroups() {
List<VDS> hosts = Arrays.asList(host1, host2);
assertThat(policyUnit.filter(cluster, hosts, newVm, null, new PerHostMessages())).containsOnlyElementsOf(hosts);
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class VmToHostAffinityFilterPolicyUnitTest method testWithAffinityIntersection.
@Test
public void testWithAffinityIntersection() throws Exception {
AffinityGroup positiveCollisionGroup = new AffinityGroup();
positiveCollisionGroup.setVdsIds(Arrays.asList(host_negative_enforcing.getId()));
positiveCollisionGroup.setVdsAffinityRule(EntityAffinityRule.POSITIVE);
positiveCollisionGroup.setVdsEnforcing(true);
hosts = Arrays.asList(host_positive_enforcing, host_negative_enforcing, host_not_in_affinity_group);
List<AffinityGroup> affinityGroups = Arrays.asList(positiveCollisionGroup, negative_enforcing_group);
doReturn(affinityGroups).when(affinityGroupDao).getAllAffinityGroupsByVmId(any());
assertThat(unit.filter(cluster, hosts, vm, new HashMap<>(), new PerHostMessages())).isEmpty();
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class ClusterInMaintenanceFilterPolicyUnitTest method testNonHaCanMigrate.
@Test
public void testNonHaCanMigrate() throws Exception {
vm.setRunOnVds(Guid.newGuid());
ClusterInMaintenanceFilterPolicyUnit unit = new ClusterInMaintenanceFilterPolicyUnit(null, null);
List<VDS> result = unit.filter(null, Collections.singletonList(host), vm, Collections.emptyMap(), new PerHostMessages());
assertThat(result).isNotNull().isNotEmpty().contains(host);
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class ClusterInMaintenanceFilterPolicyUnitTest method testHaCanStart.
@Test
public void testHaCanStart() throws Exception {
vm.setAutoStartup(true);
ClusterInMaintenanceFilterPolicyUnit unit = new ClusterInMaintenanceFilterPolicyUnit(null, null);
List<VDS> result = unit.filter(null, Collections.singletonList(host), vm, Collections.emptyMap(), new PerHostMessages());
assertThat(result).isNotNull().isNotEmpty().contains(host);
}
Aggregations