Search in sources :

Example 1 with NetworkQoS

use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.

the class NetworkQosValidatorTest method nameNotChangedOrNotTakenTest.

private void nameNotChangedOrNotTakenTest(Matcher<ValidationResult> matcher) {
    NetworkQoS otherQos = new NetworkQoS();
    allQos.add(otherQos);
    allQos.add(oldQos);
    otherQos.setName("foo");
    oldQos.setName("bar");
    assertThat(validator.nameNotChangedOrNotTaken(), matcher);
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Example 2 with NetworkQoS

use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS 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 3 with NetworkQoS

use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.

the class NetworkQosMapper method deserialize.

public NetworkQoS deserialize() {
    Map<String, Integer> inboundData = (Map<String, Integer>) map.get(inboundEntry);
    Map<String, Integer> outboundData = (Map<String, Integer>) map.get(outboundEntry);
    if (inboundData == null && outboundData == null) {
        return null;
    }
    NetworkQoS qos = new NetworkQoS();
    if (inboundData != null) {
        qos.setInboundAverage(divide(inboundData.get(VdsProperties.QOS_AVERAGE), MEGABITS_TO_KILOBYTES));
        qos.setInboundPeak(divide(inboundData.get(VdsProperties.QOS_PEAK), MEGABITS_TO_KILOBYTES));
        qos.setInboundBurst(divide(inboundData.get(VdsProperties.QOS_BURST), MEGABYTES_TO_KILOBYTES));
    }
    if (outboundData != null) {
        qos.setOutboundAverage(divide(outboundData.get(VdsProperties.QOS_AVERAGE), MEGABITS_TO_KILOBYTES));
        qos.setOutboundPeak(divide(outboundData.get(VdsProperties.QOS_PEAK), MEGABITS_TO_KILOBYTES));
        qos.setOutboundBurst(divide(outboundData.get(VdsProperties.QOS_BURST), MEGABYTES_TO_KILOBYTES));
    }
    return qos;
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with NetworkQoS

use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.

the class AsyncDataProvider method getAllNetworkQos.

public void getAllNetworkQos(Guid dcId, AsyncQuery<List<NetworkQoS>> query) {
    query.converterCallback = new ListConverter<NetworkQoS>() {

        @Override
        public List<NetworkQoS> convert(List<NetworkQoS> returnValue) {
            List<NetworkQoS> qosList = super.convert(returnValue);
            qosList.add(0, NetworkQoSModel.EMPTY_QOS);
            return qosList;
        }
    };
    Frontend.getInstance().runQuery(QueryType.GetAllNetworkQosByStoragePoolId, new IdQueryParameters(dcId), query);
}
Also used : StorageDomainsAndStoragePoolIdQueryParameters(org.ovirt.engine.core.common.queries.StorageDomainsAndStoragePoolIdQueryParameters) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS) ArrayList(java.util.ArrayList) List(java.util.List)

Example 5 with NetworkQoS

use of org.ovirt.engine.core.common.businessentities.network.NetworkQoS in project ovirt-engine by oVirt.

the class DataCenterNetworkQoSListModel method edit.

public void edit() {
    final NetworkQoS networkQoS = getSelectedItem();
    if (getWindow() != null) {
        return;
    }
    final NetworkQoSModel networkQoSModel = new EditNetworkQoSModel(networkQoS, this, getEntity());
    setWindow(networkQoSModel);
    networkQoSModel.getDataCenters().setItems(Arrays.asList(getEntity()), getEntity());
}
Also used : NetworkQoS(org.ovirt.engine.core.common.businessentities.network.NetworkQoS)

Aggregations

NetworkQoS (org.ovirt.engine.core.common.businessentities.network.NetworkQoS)21 Test (org.junit.Test)6 ArrayList (java.util.ArrayList)3 QosParametersBase (org.ovirt.engine.core.common.action.QosParametersBase)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)2 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)2 List (java.util.List)1 Default (javax.validation.groups.Default)1 Before (org.junit.Before)1 DataCenter (org.ovirt.engine.api.model.DataCenter)1 Qos (org.ovirt.engine.api.model.Qos)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 Network (org.ovirt.engine.core.common.businessentities.network.Network)1 NetworkFilter (org.ovirt.engine.core.common.businessentities.network.NetworkFilter)1 VnicProfile (org.ovirt.engine.core.common.businessentities.network.VnicProfile)1 VnicProfileView (org.ovirt.engine.core.common.businessentities.network.VnicProfileView)1 QosQueryParameterBase (org.ovirt.engine.core.common.queries.QosQueryParameterBase)1 QueryParametersBase (org.ovirt.engine.core.common.queries.QueryParametersBase)1