From c43dc1f1e3d952a4db6bed35f778d7feddb8e1aa Mon Sep 17 00:00:00 2001 From: Karol Latecki Date: Fri, 13 Apr 2018 13:50:56 +0200 Subject: [PATCH] scripts/rpc.py: calculate num_blocks with floor division If called with python 3 num_blocks will be calculated as float number with .0 decimal part. Change to floor division so that is't always int. Change-Id: Ic0aae404e21a1bdfe7db291532d80d4b4598d307 Signed-off-by: Karol Latecki Reviewed-on: https://review.gerrithub.io/407547 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- scripts/rpc/bdev.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/rpc/bdev.py b/scripts/rpc/bdev.py index 56aa9bfec..f2b975d3b 100755 --- a/scripts/rpc/bdev.py +++ b/scripts/rpc/bdev.py @@ -1,5 +1,5 @@ def construct_malloc_bdev(client, args): - num_blocks = (args.total_size * 1024 * 1024) / args.block_size + num_blocks = (args.total_size * 1024 * 1024) // args.block_size params = {'num_blocks': num_blocks, 'block_size': args.block_size} if args.name: params['name'] = args.name @@ -9,7 +9,7 @@ def construct_malloc_bdev(client, args): def construct_null_bdev(client, args): - num_blocks = (args.total_size * 1024 * 1024) / args.block_size + num_blocks = (args.total_size * 1024 * 1024) // args.block_size params = {'name': args.name, 'num_blocks': num_blocks, 'block_size': args.block_size} if args.uuid: