Search in sources :

Example 1 with NumaNodePin

use of org.ovirt.engine.api.model.NumaNodePin in project ovirt-engine by oVirt.

the class NumaMapper method map.

@Mapping(from = VirtualNumaNode.class, to = VmNumaNode.class)
public static VmNumaNode map(VirtualNumaNode model, VmNumaNode template) {
    VmNumaNode entity = template != null ? template : new VmNumaNode();
    if (model.isSetId()) {
        entity.setId(GuidUtils.asGuid(model.getId()));
    }
    if (entity.getId() == null) {
        entity.setId(Guid.newGuid());
    }
    if (model.isSetIndex()) {
        entity.setIndex(model.getIndex());
    }
    Cpu cpu = model.getCpu();
    if (cpu != null) {
        List<Integer> ids = new ArrayList<>();
        Cores cores = cpu.getCores();
        if (cores != null) {
            for (Core core : cores.getCores()) {
                Integer index = core.getIndex();
                if (index != null) {
                    ids.add(index);
                }
            }
        }
        entity.setCpuIds(ids);
    }
    if (model.isSetMemory()) {
        entity.setMemTotal(model.getMemory());
    }
    if (model.isSetNumaNodePins()) {
        entity.setVdsNumaNodeList(model.getNumaNodePins().getNumaNodePins().stream().map(NumaNodePin::getIndex).collect(Collectors.toList()));
    }
    return entity;
}
Also used : Cores(org.ovirt.engine.api.model.Cores) VmNumaNode(org.ovirt.engine.core.common.businessentities.VmNumaNode) ArrayList(java.util.ArrayList) Cpu(org.ovirt.engine.api.model.Cpu) NumaNodePin(org.ovirt.engine.api.model.NumaNodePin) Core(org.ovirt.engine.api.model.Core)

Example 2 with NumaNodePin

use of org.ovirt.engine.api.model.NumaNodePin in project ovirt-engine by oVirt.

the class V3NumaNodePinInAdapter method adapt.

@Override
public NumaNodePin adapt(V3NumaNodePin from) {
    NumaNodePin to = new NumaNodePin();
    if (from.isSetHostNumaNode()) {
        to.setHostNumaNode(adaptIn(from.getHostNumaNode()));
    }
    if (from.isSetIndex()) {
        to.setIndex(from.getIndex());
    }
    to.setPinned(from.isPinned());
    return to;
}
Also used : V3NumaNodePin(org.ovirt.engine.api.v3.types.V3NumaNodePin) NumaNodePin(org.ovirt.engine.api.model.NumaNodePin)

Aggregations

NumaNodePin (org.ovirt.engine.api.model.NumaNodePin)2 ArrayList (java.util.ArrayList)1 Core (org.ovirt.engine.api.model.Core)1 Cores (org.ovirt.engine.api.model.Cores)1 Cpu (org.ovirt.engine.api.model.Cpu)1 V3NumaNodePin (org.ovirt.engine.api.v3.types.V3NumaNodePin)1 VmNumaNode (org.ovirt.engine.core.common.businessentities.VmNumaNode)1