use of org.ovirt.engine.core.common.businessentities.HugePage in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnitTest method testEnoughFreeHugePagesOnHostBadSizeAvailableAndPending.
@Test
public void testEnoughFreeHugePagesOnHostBadSizeAvailableAndPending() throws Exception {
vm.setCustomProperties("hugepages=1024");
host1.setHugePages(Arrays.asList(new HugePage(1024, 1050), new HugePage(2048, 1025)));
pendingResourceManager.addPending(new PendingHugePages(host1, otherVm, 2048, 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.businessentities.HugePage in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnitTest method testEnoughFreeHugePagesOnHostBadSizePending.
@Test
public void testEnoughFreeHugePagesOnHostBadSizePending() throws Exception {
vm.setCustomProperties("hugepages=1024");
host1.setHugePages(Collections.singletonList(new HugePage(1024, 1050)));
pendingResourceManager.addPending(new PendingHugePages(host1, otherVm, 2048, 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.businessentities.HugePage in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnitTest method testHugePagesGoodAndWrongSizeOnHost.
@Test
public void testHugePagesGoodAndWrongSizeOnHost() throws Exception {
vm.setCustomProperties("hugepages=1024");
host1.setHugePages(Arrays.asList(new HugePage(1024, 5), 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.businessentities.HugePage in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnitTest method testNotEnoughFreeHugePagesOnHostPending.
@Test
public void testNotEnoughFreeHugePagesOnHostPending() throws Exception {
vm.setCustomProperties("hugepages=1024");
host1.setHugePages(Collections.singletonList(new HugePage(1024, 1050)));
pendingResourceManager.addPending(new PendingHugePages(host1, otherVm, 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.businessentities.HugePage in project ovirt-engine by oVirt.
the class HugePagesFilterPolicyUnit method prepareHugePageMap.
private Map<Integer, Integer> prepareHugePageMap(VDS host) {
List<HugePage> reportedHugePages = host.getHugePages();
Map<Integer, Integer> hugePages = new HashMap<>(reportedHugePages.size());
for (HugePage hp : reportedHugePages) {
hugePages.put(hp.getSizeKB(), hp.getAmount());
}
return Collections.unmodifiableMap(hugePages);
}
Aggregations