numam-spdk/scripts/rpc/pmem.py
Seth Howell de139e8c8b 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>
2018-05-03 19:46:28 +00:00

18 lines
584 B
Python
Executable File

def create_pmem_pool(client, args):
# 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}
return client.call('create_pmem_pool', params)
def pmem_pool_info(client, args):
params = {'pmem_file': args.pmem_file}
return client.call('pmem_pool_info', params)
def delete_pmem_pool(client, args):
params = {'pmem_file': args.pmem_file}
return client.call('delete_pmem_pool', params)