Lior Vernia has uploaded a new change for review. Change subject: engine: Serialize null QoS to empty dictionary entry ......................................................................
engine: Serialize null QoS to empty dictionary entry Previously it was serialized to no dictionary entry at all, in which case the VDSM would leave the QoS settings as they already were (instead of overwriting them to be unlimited). Change-Id: I6a1316f81a7b89783eae04c055e2e686df5e7c98 Bug-Url: https://bugzilla.redhat.com/1077684 Signed-off-by: Lior Vernia <lver...@redhat.com> (cherry picked from commit d6e0c4f3c4a9c7cf7f59285db68cc594d9e08816) --- M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/NetworkQosMapper.java 1 file changed, 7 insertions(+), 8 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/36/26736/1 diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/NetworkQosMapper.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/NetworkQosMapper.java index 1b7d5c6..679c56a 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/NetworkQosMapper.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/vdsbroker/NetworkQosMapper.java @@ -21,10 +21,10 @@ } public void serialize(NetworkQoS qos) { - if (qos != null) { - addQosData(inboundEntry, qos.getInboundAverage(), qos.getInboundPeak(), qos.getInboundBurst()); - addQosData(outboundEntry, qos.getOutboundAverage(), qos.getOutboundPeak(), qos.getOutboundBurst()); - } + map.put(inboundEntry, + constructQosData(qos.getInboundAverage(), qos.getInboundPeak(), qos.getInboundBurst())); + map.put(outboundEntry, + constructQosData(qos.getOutboundAverage(), qos.getOutboundPeak(), qos.getOutboundBurst())); } public NetworkQoS deserialize() { @@ -48,15 +48,14 @@ return qos; } - private void addQosData(String qosEntryName, Integer average, Integer peak, Integer burst) { - + private Map<String, Integer> constructQosData(Integer average, Integer peak, Integer burst) { + Map<String, Integer> qosData = new HashMap<>(); if (average != null && average > 0) { - Map<String, Integer> qosData = new HashMap<>(); qosData.put(VdsProperties.QOS_AVERAGE, average * MEGABITS_TO_KILOBYTES); qosData.put(VdsProperties.QOS_PEAK, peak * MEGABITS_TO_KILOBYTES); qosData.put(VdsProperties.QOS_BURST, burst * MEGABYTES_TO_KILOBYTES); - map.put(qosEntryName, qosData); } + return qosData; } private static Integer divide(Integer num, int divisor) { -- To view, visit http://gerrit.ovirt.org/26736 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6a1316f81a7b89783eae04c055e2e686df5e7c98 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.4 Gerrit-Owner: Lior Vernia <lver...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches