Search in sources :

Example 1 with DiskProfiles

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

the class AbstractBackendDiskProfilesResource method mapCollection.

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

Example 2 with DiskProfiles

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

the class V3DiskProfilesInAdapter method adapt.

@Override
public DiskProfiles adapt(V3DiskProfiles from) {
    DiskProfiles to = new DiskProfiles();
    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.getDiskProfiles().addAll(adaptIn(from.getDiskProfiles()));
    return to;
}
Also used : V3DiskProfiles(org.ovirt.engine.api.v3.types.V3DiskProfiles) DiskProfiles(org.ovirt.engine.api.model.DiskProfiles)

Aggregations

DiskProfiles (org.ovirt.engine.api.model.DiskProfiles)2 HashMap (java.util.HashMap)1 DiskProfile (org.ovirt.engine.api.model.DiskProfile)1 Qos (org.ovirt.engine.api.model.Qos)1 V3DiskProfiles (org.ovirt.engine.api.v3.types.V3DiskProfiles)1 StorageQos (org.ovirt.engine.core.common.businessentities.qos.StorageQos)1 Guid (org.ovirt.engine.core.compat.Guid)1