Search in sources :

Example 6 with Qos

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

the class CpuProfileMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.profiles.CpuProfile.class, to = CpuProfile.class)
public static CpuProfile map(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile entity, CpuProfile template) {
    CpuProfile model = template != null ? template : new CpuProfile();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getName() != null) {
        model.setName(entity.getName());
    }
    if (entity.getDescription() != null) {
        model.setDescription(entity.getDescription());
    }
    if (entity.getClusterId() != null) {
        model.setCluster(new Cluster());
        model.getCluster().setId(entity.getClusterId().toString());
    }
    if (entity.getQosId() != null) {
        model.setQos(new Qos());
        model.getQos().setId(entity.getQosId().toString());
    }
    return model;
}
Also used : Qos(org.ovirt.engine.api.model.Qos) CpuProfile(org.ovirt.engine.api.model.CpuProfile) Cluster(org.ovirt.engine.api.model.Cluster)

Example 7 with Qos

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

the class DiskProfileMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.profiles.DiskProfile.class, to = DiskProfile.class)
public static DiskProfile map(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile entity, DiskProfile template) {
    DiskProfile model = template != null ? template : new DiskProfile();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getName() != null) {
        model.setName(entity.getName());
    }
    if (entity.getDescription() != null) {
        model.setDescription(entity.getDescription());
    }
    if (entity.getStorageDomainId() != null) {
        model.setStorageDomain(new StorageDomain());
        model.getStorageDomain().setId(entity.getStorageDomainId().toString());
    }
    if (entity.getQosId() != null) {
        model.setQos(new Qos());
        model.getQos().setId(entity.getQosId().toString());
    }
    return model;
}
Also used : StorageDomain(org.ovirt.engine.api.model.StorageDomain) Qos(org.ovirt.engine.api.model.Qos) DiskProfile(org.ovirt.engine.api.model.DiskProfile)

Example 8 with Qos

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

the class VnicProfileMapper method map.

@Mapping(from = org.ovirt.engine.core.common.businessentities.network.VnicProfile.class, to = VnicProfile.class)
public static VnicProfile map(org.ovirt.engine.core.common.businessentities.network.VnicProfile entity, VnicProfile template) {
    VnicProfile model = template != null ? template : new VnicProfile();
    if (entity.getId() != null) {
        model.setId(entity.getId().toString());
    }
    if (entity.getName() != null) {
        model.setName(entity.getName());
    }
    if (entity.getDescription() != null) {
        model.setDescription(entity.getDescription());
    }
    if (entity.getNetworkId() != null) {
        model.setNetwork(new Network());
        model.getNetwork().setId(entity.getNetworkId().toString());
    }
    model.setPortMirroring(entity.isPortMirroring());
    if (entity.getCustomProperties() != null && !entity.getCustomProperties().isEmpty()) {
        CustomProperties hooks = new CustomProperties();
        hooks.getCustomProperties().addAll(CustomPropertiesParser.parse(DevicePropertiesUtils.getInstance().convertProperties(entity.getCustomProperties()), false));
        model.setCustomProperties(hooks);
    }
    if (entity.getNetworkQosId() != null) {
        model.setQos(new Qos());
        model.getQos().setId(entity.getNetworkQosId().toString());
    }
    final VnicPassThrough vnicPassThrough = new VnicPassThrough();
    vnicPassThrough.setMode(map(entity.isPassthrough()));
    model.setPassThrough(vnicPassThrough);
    if (entity.getNetworkFilterId() != null) {
        model.setNetworkFilter(new NetworkFilter());
        model.getNetworkFilter().setId(entity.getNetworkFilterId().toString());
    }
    if (entity.isPassthrough()) {
        model.setMigratable(entity.isMigratable());
    }
    return model;
}
Also used : VnicPassThrough(org.ovirt.engine.api.model.VnicPassThrough) Qos(org.ovirt.engine.api.model.Qos) Network(org.ovirt.engine.api.model.Network) NetworkFilter(org.ovirt.engine.api.model.NetworkFilter) VnicProfile(org.ovirt.engine.api.model.VnicProfile) CustomProperties(org.ovirt.engine.api.model.CustomProperties)

Example 9 with Qos

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

the class HostNicMapperTest method postPopulate.

@Override
protected HostNic postPopulate(HostNic model) {
    HostNic hostNIC = super.postPopulate(model);
    Qos qos = hostNIC.getQos();
    qos.setType(QosType.HOSTNETWORK);
    qos.setName(null);
    qos.setDataCenter(null);
    model.setBootProtocol(MappingTestHelper.shuffle(BootProtocol.class, BootProtocol.AUTOCONF));
    return hostNIC;
}
Also used : Qos(org.ovirt.engine.api.model.Qos) HostNic(org.ovirt.engine.api.model.HostNic) BootProtocol(org.ovirt.engine.api.model.BootProtocol)

Example 10 with Qos

use of org.ovirt.engine.api.model.Qos 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)

Aggregations

Qos (org.ovirt.engine.api.model.Qos)12 DataCenter (org.ovirt.engine.api.model.DataCenter)4 Guid (org.ovirt.engine.core.compat.Guid)4 HashMap (java.util.HashMap)3 CpuQos (org.ovirt.engine.core.common.businessentities.qos.CpuQos)3 StorageQos (org.ovirt.engine.core.common.businessentities.qos.StorageQos)3 QosQueryParameterBase (org.ovirt.engine.core.common.queries.QosQueryParameterBase)3 CpuProfile (org.ovirt.engine.api.model.CpuProfile)2 DiskProfile (org.ovirt.engine.api.model.DiskProfile)2 VnicProfile (org.ovirt.engine.api.model.VnicProfile)2 BootProtocol (org.ovirt.engine.api.model.BootProtocol)1 Cluster (org.ovirt.engine.api.model.Cluster)1 CpuProfiles (org.ovirt.engine.api.model.CpuProfiles)1 CustomProperties (org.ovirt.engine.api.model.CustomProperties)1 DiskProfiles (org.ovirt.engine.api.model.DiskProfiles)1 HostNic (org.ovirt.engine.api.model.HostNic)1 Network (org.ovirt.engine.api.model.Network)1 NetworkFilter (org.ovirt.engine.api.model.NetworkFilter)1 StorageDomain (org.ovirt.engine.api.model.StorageDomain)1 VnicPassThrough (org.ovirt.engine.api.model.VnicPassThrough)1