Skip to content

Commit

Permalink
scheduling: filter numa-less hosts to resize vms
Browse files Browse the repository at this point in the history
When having `Resize and Pin NUMA` VM that tries to schedule on a host,
it shouldn't run on a host without NUMA support.
This patch filter these host in the above scenario.

Change-Id: I41ae6d54625a2c14b749f6393c29059cbd53a6d7
Bug-Url: https://bugzilla.redhat.com/2056950
Signed-off-by: Liran Rotenberg <lrotenbe@redhat.com>
  • Loading branch information
liranr23 committed Jul 19, 2022
1 parent 5480458 commit 49b89a1
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.ovirt.engine.core.common.scheduling.PolicyUnit;
import org.ovirt.engine.core.common.scheduling.PolicyUnitType;
import org.ovirt.engine.core.common.utils.NumaPinningHelper;
import org.ovirt.engine.core.common.utils.VmCpuCountHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -37,8 +38,8 @@ public NumaPolicyUnit(PolicyUnit policyUnit,
@Override
public List<VDS> filter(SchedulingContext context, List<VDS> hosts, List<VM> vmGroup, PerHostMessages messages) {
boolean vmNumaPinned = vmGroup.stream()
.flatMap(vm -> vm.getvNumaNodeList().stream())
.anyMatch(node -> !node.getVdsNumaNodeList().isEmpty());
.anyMatch(vm -> vm.getvNumaNodeList().stream().anyMatch(node -> !node.getVdsNumaNodeList().isEmpty())
|| VmCpuCountHelper.isResizeAndPinPolicy(vm));

// If no VM numa node is pinned, all hosts are accepted.
//
Expand All @@ -48,7 +49,7 @@ public List<VDS> filter(SchedulingContext context, List<VDS> hosts, List<VM> vmG
}

List<VM> vmsToCheck = vmGroup.stream()
.filter(vm -> !vm.getvNumaNodeList().isEmpty())
.filter(vm -> !vm.getvNumaNodeList().isEmpty() || VmCpuCountHelper.isResizeAndPinPolicy(vm))
.collect(Collectors.toList());

if (vmsToCheck.isEmpty()) {
Expand Down Expand Up @@ -84,7 +85,11 @@ public List<VDS> filter(SchedulingContext context, List<VDS> hosts, List<VM> vmG
continue;
}

if (vmsToCheckOnHost.isEmpty()) {
List<VM> vmsAlreadySetWithNumaNodes = vmsToCheckOnHost.stream()
.filter(vm -> !vm.getvNumaNodeList().isEmpty())
.collect(Collectors.toList());

if (vmsAlreadySetWithNumaNodes.isEmpty()) {
result.add(host);
continue;
}
Expand All @@ -93,7 +98,7 @@ public List<VDS> filter(SchedulingContext context, List<VDS> hosts, List<VM> vmG
// For now, we use the same algorithm as for STRICT mode.
// This will cause the host to be filtered out even in some cases when INTERLEAVE nodes could fit.

if (!NumaPinningHelper.findAssignment(vmsToCheckOnHost, host.getNumaNodeList(), false).isPresent()) {
if (!NumaPinningHelper.findAssignment(vmsAlreadySetWithNumaNodes, host.getNumaNodeList(), false).isPresent()) {
log.debug("Host '{}' cannot accommodate memory of VM's pinned virtual NUMA nodes within host's physical NUMA nodes",
host.getName());
messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__NOT_MEMORY_PINNED_NUMA.toString());
Expand Down

0 comments on commit 49b89a1

Please sign in to comment.