use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnitTest method testHugePagesWrongSizeOnHost.
@Test
public void testHugePagesWrongSizeOnHost() throws Exception {
vm.setCustomProperties("hugepages=1024");
host1.setHugePages(Collections.singletonList(new HugePage(2048, 50)));
HugePagesFilterPolicyUnit unit = new HugePagesFilterPolicyUnit(null, pendingResourceManager);
List<VDS> hosts = unit.filter(null, Collections.singletonList(host1), vm, Collections.emptyMap(), new PerHostMessages());
assertThat(hosts).isEmpty();
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnitTest method testEnoughFreeHugePagesOnHostSimple.
@Test
public void testEnoughFreeHugePagesOnHostSimple() throws Exception {
vm.setCustomProperties("hugepages=1024");
host1.setHugePages(Collections.singletonList(new HugePage(1024, 1024)));
HugePagesFilterPolicyUnit unit = new HugePagesFilterPolicyUnit(null, pendingResourceManager);
List<VDS> hosts = unit.filter(null, Collections.singletonList(host1), vm, Collections.emptyMap(), new PerHostMessages());
assertThat(hosts).isNotEmpty().contains(host1);
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnitTest method testNotEnoughFreeHugePagesOnHost.
@Test
public void testNotEnoughFreeHugePagesOnHost() throws Exception {
vm.setCustomProperties("hugepages=1024");
host1.setHugePages(Collections.singletonList(new HugePage(1024, 50)));
HugePagesFilterPolicyUnit unit = new HugePagesFilterPolicyUnit(null, pendingResourceManager);
List<VDS> hosts = unit.filter(null, Collections.singletonList(host1), vm, Collections.emptyMap(), new PerHostMessages());
assertThat(hosts).isEmpty();
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class LabelFilterPolicyUnitTest method testSimple.
@Test
public void testSimple() throws Exception {
Label red = new LabelBuilder().entities(vm, host1).build();
List<Label> labels = Collections.singletonList(red);
doReturn(labels).when(labelDao).getAllByEntityIds(any());
assertThat(unit.filter(cluster, hosts, vm, new HashMap<>(), new PerHostMessages())).contains(host1).doesNotContain(host2);
}
use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.
the class LabelFilterPolicyUnitTest method testHostExtra.
@Test
public void testHostExtra() throws Exception {
Label red = new LabelBuilder().entities(vm, host1).build();
Label blue = new LabelBuilder().entities(host1, host2).build();
List<Label> labels = Arrays.asList(red, blue);
doReturn(labels).when(labelDao).getAllByEntityIds(any());
assertThat(unit.filter(cluster, hosts, vm, new HashMap<>(), new PerHostMessages())).contains(host1).doesNotContain(host2);
}
Aggregations