Search in sources :

Example 6 with HostNetworkQos

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

the class HostNetworkQosMapper method deserialize.

public HostNetworkQos deserialize() {
    Map<String, Object> qosEntry = (Map<String, Object>) rootEntry.get(VdsProperties.HOST_QOS);
    if (qosEntry == null) {
        return null;
    }
    Map<String, Object> outboundEntry = (Map<String, Object>) qosEntry.get(VdsProperties.HOST_QOS_OUTBOUND);
    if (outboundEntry == null) {
        return null;
    }
    // name and DC ID are not set on purpose - anonymous QoS shouldn't have any!
    HostNetworkQos qos = new HostNetworkQos();
    qos.setOutAverageLinkshare(deserializeValue(outboundEntry, VdsProperties.HOST_QOS_LINKSHARE));
    qos.setOutAverageUpperlimit(deserializeValue(outboundEntry, VdsProperties.HOST_QOS_UPPERLIMIT, MBITS_TO_BITS));
    qos.setOutAverageRealtime(deserializeValue(outboundEntry, VdsProperties.HOST_QOS_REALTIME, MBITS_TO_BITS));
    return qos.isEmpty() ? null : qos;
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) Map(java.util.Map) HashMap(java.util.HashMap)

Example 7 with HostNetworkQos

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

the class NetworkModel method addQos.

private void addQos() {
    NewHostNetworkQosModel qosModel = new NewHostNetworkQosModel(this, getSelectedDc()) {

        @Override
        protected void postSaveAction(boolean succeeded) {
            if (succeeded) {
                List<HostNetworkQos> qosItems = new ArrayList<>(NetworkModel.this.getQos().getItems());
                qosItems.add(1, getQos());
                NetworkModel.this.getQos().setItems(qosItems);
                NetworkModel.this.getQos().setSelectedItem(getQos());
            }
            super.postSaveAction(succeeded);
        }

        @Override
        protected void cancel() {
            sourceListModel.setConfirmWindow(null);
        }
    };
    qosModel.getDataCenters().setIsChangeable(false);
    sourceListModel.setConfirmWindow(qosModel);
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) NewHostNetworkQosModel(org.ovirt.engine.ui.uicommonweb.models.datacenters.qos.NewHostNetworkQosModel) ArrayList(java.util.ArrayList)

Example 8 with HostNetworkQos

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

the class NetworkModel method flush.

public void flush() {
    network.setDataCenterId(getSelectedDc().getId());
    network.setName(getName().getEntity());
    network.setStp(getIsStpEnabled().getEntity());
    network.setDescription(getDescription().getEntity());
    network.setComment(getComment().getEntity());
    network.setVmNetwork(getIsVmNetwork().getEntity());
    String label = getNetworkLabel().getSelectedItem();
    if (getExternal().getEntity() && getConnectedToPhysicalNetwork().getEntity()) {
        label = !getUsePhysicalNetworkFromDatacenter().getEntity() ? getCustomPhysicalNetwork().getEntity() : null;
    }
    network.setLabel(StringHelper.isNotNullOrEmpty(label) ? label : null);
    network.setMtu(0);
    if (getMtu().getIsChangable()) {
        network.setMtu(Integer.parseInt(getMtu().getEntity().toString()));
    }
    network.setDnsResolverConfiguration(getDnsConfigurationModel().flush());
    network.setVlanId(null);
    if (getHasVLanTag().getEntity()) {
        network.setVlanId(Integer.parseInt(getVLanTag().getEntity().toString()));
    }
    for (VnicProfileModel profileModel : getProfiles().getItems()) {
        profileModel.flush();
    }
    if (getQos().getIsChangable()) {
        HostNetworkQos qos = getQos().getSelectedItem();
        network.setQosId(qos == EMPTY_HOST_NETWORK_QOS ? null : qos.getId());
    }
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos) NewVnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.NewVnicProfileModel) VnicProfileModel(org.ovirt.engine.ui.uicommonweb.models.profiles.VnicProfileModel)

Example 9 with HostNetworkQos

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

the class HostNetworkQosParametersModel method init.

@Override
public void init(HostNetworkQos qos) {
    if (qos == null) {
        qos = new HostNetworkQos();
    }
    getOutAverageLinkshare().setEntity(render(qos.getOutAverageLinkshare()));
    getOutAverageUpperlimit().setEntity(render(qos.getOutAverageUpperlimit()));
    getOutAverageRealtime().setEntity(render(qos.getOutAverageRealtime()));
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)

Example 10 with HostNetworkQos

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

the class HostNetworkQosValidator method requiredValuesPresent.

@Override
public ValidationResult requiredValuesPresent() {
    /*
        only getOutAverageLinkshare is mandatory, getOutAverageUpperlimit(), getOutAverageRealtime() are not.
        * */
    HostNetworkQos qos = getQos();
    boolean shouldFail = qos != null && qos.getOutAverageLinkshare() == null;
    return ValidationResult.failWith(EngineMessage.ACTION_TYPE_FAILED_HOST_NETWORK_QOS_MISSING_VALUES).when(shouldFail);
}
Also used : HostNetworkQos(org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)

Aggregations

HostNetworkQos (org.ovirt.engine.core.common.businessentities.network.HostNetworkQos)32 AnonymousHostNetworkQos (org.ovirt.engine.core.common.businessentities.network.AnonymousHostNetworkQos)11 Network (org.ovirt.engine.core.common.businessentities.network.Network)9 NetworkAttachment (org.ovirt.engine.core.common.businessentities.network.NetworkAttachment)7 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)6 Test (org.junit.Test)5 DnsResolverConfiguration (org.ovirt.engine.core.common.businessentities.network.DnsResolverConfiguration)5 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)3 Guid (org.ovirt.engine.core.compat.Guid)3 StringUtils (org.apache.commons.lang.StringUtils)2 Before (org.junit.Before)2 HostNic (org.ovirt.engine.api.model.HostNic)2 NameServer (org.ovirt.engine.core.common.businessentities.network.NameServer)2 VdsNetworkStatistics (org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics)2 EffectiveHostNetworkQos (org.ovirt.engine.core.vdsbroker.EffectiveHostNetworkQos)2 Path (java.nio.file.Path)1