2018-03-27 21:31:52 +00:00
|
|
|
def construct_malloc_bdev(client, args):
|
2018-04-13 11:50:56 +00:00
|
|
|
num_blocks = (args.total_size * 1024 * 1024) // args.block_size
|
2017-06-06 21:22:03 +00:00
|
|
|
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
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_malloc_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def construct_null_bdev(client, args):
|
2018-04-13 11:50:56 +00:00
|
|
|
num_blocks = (args.total_size * 1024 * 1024) // args.block_size
|
2017-06-06 21:22:03 +00:00
|
|
|
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
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_null_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def construct_aio_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {'name': args.name,
|
|
|
|
'filename': args.filename}
|
|
|
|
|
|
|
|
if args.block_size:
|
|
|
|
params['block_size'] = args.block_size
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_aio_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def construct_nvme_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
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-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_nvme_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def construct_rbd_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {
|
|
|
|
'pool_name': args.pool_name,
|
|
|
|
'rbd_name': args.rbd_name,
|
|
|
|
'block_size': args.block_size,
|
|
|
|
}
|
2018-02-23 19:05:47 +00:00
|
|
|
|
|
|
|
if args.name:
|
|
|
|
params['name'] = args.name
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_rbd_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def construct_error_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {'base_name': args.base_name}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_error_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def construct_pmem_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {
|
|
|
|
'pmem_file': args.pmem_file,
|
|
|
|
'name': args.name
|
|
|
|
}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('construct_pmem_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-04-08 01:53:31 +00:00
|
|
|
def construct_passthru_bdev(client, args):
|
|
|
|
params = {
|
|
|
|
'base_bdev_name': args.base_bdev_name,
|
|
|
|
'passthru_bdev_name': args.passthru_bdev_name,
|
|
|
|
}
|
|
|
|
return client.call('construct_passthru_bdev', params)
|
|
|
|
|
|
|
|
|
2018-03-16 18:27:57 +00:00
|
|
|
def construct_split_vbdev(client, args):
|
|
|
|
params = {
|
|
|
|
'base_bdev': args.base_bdev,
|
|
|
|
'split_count': args.split_count,
|
|
|
|
}
|
|
|
|
if args.split_size_mb:
|
|
|
|
params['split_size_mb'] = args.split_size_mb
|
|
|
|
|
|
|
|
return client.call('construct_split_vbdev', params)
|
|
|
|
|
|
|
|
|
|
|
|
def destruct_split_vbdev(client, args):
|
|
|
|
params = {
|
|
|
|
'base_bdev': args.base_bdev,
|
|
|
|
}
|
|
|
|
|
|
|
|
return client.call('destruct_split_vbdev', params)
|
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def get_bdevs(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {}
|
|
|
|
if args.name:
|
|
|
|
params['name'] = args.name
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('get_bdevs', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def get_bdevs_config(client, args):
|
2018-02-22 12:48:13 +00:00
|
|
|
params = {}
|
|
|
|
if args.name:
|
|
|
|
params['name'] = args.name
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('get_bdevs_config', params)
|
2018-02-22 12:48:13 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def delete_bdev(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {'name': args.bdev_name}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('delete_bdev', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def bdev_inject_error(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {
|
|
|
|
'name': args.name,
|
|
|
|
'io_type': args.io_type,
|
|
|
|
'error_type': args.error_type,
|
|
|
|
'num': args.num,
|
|
|
|
}
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('bdev_inject_error', params)
|
2017-06-06 21:22:03 +00:00
|
|
|
|
2018-02-14 21:34:55 +00:00
|
|
|
|
2017-12-29 08:02:08 +00:00
|
|
|
def set_bdev_qos_limit_iops(client, args):
|
|
|
|
params = {}
|
|
|
|
params['name'] = args.name
|
|
|
|
params['ios_per_sec'] = args.ios_per_sec
|
|
|
|
return client.call('set_bdev_qos_limit_iops', params)
|
|
|
|
|
|
|
|
|
2018-03-27 21:31:52 +00:00
|
|
|
def apply_firmware(client, args):
|
2017-06-06 21:22:03 +00:00
|
|
|
params = {
|
|
|
|
'filename': args.filename,
|
|
|
|
'bdev_name': args.bdev_name,
|
|
|
|
}
|
2018-03-27 21:31:52 +00:00
|
|
|
return client.call('apply_nvme_firmware', params)
|