numam-spdk/scripts/rpc/bdev.py
Daniel Verkamp dc6f9571c1 pep8: re-enable E302 (2 blank lines between functions)
This isn't a significant effort to fix, so let's just enable it to move
closer to the official Python PEP 8 guidelines.

Fix up the existing instances where we didn't already have two lines
between functions, and re-enable the pep8 warning.

Change-Id: I9cf5e7e32b9c6dfedbd1b0f9bc92951cbb2c8a0d
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/399949
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-02-15 11:10:41 -05:00

101 lines
2.4 KiB
Python
Executable File

from client import print_dict, print_array, int_arg
def construct_malloc_bdev(args):
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
print_array(args.client.call(
'construct_malloc_bdev', params))
def construct_null_bdev(args):
num_blocks = (args.total_size * 1024 * 1024) / args.block_size
params = {'name': args.name, 'num_blocks': num_blocks,
'block_size': args.block_size}
print_array(args.client.call(
'construct_null_bdev', params))
def construct_aio_bdev(args):
params = {'name': args.name,
'filename': args.filename}
if args.block_size:
params['block_size'] = args.block_size
print_array(args.client.call(
'construct_aio_bdev', params))
def construct_nvme_bdev(args):
params = {'name': args.name,
'trtype': args.trtype,
'traddr': args.traddr}
if args.adrfam:
params['adrfam'] = args.adrfam
if args.trsvcid:
params['trsvcid'] = args.trsvcid
if args.subnqn:
params['subnqn'] = args.subnqn
args.client.call('construct_nvme_bdev', params)
def construct_rbd_bdev(args):
params = {
'pool_name': args.pool_name,
'rbd_name': args.rbd_name,
'block_size': args.block_size,
}
print_array(args.client.call(
'construct_rbd_bdev', params))
def construct_error_bdev(args):
params = {'base_name': args.base_name}
args.client.call('construct_error_bdev', params)
def construct_pmem_bdev(args):
params = {
'pmem_file': args.pmem_file,
'name': args.name
}
print_array(args.client.call('construct_pmem_bdev', params))
def get_bdevs(args):
params = {}
if args.name:
params['name'] = args.name
print_dict(args.client.call('get_bdevs', params))
def delete_bdev(args):
params = {'name': args.bdev_name}
args.client.call('delete_bdev', params)
def bdev_inject_error(args):
params = {
'name': args.name,
'io_type': args.io_type,
'error_type': args.error_type,
'num': args.num,
}
args.client.call('bdev_inject_error', params)
def apply_firmware(args):
params = {
'filename': args.filename,
'bdev_name': args.bdev_name,
}
print_dict(args.client.call('apply_nvme_firmware', params))