use of org.ovirt.engine.core.common.businessentities.NumaTuneMode in project ovirt-engine by oVirt.
the class LibvirtVmXmlBuilder method writeNumaTune.
private void writeNumaTune() {
NumaTuneMode numaTune = vm.getNumaTuneMode();
if (numaTune == null) {
return;
}
Map<String, Object> numaTuneSetting = NumaSettingFactory.buildVmNumatuneSetting(numaTune, vmNumaNodesSupplier.get());
if (numaTuneSetting.isEmpty()) {
return;
}
// <numatune>
// <memory mode='strict' nodeset='0-1'/>
// <memnode cellid='0' mode='strict' nodeset='1'>
// </numatune>
String nodeSet = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_NODESET);
String mode = (String) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MODE);
@SuppressWarnings("unchecked") List<Map<String, String>> memNodes = (List<Map<String, String>>) numaTuneSetting.get(VdsProperties.NUMA_TUNE_MEMNODES);
if (nodeSet != null || memNodes != null) {
writer.writeStartElement("numatune");
if (nodeSet != null) {
writer.writeStartElement("memory");
writer.writeAttributeString("mode", mode);
writer.writeAttributeString("modeset", nodeSet);
writer.writeEndElement();
}
if (memNodes != null) {
for (Map<String, String> memnode : memNodes) {
writer.writeStartElement("memnode");
writer.writeAttributeString("mode", mode);
writer.writeAttributeString("cellid", (String) memnode.get(VdsProperties.NUMA_TUNE_VM_NODE_INDEX));
writer.writeAttributeString("nodeset", (String) memnode.get(VdsProperties.NUMA_TUNE_NODESET));
writer.writeEndElement();
}
}
writer.writeEndElement();
}
}
use of org.ovirt.engine.core.common.businessentities.NumaTuneMode in project ovirt-engine by oVirt.
the class VmInfoBuilderImpl method buildVmNumaProperties.
/**
* Numa will use the same compatibilityVersion as cpu pinning since numa may also add cpu pinning configuration and
* the two features have almost the same libvirt version support
*/
@Override
public void buildVmNumaProperties() {
List<VdsNumaNode> totalVdsNumaNodes = vmInfoBuildUtils.getVdsNumaNodes(vdsId);
if (totalVdsNumaNodes.isEmpty()) {
log.warn("No NUMA nodes found for host {} for vm {} {}", vdsId, vm.getName(), vm.getId());
return;
}
List<VmNumaNode> vmNumaNodes = vmInfoBuildUtils.getVmNumaNodes(vm);
if (vmNumaNodes.isEmpty()) {
return;
}
NumaTuneMode numaTune = vm.getNumaTuneMode();
if (numaTune != null) {
Map<String, Object> numaTuneSetting = NumaSettingFactory.buildVmNumatuneSetting(numaTune, vmNumaNodes);
if (!numaTuneSetting.isEmpty()) {
createInfo.put(VdsProperties.NUMA_TUNE, numaTuneSetting);
}
}
List<Map<String, Object>> createVmNumaNodes = NumaSettingFactory.buildVmNumaNodeSetting(vmNumaNodes);
if (!createVmNumaNodes.isEmpty()) {
createInfo.put(VdsProperties.VM_NUMA_NODES, createVmNumaNodes);
}
if (StringUtils.isEmpty(vm.getCpuPinning())) {
Map<String, Object> cpuPinDict = NumaSettingFactory.buildCpuPinningWithNumaSetting(vmNumaNodes, totalVdsNumaNodes);
if (!cpuPinDict.isEmpty()) {
createInfo.put(VdsProperties.cpuPinning, cpuPinDict);
}
}
}
Aggregations