Search in sources :

Example 1 with Qos

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

the class AbstractBackendCpuProfilesResource method handleQosDataCenterLinks.

/**
 * used to set qos's href (requires dc id).
 */
private void handleQosDataCenterLinks(Map<Guid, Qos> qosMap) {
    if (!qosMap.isEmpty()) {
        List<CpuQos> list = getBackendCollection(CpuQos.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.CPU));
        for (CpuQos cpuQos : list) {
            Qos qos = qosMap.get(cpuQos.getId());
            if (qos != null) {
                qos.setDataCenter(new DataCenter());
                qos.getDataCenter().setId(cpuQos.getStoragePoolId().toString());
            }
        }
    }
}
Also used : QosQueryParameterBase(org.ovirt.engine.core.common.queries.QosQueryParameterBase) DataCenter(org.ovirt.engine.api.model.DataCenter) Qos(org.ovirt.engine.api.model.Qos) CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos) CpuQos(org.ovirt.engine.core.common.businessentities.qos.CpuQos)

Example 2 with Qos

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

the class AbstractBackendDiskProfilesResource method handleQosDataCenterLinks.

/**
 * used to set qos's href (requires dc id).
 */
private void handleQosDataCenterLinks(Map<Guid, Qos> qosMap) {
    if (!qosMap.isEmpty()) {
        List<StorageQos> list = getBackendCollection(StorageQos.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.STORAGE));
        for (StorageQos storageQos : list) {
            Qos qos = qosMap.get(storageQos.getId());
            if (qos != null) {
                qos.setDataCenter(new DataCenter());
                qos.getDataCenter().setId(storageQos.getStoragePoolId().toString());
            }
        }
    }
}
Also used : StorageQos(org.ovirt.engine.core.common.businessentities.qos.StorageQos) QosQueryParameterBase(org.ovirt.engine.core.common.queries.QosQueryParameterBase) DataCenter(org.ovirt.engine.api.model.DataCenter) Qos(org.ovirt.engine.api.model.Qos) StorageQos(org.ovirt.engine.core.common.businessentities.qos.StorageQos)

Example 3 with Qos

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

the class AbstractBackendVnicProfilesResource method mapCollection.

protected VnicProfiles mapCollection(List<org.ovirt.engine.core.common.businessentities.network.VnicProfile> entities) {
    VnicProfiles collection = new VnicProfiles();
    Map<Guid, Qos> qosMap = new HashMap<>();
    for (org.ovirt.engine.core.common.businessentities.network.VnicProfile entity : entities) {
        VnicProfile profile = populate(map(entity), entity);
        collection.getVnicProfiles().add(profile);
        if (entity.getNetworkQosId() != null) {
            qosMap.put(entity.getNetworkQosId(), profile.getQos());
        }
    }
    handleQosDataCenterLinks(qosMap);
    for (VnicProfile vnicProfile : collection.getVnicProfiles()) {
        addLinks(vnicProfile);
    }
    return collection;
}
Also used : Qos(org.ovirt.engine.api.model.Qos) HashMap(java.util.HashMap) VnicProfile(org.ovirt.engine.api.model.VnicProfile) VnicProfiles(org.ovirt.engine.api.model.VnicProfiles) Guid(org.ovirt.engine.core.compat.Guid)

Example 4 with Qos

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

the class AbstractBackendVnicProfilesResource method handleQosDataCenterLinks.

/**
 * used to set qos's href (requires dc id).
 */
private void handleQosDataCenterLinks(Map<Guid, Qos> qosMap) {
    if (!qosMap.isEmpty()) {
        List<NetworkQoS> list = getBackendCollection(NetworkQoS.class, QueryType.GetAllQosByType, new QosQueryParameterBase(null, QosType.NETWORK));
        for (NetworkQoS networkQoS : list) {
            Qos qos = qosMap.get(networkQoS.getId());
            if (qos != null) {
                qos.setDataCenter(new DataCenter());
                qos.getDataCenter().setId(networkQoS.getStoragePoolId().toString());
            }
        }
    }
}
Also used : QosQueryParameterBase(org.ovirt.engine.core.common.queries.QosQueryParameterBase) DataCenter(org.ovirt.engine.api.model.DataCenter) Qos(org.ovirt.engine.api.model.Qos) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Example 5 with Qos

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

the class BackendQosResource method get.

@Override
public Qos get() {
    IdQueryParameters params = new IdQueryParameters(guid);
    Qos qos = performGet(QueryType.GetQosById, params);
    return qos;
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) Qos(org.ovirt.engine.api.model.Qos)

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