Spdk/python/spdk/rpc/ublk.py
Yifan Bian 90a6407df6 ublk: add an rpc method to get current ublk devices
Signed-off-by: Yifan Bian <yifan.bian@intel.com>
Co-authored-by: Xiaodong Liu <xiaodong.liu@intel.com>
Change-Id: I3fdf9795b90d7a30478ba81d8144bbf2f1cbdd2a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15987
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
2023-01-20 07:48:25 +00:00

38 lines
976 B
Python

# SPDX-License-Identifier: BSD-3-Clause
# Copyright (C) 2022 Intel Corporation.
# All rights reserved.
def ublk_create_target(client, cpumask=None):
params = {}
if cpumask:
params['cpumask'] = cpumask
return client.call('ublk_create_target', params)
def ublk_destroy_target(client):
return client.call('ublk_destroy_target')
def ublk_start_disk(client, bdev_name, ublk_id=1, num_queues=1, queue_depth=128):
params = {
'bdev_name': bdev_name,
'ublk_id': ublk_id
}
if num_queues:
params['num_queues'] = num_queues
if queue_depth:
params['queue_depth'] = queue_depth
return client.call('ublk_start_disk', params)
def ublk_stop_disk(client, ublk_id=1):
params = {'ublk_id': ublk_id}
return client.call('ublk_stop_disk', params)
def ublk_get_disks(client, ublk_id=1):
params = {}
if ublk_id:
params['ublk_id'] = ublk_id
return client.call('ublk_get_disks', params)