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())));
}
}
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());
}
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());
}
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;
}
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;
}
Aggregations