Search in sources :

Example 16 with VdsNumaNode

use of org.ovirt.engine.core.common.businessentities.VdsNumaNode in project ovirt-engine by oVirt.

the class HostSummaryContentPanel method setModel.

public void setModel(List<VdsNumaNode> numaNodes, List<VNodeModel> vNodeModels) {
    for (VNodeModel vNodeModel : vNodeModels) {
        VirtualNumaPanel panel = virtualNumaPanelProvider.get();
        panel.setModel(vNodeModel);
        vNumaPanel.add(panel);
    }
    for (VdsNumaNode numaNode : numaNodes) {
        numaPanel.add(new HTML(messages.numaNode(numaNode.getIndex())));
    }
}
Also used : VNodeModel(org.ovirt.engine.ui.uicommonweb.models.hosts.numa.VNodeModel) VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) HTML(com.google.gwt.user.client.ui.HTML)

Example 17 with VdsNumaNode

use of org.ovirt.engine.core.common.businessentities.VdsNumaNode in project ovirt-engine by oVirt.

the class VdsNumaNodeDaoTest method testMassSaveNumaNode.

@Test
public void testMassSaveNumaNode() {
    List<VdsNumaNode> result = vdsNumaNodeDao.getAllVdsNumaNodeByVdsId(FixturesTool.HOST_ID);
    assertNotNull(result);
    assertEquals(0, result.size());
    List<VdsNumaNode> newVdsNode = new ArrayList<>();
    VdsNumaNode newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(0, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(0);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 0));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNode.add(newVdsNumaNode);
    newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(4, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(1);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 1));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNode.add(newVdsNumaNode);
    vdsNumaNodeDao.massSaveNumaNode(newVdsNode, FixturesTool.HOST_ID);
    result = vdsNumaNodeDao.getAllVdsNumaNodeByVdsId(FixturesTool.HOST_ID);
    assertNotNull(result);
    assertEquals(2, result.size());
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 18 with VdsNumaNode

use of org.ovirt.engine.core.common.businessentities.VdsNumaNode in project ovirt-engine by oVirt.

the class VdsNumaNodeDaoTest method testMassRemoveNumaNodeByNumaNodeId.

@Test
public void testMassRemoveNumaNodeByNumaNodeId() {
    List<VdsNumaNode> newVdsNode = new ArrayList<>();
    VdsNumaNode newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(0, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(0);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 0));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNode.add(newVdsNumaNode);
    newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(4, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(1);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 1));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNode.add(newVdsNumaNode);
    vdsNumaNodeDao.massSaveNumaNode(newVdsNode, FixturesTool.HOST_ID);
    List<VdsNumaNode> result = vdsNumaNodeDao.getAllVdsNumaNodeByVdsId(FixturesTool.HOST_ID);
    assertNotNull(result);
    assertEquals(2, result.size());
    List<Guid> numaNodeIds = new ArrayList<>();
    numaNodeIds.add(result.get(0).getId());
    numaNodeIds.add(result.get(1).getId());
    vdsNumaNodeDao.massRemoveNumaNodeByNumaNodeId(numaNodeIds);
    result = vdsNumaNodeDao.getAllVdsNumaNodeByVdsId(FixturesTool.HOST_ID);
    assertNotNull(result);
    assertEquals(0, result.size());
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) ArrayList(java.util.ArrayList) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 19 with VdsNumaNode

use of org.ovirt.engine.core.common.businessentities.VdsNumaNode in project ovirt-engine by oVirt.

the class NumaSettingFactoryTest method createTestVdsNumaNodes.

private static List<VdsNumaNode> createTestVdsNumaNodes() {
    NumaNodeStatistics newNodeStatistics = new NumaNodeStatistics();
    newNodeStatistics.setCpuUsagePercent(20);
    newNodeStatistics.setMemUsagePercent(50);
    List<VdsNumaNode> newVdsNodes = new ArrayList<>();
    VdsNumaNode newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(0, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(0);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 0));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNodes.add(newVdsNumaNode);
    newVdsNumaNode = new VdsNumaNode();
    newVdsNumaNode.setCpuIds(generateCpuList(4, 4));
    newVdsNumaNode.setId(Guid.newGuid());
    newVdsNumaNode.setIndex(1);
    newVdsNumaNode.setNumaNodeDistances(generateDistance(2, 1));
    newVdsNumaNode.setNumaNodeStatistics(newNodeStatistics);
    newVdsNodes.add(newVdsNumaNode);
    return newVdsNodes;
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) NumaNodeStatistics(org.ovirt.engine.core.common.businessentities.NumaNodeStatistics) ArrayList(java.util.ArrayList)

