py3: Fix ingress_bw_limit_for_dpdk_port() value conversion

Python 3 is not able to type int from string but max_bw_in_bytes is a
string in float format. This patch types first to float and then to int,
hence no ValueError is raised.

Change-Id: I7a527a58f79c1451d8593330d433f620cb0a4107
Closes-bug: #1771409
This commit is contained in:
Jakub Libosvar 2018-05-15 19:00:03 +00:00
parent ea40415d22
commit f3f2436d6d
1 changed files with 2 additions and 2 deletions

View File

@ -862,12 +862,12 @@ class OVSBridge(BaseOVS):
max_bw_in_bytes = other_config.get("cir")
if max_bw_in_bytes is not None:
max_kbps = common_utils.bits_to_kilobits(
common_utils.bytes_to_bits(int(max_bw_in_bytes)),
common_utils.bytes_to_bits(int(float(max_bw_in_bytes))),
common_constants.SI_BASE)
max_burst_in_bytes = other_config.get("cbs")
if max_burst_in_bytes is not None:
max_burst_kbit = common_utils.bits_to_kilobits(
common_utils.bytes_to_bits(int(max_burst_in_bytes)),
common_utils.bytes_to_bits(int(float(max_burst_in_bytes))),
common_constants.SI_BASE)
return max_kbps, max_burst_kbit