Search in sources :

Example 1 with CpuProfiles

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

the class AbstractBackendCpuProfilesResource method mapCollection.

protected CpuProfiles mapCollection(List<org.ovirt.engine.core.common.businessentities.profiles.CpuProfile> entities) {
    CpuProfiles collection = new CpuProfiles();
    Map<Guid, Qos> qosMap = new HashMap<>();
    for (org.ovirt.engine.core.common.businessentities.profiles.CpuProfile entity : entities) {
        CpuProfile profile = populate(map(entity), entity);
        collection.getCpuProfiles().add(profile);
        if (entity.getQosId() != null) {
            qosMap.put(entity.getQosId(), profile.getQos());
        }
    }
    handleQosDataCenterLinks(qosMap);
    for (CpuProfile cpuProfile : collection.getCpuProfiles()) {
        addLinks(cpuProfile);
    }
    return collection;
}
Also used : CpuProfiles(org.ovirt.engine.api.model.CpuProfiles) Qos(org.ovirt.engine.api.model.Qos) CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) HashMap(java.util.HashMap) CpuProfile(org.ovirt.engine.api.model.CpuProfile) Guid(org.ovirt.engine.core.compat.Guid)

Example 2 with CpuProfiles

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

the class V3CpuProfilesInAdapter method adapt.

@Override
public CpuProfiles adapt(V3CpuProfiles from) {
    CpuProfiles to = new CpuProfiles();
    if (from.isSetActions()) {
        to.setActions(adaptIn(from.getActions()));
    }
    if (from.isSetActive()) {
        to.setActive(from.getActive());
    }
    if (from.isSetSize()) {
        to.setSize(from.getSize());
    }
    if (from.isSetTotal()) {
        to.setTotal(from.getTotal());
    }
    to.getCpuProfiles().addAll(adaptIn(from.getCpuProfiles()));
    return to;
}
Also used : V3CpuProfiles(org.ovirt.engine.api.v3.types.V3CpuProfiles) CpuProfiles(org.ovirt.engine.api.model.CpuProfiles)

Aggregations

CpuProfiles (org.ovirt.engine.api.model.CpuProfiles)2 HashMap (java.util.HashMap)1 CpuProfile (org.ovirt.engine.api.model.CpuProfile)1 Qos (org.ovirt.engine.api.model.Qos)1 V3CpuProfiles (org.ovirt.engine.api.v3.types.V3CpuProfiles)1 CpuQos (org.ovirt.engine.core.common.businessentities.qos.CpuQos)1 Guid (org.ovirt.engine.core.compat.Guid)1