use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class VmNumaNodeDaoImpl method getVmNumaNodeInfoByClusterId.
@Override
public Map<Guid, List<VmNumaNode>> getVmNumaNodeInfoByClusterId(Guid clusterId) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("cluster_id", clusterId);
List<Pair<Guid, VmNumaNode>> vmNumaNodes = getCallsHandler().executeReadList("GetVmNumaNodeByCluster", vmNumaNodeInfoWithClusterRowMapper, parameterSource);
Map<Guid, List<Integer>> numaNodesCpusMap = getAllNumaNodeCpuMap();
Map<Guid, List<Integer>> vmNumaNodesPinMap = getAllVmNumaNodePinInfo();
for (Pair<Guid, VmNumaNode> pair : vmNumaNodes) {
if (numaNodesCpusMap.containsKey(pair.getSecond().getId())) {
pair.getSecond().setCpuIds(numaNodesCpusMap.get(pair.getSecond().getId()));
}
if (vmNumaNodesPinMap.containsKey(pair.getSecond().getId())) {
pair.getSecond().setVdsNumaNodeList(vmNumaNodesPinMap.get(pair.getSecond().getId()));
}
}
return pairsToMap(vmNumaNodes);
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class VmNumaNodeDaoImpl method getAllVmNumaNodeByVmId.
@Override
public List<VmNumaNode> getAllVmNumaNodeByVmId(Guid vmId) {
MapSqlParameterSource parameterSource = getCustomMapSqlParameterSource().addValue("vm_id", vmId);
List<VmNumaNode> vmNumaNodes = getCallsHandler().executeReadList("GetNumaNodeByVmId", vmNumaNodeCpuRowMapper, parameterSource);
Map<Guid, List<Integer>> vmNumaNodesPinMap = getAllVmNumaNodePinInfo();
vmNumaNodes.stream().filter(node -> vmNumaNodesPinMap.containsKey(node.getId())).forEach(node -> node.setVdsNumaNodeList(vmNumaNodesPinMap.get(node.getId())));
return vmNumaNodes;
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class VmNumaNodeDaoTest method testMassSaveNumaNode.
@Test
public void testMassSaveNumaNode() {
List<VmNumaNode> result = vmNumaNodeDao.getAllVmNumaNodeByVmId(ANOTHER_EXISTING_VM_ID);
assertNotNull(result);
assertEquals(0, result.size());
Guid vmNumaNode1 = Guid.newGuid();
Guid vmNumaNode2 = Guid.newGuid();
List<VmNumaNode> newVmNode = new ArrayList<>();
VmNumaNode newVmNumaNode = new VmNumaNode();
newVmNumaNode.setCpuIds(generateCpuList(0, 4));
newVmNumaNode.setId(vmNumaNode1);
newVmNumaNode.setIndex(0);
newVmNumaNode.getVdsNumaNodeList().add(0);
newVmNode.add(newVmNumaNode);
newVmNumaNode = new VmNumaNode();
newVmNumaNode.setCpuIds(generateCpuList(4, 4));
newVmNumaNode.setId(vmNumaNode2);
newVmNumaNode.setIndex(1);
newVmNumaNode.getVdsNumaNodeList().add(1);
newVmNode.add(newVmNumaNode);
vmNumaNodeDao.massSaveNumaNode(newVmNode, ANOTHER_EXISTING_VM_ID);
result = vmNumaNodeDao.getAllVmNumaNodeByVmId(ANOTHER_EXISTING_VM_ID);
assertNotNull(result);
assertEquals(2, result.size());
Map<Guid, VmNumaNode> nodes = new HashMap<>(2);
nodes.put(result.get(0).getId(), result.get(0));
nodes.put(result.get(1).getId(), result.get(1));
assertTrue(nodes.containsKey(vmNumaNode1));
assertTrue(nodes.containsKey(vmNumaNode2));
assertEquals(1, nodes.get(vmNumaNode1).getVdsNumaNodeList().size());
assertEquals(0, nodes.get(vmNumaNode1).getVdsNumaNodeList().get(0).intValue());
assertEquals(1, nodes.get(vmNumaNode2).getVdsNumaNodeList().size());
assertEquals(1, nodes.get(vmNumaNode2).getVdsNumaNodeList().get(0).intValue());
List<Guid> vmNodeList = new ArrayList<>();
vmNodeList.add(vmNumaNode1);
vmNodeList.add(vmNumaNode2);
vmNumaNodeDao.massRemoveNumaNodeByNumaNodeId(vmNodeList);
result = vmNumaNodeDao.getAllVmNumaNodeByVmId(ANOTHER_EXISTING_VM_ID);
assertNotNull(result);
assertEquals(0, result.size());
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class NumaSettingFactoryTest method createTestVmNumaNodes.
private static List<VmNumaNode> createTestVmNumaNodes() {
List<VmNumaNode> newVmNodes = new ArrayList<>();
VmNumaNode newVmNumaNode = new VmNumaNode();
newVmNumaNode.setCpuIds(generateCpuList(0, 4));
newVmNumaNode.setId(Guid.newGuid());
newVmNumaNode.setIndex(0);
newVmNumaNode.setMemTotal(1024);
newVmNumaNode.getVdsNumaNodeList().add(0);
newVmNodes.add(newVmNumaNode);
newVmNumaNode = new VmNumaNode();
newVmNumaNode.setCpuIds(generateCpuList(4, 4));
newVmNumaNode.setId(Guid.newGuid());
newVmNumaNode.setIndex(1);
newVmNumaNode.setMemTotal(1024);
newVmNumaNode.getVdsNumaNodeList().add(1);
newVmNodes.add(newVmNumaNode);
return newVmNodes;
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class NumaSettingFactoryTest method shouldNotCreateCpuPinningForVirtualNumaNodes.
@Test
public void shouldNotCreateCpuPinningForVirtualNumaNodes() {
for (VmNumaNode numaNode : vmNumaNodes) {
numaNode.getVdsNumaNodeList().clear();
}
Map<String, Object> cpuPinning = NumaSettingFactory.buildCpuPinningWithNumaSetting(vmNumaNodes, vdsNumaNodes);
Assertions.assertThat(cpuPinning).isEmpty();
Map<String, Object> mapping = NumaSettingFactory.buildVmNumatuneSetting(NumaTuneMode.INTERLEAVE, vmNumaNodes);
Assertions.assertThat(mapping).doesNotContainKeys(VdsProperties.NUMA_TUNE_MODE, VdsProperties.NUMA_TUNE_NODESET);
}
Aggregations