use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class NumaSupportModel method initVNumaNodes.
protected void initVNumaNodes() {
unassignedNumaNodes = new LinkedHashSet<>();
assignedNumaNodes = new HashMap<>();
final Set<Integer> hostIndices = new HashSet<>();
for (VdsNumaNode numaNode : numaNodeList) {
hostIndices.add(numaNode.getIndex());
}
for (final VM vm : getVmsWithvNumaNodeList()) {
numaModelsPerVm.put(vm.getId(), new HashMap<Integer, VNodeModel>());
for (VmNumaNode vmNumaNode : vm.getvNumaNodeList()) {
VNodeModel vNodeModel = new VNodeModel(vm, vmNumaNode);
numaModelsPerVm.get(vm.getId()).put(vNodeModel.getIndex(), vNodeModel);
if (vNodeModel.isPinned()) {
if (!hostIndices.contains(vNodeModel.getHostNodeIndex())) {
// host numa node does not exist. Unpin the numa node and update the configuration
vNodeModel.unpin();
vmsToUpdate.add(vm.getId());
}
}
if (!vNodeModel.isPinned()) {
// virtual numa node is not assigned to any host numa node
unassignedNumaNodes.add(vNodeModel);
} else {
// virtual numa node is assigned to a host numa node
assignVNumaToPhysicalNuma(vNodeModel);
}
}
}
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class NumaSupportModel method getUpdateParameters.
/**
* Return a list of action parameters which contain numa pinning updates for different VMs.
* Used when accessing the numa support screen from the host list panel.
* @return List of updated numa configurations
*/
public ArrayList<ActionParametersBase> getUpdateParameters() {
final ArrayList<ActionParametersBase> parameters = new ArrayList<>();
for (Guid vmId : vmsToUpdate) {
final List<VmNumaNode> numaNodes = new ArrayList<>();
for (final VNodeModel model : numaModelsPerVm.get(vmId).values()) {
numaNodes.add(model.toVmNumaNode());
}
parameters.add(new VmNumaNodeOperationParameters(vmId, numaNodes));
}
return parameters;
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class VNodeModel method toVmNumaNode.
/**
* Convert the model representation of a virtual numa node to a real virtual numa node
* @return the numa node
*/
public VmNumaNode toVmNumaNode() {
final VmNumaNode newNode = new VmNumaNode();
newNode.setIndex(vmNumaNode.getIndex());
newNode.setId(vmNumaNode.getId());
newNode.setMemTotal(vmNumaNode.getMemTotal());
newNode.setCpuIds(vmNumaNode.getCpuIds());
if (isPinned()) {
newNode.setVdsNumaNodeList(Arrays.asList(hostNodeIndex));
}
return newNode;
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode 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);
}
}
}
use of org.ovirt.engine.core.common.businessentities.VmNumaNode in project ovirt-engine by oVirt.
the class RemoveVmNumaNodesCommand method executeCommand.
@Override
protected void executeCommand() {
boolean succeeded = false;
try {
List<VmNumaNode> vmNumaNodes = getParameters().getVmNumaNodeList();
List<Guid> guids = new ArrayList<>();
for (VmNumaNode node : vmNumaNodes) {
guids.add(node.getId());
}
vmNumaNodeDao.massRemoveNumaNodeByNumaNodeId(guids);
succeeded = true;
} finally {
setSucceeded(succeeded);
}
}
Aggregations