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 <karol.latecki@intel.com>
Reviewed-on: https://review.gerrithub.io/407547
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Karol Latecki 2018-04-13 13:50:56 +02:00 committed by Jim Harris
parent df159388ff
commit c43dc1f1e3

View File

@ -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: