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;
}
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);
}
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());
}
}
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()));
}
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);
}
Aggregations