Commit de139e8c authored by Seth Howell's avatar Seth Howell Committed by Daniel Verkamp
Browse files

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: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/409744


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 90dfc392
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
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}