Search in sources :

Example 21 with VdsNumaNode

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

the class NumaValidator method checkVmNumaNodesIntegrity.

/**
 * Check the whole numa configuration of a VM. 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          to check comaptiblity with
 * @param vmNumaNodes to use for validation
 * @return the validation result
 */
public ValidationResult checkVmNumaNodesIntegrity(final VM vm, final List<VmNumaNode> vmNumaNodes) {
    if (vmNumaNodes.isEmpty()) {
        return ValidationResult.VALID;
    }
    ValidationResult validationResult = validateVmNumaConfig(vm, vmNumaNodes);
    if (!validationResult.isValid()) {
        return validationResult;
    }
    // TODO Numa sheduling policy
    if (Config.<Boolean>getValue(ConfigValues.SupportNUMAMigration)) {
        return ValidationResult.VALID;
    }
    validationResult = validateVmPinning(vm);
    if (!validationResult.isValid()) {
        return validationResult;
    }
    final List<VdsNumaNode> hostNumaNodes = vdsNumaNodeDao.getAllVdsNumaNodeByVdsId(vm.getDedicatedVmForVdsList().get(0));
    return validateNumaCompatibility(vm, vmNumaNodes, hostNumaNodes);
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) ValidationResult(org.ovirt.engine.core.bll.ValidationResult)

Example 22 with VdsNumaNode

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

the class HostMonitoring method saveNumaStatisticsDataToDb.

private void saveNumaStatisticsDataToDb() {
    final List<VdsNumaNode> vdsNumaNodesToSave = new ArrayList<>();
    List<VdsNumaNode> updateNumaNodes = vds.getNumaNodeList();
    if (!updateNumaNodes.isEmpty()) {
        List<VdsNumaNode> dbVdsNumaNodes = getDbFacade().getVdsNumaNodeDao().getAllVdsNumaNodeByVdsId(vds.getId());
        Map<Integer, VdsNumaNode> nodesMap = new HashMap<>();
        for (VdsNumaNode node : dbVdsNumaNodes) {
            nodesMap.put(node.getIndex(), node);
        }
        for (VdsNumaNode node : updateNumaNodes) {
            VdsNumaNode dbNode = nodesMap.get(node.getIndex());
            if (dbNode != null) {
                if (node.getNumaNodeStatistics() != null) {
                    dbNode.setNumaNodeStatistics(node.getNumaNodeStatistics());
                    vdsNumaNodesToSave.add(dbNode);
                }
            }
        }
    }
    if (!vdsNumaNodesToSave.isEmpty()) {
        getDbFacade().getVdsNumaNodeDao().massUpdateNumaNodeStatistics(vdsNumaNodesToSave);
    }
}
Also used : VdsNumaNode(org.ovirt.engine.core.common.businessentities.VdsNumaNode) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

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