Example 20 with VdsNumaNode

use of org.ovirt.engine.core.common.businessentities.VdsNumaNode in project ovirt-engine by oVirt.

the class NumaValidator method validateNumaCompatibility.

/**
 * Check if a VM can run on specific hostNumaNodes with the provided numa configuration. The numa nodes for
 * validation need to be passed in separately because the numa nodes are not necessarily part of the VM when the
 * validation takes place.
 *
 * @param vm            with numa nodes
 * @param vmNumaNodes   to use for validation
 * @param hostNumaNodes from a host
 * @return weather the vm can run on the hostNumaNodes or not
 */
public ValidationResult validateNumaCompatibility(final VM vm, final List<VmNumaNode> vmNumaNodes, final List<VdsNumaNode> hostNumaNodes) {
    if (hostNumaNodes == null || hostNumaNodes.isEmpty()) {
        return new ValidationResult(EngineMessage.VM_NUMA_PINNED_VDS_NODE_EMPTY);
    }
    if (hostNumaNodes.size() == 1) {
        // One node is equal to no NUMA node architecture present
        return new ValidationResult(EngineMessage.HOST_NUMA_NOT_SUPPORTED);
    }
    final HashMap<Integer, VdsNumaNode> hostNodeMap = new HashMap<>();
    for (VdsNumaNode hostNumaNode : hostNumaNodes) {
        hostNodeMap.put(hostNumaNode.getIndex(), hostNumaNode);
    }
    boolean memStrict = vm.getNumaTuneMode() == NumaTuneMode.STRICT;
    for (VmNumaNode vmNumaNode : vmNumaNodes) {
        for (Integer pinnedIndex : vmNumaNode.getVdsNumaNodeList()) {
            if (pinnedIndex == null) {
                return new ValidationResult(EngineMessage.VM_NUMA_NODE_PINNED_INDEX_ERROR);
            }
            if (!hostNodeMap.containsKey(pinnedIndex)) {
                return new ValidationResult(EngineMessage.VM_NUMA_NODE_HOST_NODE_INVALID_INDEX, String.format("$vdsNodeIndex %d", pinnedIndex));
            }
            if (memStrict) {
                final VdsNumaNode hostNumaNode = hostNodeMap.get(pinnedIndex);
                if (vmNumaNode.getMemTotal() > hostNumaNode.getMemTotal()) {
                    return new ValidationResult(EngineMessage.VM_NUMA_NODE_MEMORY_ERROR);
                }
            }
        }
    }
    return ValidationResult.VALID;
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) VmNumaNode(org.ovirt.engine.core.common.businessentities.VmNumaNode) HashMap(java.util.HashMap) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Aggregations

VdsNumaNode (org.ovirt.engine.core.common.businessentities.VdsNumaNode)22 ArrayList (java.util.ArrayList)8 HashMap (java.util.HashMap)6 VmNumaNode (org.ovirt.engine.core.common.businessentities.VmNumaNode)6 Map (java.util.Map)3 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 Test (org.junit.Test)2 NumaNode (org.ovirt.engine.api.model.NumaNode)2 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)2 CpuStatistics (org.ovirt.engine.core.common.businessentities.CpuStatistics)2 NumaNodeStatistics (org.ovirt.engine.core.common.businessentities.NumaNodeStatistics)2 Guid (org.ovirt.engine.core.compat.Guid)2 HTML (com.google.gwt.user.client.ui.HTML)1 DecimalFormat (java.text.DecimalFormat)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Set (java.util.Set)1 Core (org.ovirt.engine.api.model.Core)1 Cores (org.ovirt.engine.api.model.Cores)1