From 7687cf128030539f054b5719643f12dbf152e3b2 Mon Sep 17 00:00:00 2001 From: Bence Romsics Date: Mon, 19 Jul 2021 15:47:51 +0200 Subject: [PATCH] bw-limit: Pass int parameters to Open vSwitch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure we pass integer values to ovs when configuring bandwidth limit. This was likely working properly with Python2, and we may have missed this when migrating to Python3: https://www.python.org/dev/peps/pep-0238/ Change-Id: I2f8d974d6644657aea95302d94ca0095d70a7e62 Closes-Bug: #1936839 Co-Authored-By: Tamás Trásy (cherry picked from commit 8261b67b6e6248c5cc1a4426544188e5bd9bfa03) (cherry picked from commit 38551777e027847e67e00b0bbcc920be98ab5d57) (cherry picked from commit 82e2a3d3620feda0804bdf1af42c977f3d981435) --- neutron/agent/common/ovs_lib.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/neutron/agent/common/ovs_lib.py b/neutron/agent/common/ovs_lib.py index e3ca362ae48..8daf10ebac1 100644 --- a/neutron/agent/common/ovs_lib.py +++ b/neutron/agent/common/ovs_lib.py @@ -842,11 +842,11 @@ class OVSBridge(BaseOVS): def _update_ingress_bw_limit_for_port( self, port_name, max_bw_in_bits, max_burst_in_bits): qos_other_config = { - 'max-rate': str(max_bw_in_bits) + 'max-rate': str(int(max_bw_in_bits)) } queue_other_config = { - 'max-rate': str(max_bw_in_bits), - 'burst': str(max_burst_in_bits), + 'max-rate': str(int(max_bw_in_bits)), + 'burst': str(int(max_burst_in_bits)), } qos = self.find_qos(port_name) queue = self.find_queue(port_name, QOS_DEFAULT_QUEUE) @@ -870,8 +870,8 @@ class OVSBridge(BaseOVS): self, port_name, max_bw_in_bits, max_burst_in_bits): # cir and cbs should be set in bytes instead of bits qos_other_config = { - 'cir': str(max_bw_in_bits / 8), - 'cbs': str(max_burst_in_bits / 8) + 'cir': str(max_bw_in_bits // 8), + 'cbs': str(max_burst_in_bits // 8) } qos = self.find_qos(port_name) qos_uuid = qos['_uuid'] if qos else None