From de139e8c8bcc856ca20aee64640d323bb1364968 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Wed, 2 May 2018 10:59:29 -0700 Subject: [PATCH] rpc: truncate num_blocks in create_pmem_pool Python2 implicitly truncated the division of pool_size/block_size. If there is any remainder in pyhton3, the value stored in num_blocks is kept as a float. The cast to integer truncates this division resulting in the same behavior between python2 and python3 Change-Id: I0a04bba7f3a74d12890498494bf9e58abb698b77 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/409744 Tested-by: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Daniel Verkamp --- scripts/rpc/pmem.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/rpc/pmem.py b/scripts/rpc/pmem.py index 7ccf8baf0..cd01fc61c 100755 --- a/scripts/rpc/pmem.py +++ b/scripts/rpc/pmem.py @@ -1,5 +1,6 @@ def create_pmem_pool(client, args): - num_blocks = (args.total_size * 1024 * 1024) / args.block_size + # truncate to the nearest block. + num_blocks = int((args.total_size * 1024 * 1024) / args.block_size) params = {'pmem_file': args.pmem_file, 'num_blocks': num_blocks, 'block_size': args.block_size}