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 <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/409744
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Seth Howell 2018-05-02 10:59:29 -07:00 committed by Daniel Verkamp
parent 90dfc392cc
commit de139e8c8b

View File

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