2017-06-06 21:22:03 +00:00
|
|
|
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
|
2018-03-08 21:35:44 +00:00
|
|
|
if args.uuid:
|
|
|
|
params['uuid'] = args.uuid
|
2017-06-06 21:22:03 +00:00
|
|
|
print_array(args.client.call(
|
2018-02-05 20:29:05 +00:00
|
|
|
'construct_malloc_bdev', params))
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
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}
|
2018-03-08 21:39:21 +00:00
|
|
|
if args.uuid:
|
|
|
|
params['uuid'] = args.uuid
|
2017-06-06 21:22:03 +00:00
|
|
|
print_array(args.client.call(
|
2018-02-05 20:29:05 +00:00
|
|
|
'construct_null_bdev', params))
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
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(
|
2018-02-05 20:29:05 +00:00
|
|
|
'construct_aio_bdev', params))
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-02-05 20:29:05 +00:00
|
|
|
args.client.call('construct_nvme_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
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(
|
2018-02-05 20:29:05 +00:00
|
|
|
'construct_rbd_bdev', params))
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
def construct_error_bdev(args):
|
|
|
|
params = {'base_name': args.base_name}
|
2018-02-05 20:29:05 +00:00
|
|
|
args.client.call('construct_error_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
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))
|
|
|
|
|
|
|
|
|
2018-02-22 12:48:13 +00:00
|
|
|
def get_bdevs_config(args):
|
|
|
|
params = {}
|
|
|
|
if args.name:
|
|
|
|
params['name'] = args.name
|
|
|
|
print_dict(args.client.call('get_bdevs_config', params))
|
|
|
|
|
|
|
|
|
2017-06-06 21:22:03 +00:00
|
|
|
def delete_bdev(args):
|
|
|
|
params = {'name': args.bdev_name}
|
2018-02-05 20:29:05 +00:00
|
|
|
args.client.call('delete_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
def bdev_inject_error(args):
|
|
|
|
params = {
|
|
|
|
'name': args.name,
|
|
|
|
'io_type': args.io_type,
|
|
|
|
'error_type': args.error_type,
|
|
|
|
'num': args.num,
|
|
|
|
}
|
|
|
|
|
2018-02-05 20:29:05 +00:00
|
|
|
args.client.call('bdev_inject_error', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
2018-02-14 21:34:55 +00:00
|
|
|
|
2017-06-06 21:22:03 +00:00
|
|
|
def apply_firmware(args):
|
|
|
|
params = {
|
|
|
|
'filename': args.filename,
|
|
|
|
'bdev_name': args.bdev_name,
|
|
|
|
}
|
|
|
|
print_dict(args.client.call('apply_nvme_firmware', params))
|