jsonrpc.md: document NBD RPC methods
Change-Id: Ia4ea6986c2282b3a56ec48ca4f9b0ad05e95e7f1 Signed-off-by: Xiaodong Liu <xiaodong.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450578 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
5f51f0aff6
commit
9baab97fab
127
doc/jsonrpc.md
127
doc/jsonrpc.md
@ -5115,6 +5115,133 @@ Example response:
|
|||||||
}
|
}
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
|
# Linux Network Block Device (NBD) {#jsonrpc_components_nbd}
|
||||||
|
|
||||||
|
SPDK supports exporting bdevs through Linux nbd. These devices then appear as standard Linux kernel block devices and can be accessed using standard utilities like fdisk.
|
||||||
|
|
||||||
|
In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.
|
||||||
|
|
||||||
|
## start_nbd_disk {#rpc_start_nbd_disk}
|
||||||
|
|
||||||
|
Start to export one SPDK bdev as NBD disk
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Optional | Type | Description
|
||||||
|
----------------------- | -------- | ----------- | -----------
|
||||||
|
bdev_name | Required | string | Bdev name to export
|
||||||
|
nbd_device | Optional | string | NBD device name to assign
|
||||||
|
|
||||||
|
### Response
|
||||||
|
|
||||||
|
Path of exported NBD disk
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Example request:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
{
|
||||||
|
"params": {
|
||||||
|
"nbd_device": "/dev/nbd1",
|
||||||
|
"bdev_name": "Malloc1"
|
||||||
|
},
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "start_nbd_disk",
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Example response:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 1,
|
||||||
|
"result": "/dev/nbd1"
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## stop_nbd_disk {#rpc_stop_nbd_disk}
|
||||||
|
|
||||||
|
Stop one NBD disk which is based on SPDK bdev.
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Optional | Type | Description
|
||||||
|
----------------------- | -------- | ----------- | -----------
|
||||||
|
nbd_device | Required | string | NBD device name to stop
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Example request:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
{
|
||||||
|
"params": {
|
||||||
|
"nbd_device": "/dev/nbd1",
|
||||||
|
},
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "stop_nbd_disk",
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Example response:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 1,
|
||||||
|
"result": "true"
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## get_nbd_disks {#rpc_get_nbd_disks}
|
||||||
|
|
||||||
|
Display all or specified NBD device list
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Optional | Type | Description
|
||||||
|
----------------------- | -------- | ----------- | -----------
|
||||||
|
nbd_device | Optional | string | NBD device name to display
|
||||||
|
|
||||||
|
### Response
|
||||||
|
|
||||||
|
The response is an array of exported NBD devices and their corresponding SPDK bdev.
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
Example request:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"method": "get_nbd_disks",
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
|
Example response:
|
||||||
|
|
||||||
|
~~~
|
||||||
|
{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 1,
|
||||||
|
"result": [
|
||||||
|
{
|
||||||
|
"bdev_name": "Malloc0",
|
||||||
|
"nbd_device": "/dev/nbd0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"bdev_name": "Malloc1",
|
||||||
|
"nbd_device": "/dev/nbd1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
~~~
|
||||||
|
|
||||||
# Miscellaneous RPC commands
|
# Miscellaneous RPC commands
|
||||||
|
|
||||||
## send_nvme_cmd {#rpc_send_nvme_cmd}
|
## send_nvme_cmd {#rpc_send_nvme_cmd}
|
||||||
|
Loading…
Reference in New Issue
Block a user