Search in sources :

Example 11 with PerHostMessages

use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.

the class CpuPinningPolicyUnitTest method setUp.

@Before
public void setUp() {
    hostWithCpus = new VDS();
    hostWithCpus.setId(Guid.newGuid());
    hostWithCpus.setOnlineCpus("0, 1, 2,3, 5");
    hostWithoutCpus = new VDS();
    hostWithoutCpus.setId(Guid.newGuid());
    hostWithoutCpus.setOnlineCpus(null);
    perHostMessages = new PerHostMessages();
    vm = new VM();
    vm.setId(Guid.newGuid());
    cluster = new Cluster();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) VM(org.ovirt.engine.core.common.businessentities.VM) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) PerHostMessages(org.ovirt.engine.core.common.scheduling.PerHostMessages) Before(org.junit.Before)

Example 12 with PerHostMessages

use of org.ovirt.engine.core.common.scheduling.PerHostMessages 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);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) PendingHugePages(org.ovirt.engine.core.bll.scheduling.pending.PendingHugePages) PerHostMessages(org.ovirt.engine.core.common.scheduling.PerHostMessages) HugePage(org.ovirt.engine.core.common.businessentities.HugePage) Test(org.junit.Test)

Example 13 with PerHostMessages

use of org.ovirt.engine.core.common.scheduling.PerHostMessages 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);
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) PendingHugePages(org.ovirt.engine.core.bll.scheduling.pending.PendingHugePages) PerHostMessages(org.ovirt.engine.core.common.scheduling.PerHostMessages) HugePage(org.ovirt.engine.core.common.businessentities.HugePage) Test(org.junit.Test)

Example 14 with PerHostMessages

use of org.ovirt.engine.core.common.scheduling.PerHostMessages in project ovirt-engine by oVirt.

the class HugePagesFilterPolicyUnitTest method testHugePagesNotPresentOnHost.

@Test
public void testHugePagesNotPresentOnHost() throws Exception {
    vm.setCustomProperties("hugepages=1024");
    HugePagesFilterPolicyUnit unit = new HugePagesFilterPolicyUnit(null, pendingResourceManager);
    List<VDS> hosts = unit.filter(null, Collections.singletonList(host1), vm, Collections.emptyMap(), new PerHostMessages());
    assertThat(hosts).isEmpty();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) PerHostMessages(org.ovirt.engine.core.common.scheduling.PerHostMessages) Test(org.junit.Test)

Example 15 with PerHostMessages

use of org.ovirt.engine.core.common.scheduling.PerHostMessages 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();
}
Also used : VDS(org.ovirt.engine.core.common.businessentities.VDS) PerHostMessages(org.ovirt.engine.core.common.scheduling.PerHostMessages) HugePage(org.ovirt.engine.core.common.businessentities.HugePage) Test(org.junit.Test)

Aggregations

PerHostMessages (org.ovirt.engine.core.common.scheduling.PerHostMessages)31 Test (org.junit.Test)24 VDS (org.ovirt.engine.core.common.businessentities.VDS)24 VM (org.ovirt.engine.core.common.businessentities.VM)9 HugePage (org.ovirt.engine.core.common.businessentities.HugePage)8 HashMap (java.util.HashMap)5 AffinityGroup (org.ovirt.engine.core.common.scheduling.AffinityGroup)5 ArrayList (java.util.ArrayList)4 PendingHugePages (org.ovirt.engine.core.bll.scheduling.pending.PendingHugePages)4 Guid (org.ovirt.engine.core.compat.Guid)4 List (java.util.List)3 Map (java.util.Map)3 PolicyUnitImpl (org.ovirt.engine.core.bll.scheduling.PolicyUnitImpl)3 PendingResourceManager (org.ovirt.engine.core.bll.scheduling.pending.PendingResourceManager)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 Label (org.ovirt.engine.core.common.businessentities.Label)3 LabelBuilder (org.ovirt.engine.core.common.businessentities.LabelBuilder)3 EngineMessage (org.ovirt.engine.core.common.errors.EngineMessage)3 PolicyUnit (org.ovirt.engine.core.common.scheduling.PolicyUnit)3 Logger (org.slf4j.Logger)3