xref: /spdk/doc/jsonrpc.md (revision 436fa2efaecd2596d5ad8e29182bf71b3011b3ef)
1# JSON-RPC Methods {#jsonrpc}
2
3# Overview {#jsonrpc_overview}
4
5SPDK implements a [JSON-RPC 2.0](http://www.jsonrpc.org/specification) server
6to allow external management tools to dynamically configure SPDK components.
7
8## Parameters
9
10Most of the commands can take parameters. If present, parameter is validated against its domain. If this check fail
11whole command will fail with response error message [Invalid params](@ref jsonrpc_error_message).
12
13### Required parameters
14
15These parameters are mandatory. If any required parameter is missing RPC command will fail with proper error response.
16
17### Optional parameters
18
19Those parameters might be omitted. If an optional parameter is present it must be valid otherwise command will fail
20proper error response.
21
22## Error response message {#jsonrpc_error_message}
23
24Each error response will contain proper message. As much as possible the message should indicate what went wrong during
25command processing.
26
27There is ongoing effort to customize this messages but some RPC methods just return "Invalid parameters" as message body
28for any kind of error.
29
30Code   | Description
31------ | -----------
32-1     | Invalid state - given method exists but it is not callable in [current runtime state](@ref rpc_framework_start_init)
33-32600 | Invalid request - not compliant with JSON-RPC 2.0 Specification
34-32601 | Method not found
35-32602 | @ref jsonrpc_invalid_params
36-32603 | Internal error for e.g.: errors like out of memory
37-32700 | @ref jsonrpc_parser_error
38
39### Parser error {#jsonrpc_parser_error}
40
41Encountered some error during parsing request like:
42
43- the JSON object is malformed
44- parameter is too long
45- request is too long
46
47### Invalid params {#jsonrpc_invalid_params}
48
49This type of error is most common one. It mean that there is an error while processing the request like:
50
51- Parameters decoding in RPC method handler failed because required parameter is missing.
52- Unknown parameter present encountered.
53- Parameter type doesn't match expected type e.g.: given number when expected a string.
54- Parameter domain check failed.
55- Request is valid but some other error occurred during processing request. If possible message explains the error reason nature.
56
57## Adding external RPC methods
58
59SPDK includes both in-tree modules as well as the ability to use external modules.  The in-tree modules include some python
60scripts to ease the process of sending RPCs to in-tree modules.  External modules can utilize this same framework to add new RPC
61methods as follows:
62
63If PYTHONPATH doesn't include the location of the external RPC python script, it should be updated:
64
65~~~
66export PYTHONPATH=/home/user/plugin_example/
67~~~
68
69In provided location, create python module file (e.g. rpc_plugin.py) with new RPC methods.  The file should contain
70spdk_rpc_plugin_initialize() method that will be called when the plugin is loaded to define new parsers for provided subparsers
71argument that adds new RPC calls (subparsers.add_parser()).  The new parsers should use the client.call() method to call RPC
72functions registered within the external module using the SPDK_RPC_REGISTER() macro.  Example:
73
74~~~
75from rpc.client import print_json
76
77
78def example_create(client, num_blocks, block_size, name=None, uuid=None):
79    """Construct an example block device.
80
81    Args:
82        num_blocks: size of block device in blocks
83        block_size: block size of device; must be a power of 2 and at least 512
84        name: name of block device (optional)
85        uuid: UUID of block device (optional)
86
87    Returns:
88        Name of created block device.
89    """
90    params = {'num_blocks': num_blocks, 'block_size': block_size}
91    if name:
92        params['name'] = name
93    if uuid:
94        params['uuid'] = uuid
95    return client.call('bdev_example_create', params)
96
97
98def example_delete(client, name):
99    """Delete example block device.
100
101    Args:
102        bdev_name: name of bdev to delete
103    """
104    params = {'name': name}
105    return client.call('bdev_example_delete', params)
106
107
108def spdk_rpc_plugin_initialize(subparsers):
109    def bdev_example_create(args):
110        num_blocks = (args.total_size * 1024 * 1024) // args.block_size
111        print_json(example_create(args.client,
112                                  num_blocks=int(num_blocks),
113                                  block_size=args.block_size,
114                                  name=args.name,
115                                  uuid=args.uuid))
116
117    p = subparsers.add_parser('bdev_example_create',
118                              help='Create an example bdev')
119    p.add_argument('-b', '--name', help="Name of the bdev")
120    p.add_argument('-u', '--uuid', help="UUID of the bdev")
121    p.add_argument(
122        'total_size', help='Size of bdev in MB (float > 0)', type=float)
123    p.add_argument('block_size', help='Block size for this bdev', type=int)
124    p.set_defaults(func=bdev_example_create)
125
126    def bdev_example_delete(args):
127        example_delete(args.client,
128                      name=args.name)
129
130    p = subparsers.add_parser('bdev_example_delete',
131                              help='Delete an example disk')
132    p.add_argument('name', help='example bdev name')
133    p.set_defaults(func=bdev_example_delete)
134~~~
135
136Finally, call the rpc.py script with '--plugin' parameter to provide above python module name:
137
138~~~
139./scripts/rpc.py --plugin rpc_plugin bdev_example_create 10 4096
140~~~
141
142# App Framework {#jsonrpc_components_app}
143
144## spdk_kill_instance {#rpc_spdk_kill_instance}
145
146Send a signal to the application.
147
148### Parameters
149
150Name                    | Optional | Type        | Description
151----------------------- | -------- | ----------- | -----------
152sig_name                | Required | string      | Signal to send (SIGINT, SIGTERM, SIGQUIT, SIGHUP, or SIGKILL)
153
154### Example
155
156Example request:
157
158~~~
159{
160  "jsonrpc": "2.0",
161  "id": 1,
162  "method": "spdk_kill_instance",
163  "params": {
164    "sig_name": "SIGINT"
165  }
166}
167~~~
168
169Example response:
170
171~~~
172{
173  "jsonrpc": "2.0",
174  "id": 1,
175  "result": true
176}
177~~~
178
179## framework_monitor_context_switch {#rpc_framework_monitor_context_switch}
180
181Query, enable, or disable the context switch monitoring functionality.
182
183### Parameters
184
185Name                    | Optional | Type        | Description
186----------------------- | -------- | ----------- | -----------
187enabled                 | Optional | boolean     | Enable (`true`) or disable (`false`) monitoring (omit this parameter to query the current state)
188
189### Response
190
191Name                    | Type        | Description
192----------------------- | ----------- | -----------
193enabled                 | boolean     | The current state of context switch monitoring
194
195### Example
196
197Example request:
198
199~~~
200{
201  "jsonrpc": "2.0",
202  "id": 1,
203  "method": "framework_monitor_context_switch",
204  "params": {
205    "enabled": false
206  }
207}
208~~~
209
210Example response:
211
212~~~
213{
214  "jsonrpc": "2.0",
215  "id": 1,
216  "result": {
217    "enabled": false
218  }
219}
220~~~
221
222## framework_start_init {#rpc_framework_start_init}
223
224Start initialization of SPDK subsystems when it is deferred by starting SPDK application with option -w.
225During its deferral some RPCs can be used to set global parameters for SPDK subsystems.
226This RPC can be called only once.
227
228### Parameters
229
230This method has no parameters.
231
232### Response
233
234Completion status of SPDK subsystem initialization is returned as a boolean.
235
236### Example
237
238Example request:
239
240~~~
241{
242  "jsonrpc": "2.0",
243  "id": 1,
244  "method": "framework_start_init"
245}
246~~~
247
248Example response:
249
250~~~
251{
252  "jsonrpc": "2.0",
253  "id": 1,
254  "result": true
255}
256~~~
257
258## framework_wait_init {#rpc_framework_wait_init}
259
260Do not return until all subsystems have been initialized and the RPC system state is running.
261If the application is already running, this call will return immediately. This RPC can be called at any time.
262
263### Parameters
264
265This method has no parameters.
266
267### Response
268
269Returns True when subsystems have been initialized.
270
271### Example
272
273Example request:
274
275~~~
276{
277  "jsonrpc": "2.0",
278  "id": 1,
279  "method": "framework_wait_init"
280}
281~~~
282
283Example response:
284
285~~~
286{
287  "jsonrpc": "2.0",
288  "id": 1,
289  "result": true
290}
291~~~
292
293## rpc_get_methods {#rpc_rpc_get_methods}
294
295Get an array of supported RPC methods.
296
297### Parameters
298
299Name                    | Optional | Type        | Description
300----------------------- | -------- | ----------- | -----------
301current                 | Optional | boolean     | Get an array of RPC methods only callable in the current state.
302
303### Response
304
305The response is an array of supported RPC methods.
306
307### Example
308
309Example request:
310
311~~~
312{
313  "jsonrpc": "2.0",
314  "id": 1,
315  "method": "rpc_get_methods"
316}
317~~~
318
319Example response:
320
321~~~
322{
323  "jsonrpc": "2.0",
324  "id": 1,
325  "result": [
326    "framework_start_init",
327    "rpc_get_methods",
328    "scsi_get_devices",
329    "net_get_interfaces",
330    "delete_ip_address",
331    "net_interface_add_ip_address",
332    "nbd_get_disks",
333    "nbd_stop_disk",
334    "nbd_start_disk",
335    "log_get_flags",
336    "log_clear_flag",
337    "log_set_flag",
338    "log_get_level",
339    "log_set_level",
340    "log_get_print_level",
341    "log_set_print_level",
342    "iscsi_get_options",
343    "iscsi_target_node_add_lun",
344    "iscsi_get_connections",
345    "iscsi_delete_portal_group",
346    "iscsi_create_portal_group",
347    "iscsi_get_portal_groups",
348    "iscsi_delete_target_node",
349    "iscsi_target_node_remove_pg_ig_maps",
350    "iscsi_target_node_add_pg_ig_maps",
351    "iscsi_create_target_node",
352    "iscsi_get_target_nodes",
353    "iscsi_delete_initiator_group",
354    "iscsi_initiator_group_remove_initiators",
355    "iscsi_initiator_group_add_initiators",
356    "iscsi_create_initiator_group",
357    "iscsi_get_initiator_groups",
358    "iscsi_set_options",
359    "bdev_set_options",
360    "bdev_set_qos_limit",
361    "bdev_get_bdevs",
362    "bdev_get_iostat",
363    "framework_get_config",
364    "framework_get_subsystems",
365    "framework_monitor_context_switch",
366    "spdk_kill_instance",
367    "ioat_scan_accel_engine",
368    "idxd_scan_accel_engine",
369    "bdev_virtio_attach_controller",
370    "bdev_virtio_scsi_get_devices",
371    "bdev_virtio_detach_controller",
372    "bdev_aio_delete",
373    "bdev_aio_create",
374    "bdev_split_delete",
375    "bdev_split_create",
376    "bdev_error_inject_error",
377    "bdev_error_delete",
378    "bdev_error_create",
379    "bdev_passthru_create",
380    "bdev_passthru_delete"
381    "bdev_nvme_apply_firmware",
382    "bdev_nvme_detach_controller",
383    "bdev_nvme_attach_controller",
384    "bdev_null_create",
385    "bdev_malloc_delete",
386    "bdev_malloc_create",
387    "bdev_ftl_delete",
388    "bdev_ftl_create",
389    "bdev_lvol_get_lvstores",
390    "bdev_lvol_delete",
391    "bdev_lvol_resize",
392    "bdev_lvol_set_read_only",
393    "bdev_lvol_decouple_parent",
394    "bdev_lvol_inflate",
395    "bdev_lvol_rename",
396    "bdev_lvol_clone",
397    "bdev_lvol_snapshot",
398    "bdev_lvol_create",
399    "bdev_lvol_delete_lvstore",
400    "bdev_lvol_rename_lvstore",
401    "bdev_lvol_create_lvstore"
402  ]
403}
404~~~
405
406## framework_get_subsystems {#rpc_framework_get_subsystems}
407
408Get an array of name and dependency relationship of SPDK subsystems in initialization order.
409
410### Parameters
411
412None
413
414### Response
415
416The response is an array of name and dependency relationship of SPDK subsystems in initialization order.
417
418### Example
419
420Example request:
421
422~~~
423{
424  "jsonrpc": "2.0",
425  "id": 1,
426  "method": "framework_get_subsystems"
427}
428~~~
429
430Example response:
431
432~~~
433{
434  "jsonrpc": "2.0",
435  "id": 1,
436  "result": [
437    {
438      "subsystem": "accel",
439      "depends_on": []
440    },
441    {
442      "subsystem": "interface",
443      "depends_on": []
444    },
445    {
446      "subsystem": "net_framework",
447      "depends_on": [
448        "interface"
449      ]
450    },
451    {
452      "subsystem": "bdev",
453      "depends_on": [
454        "accel"
455      ]
456    },
457    {
458      "subsystem": "nbd",
459      "depends_on": [
460        "bdev"
461      ]
462    },
463    {
464      "subsystem": "nvmf",
465      "depends_on": [
466        "bdev"
467      ]
468    },
469    {
470      "subsystem": "scsi",
471      "depends_on": [
472        "bdev"
473      ]
474    },
475    {
476      "subsystem": "vhost",
477      "depends_on": [
478        "scsi"
479      ]
480    },
481    {
482      "subsystem": "iscsi",
483      "depends_on": [
484        "scsi"
485      ]
486    }
487  ]
488}
489~~~
490
491## framework_get_config {#rpc_framework_get_config}
492
493Get current configuration of the specified SPDK framework
494
495### Parameters
496
497Name                    | Optional | Type        | Description
498----------------------- | -------- | ----------- | -----------
499name                    | Required | string      | SPDK subsystem name
500
501### Response
502
503The response is current configuration of the specified SPDK subsystem.
504Null is returned if it is not retrievable by the framework_get_config method and empty array is returned if it is empty.
505
506### Example
507
508Example request:
509
510~~~
511{
512  "jsonrpc": "2.0",
513  "id": 1,
514  "method": "framework_get_config",
515  "params": {
516    "name": "bdev"
517  }
518}
519~~~
520
521Example response:
522
523~~~
524{
525  "jsonrpc": "2.0",
526  "id": 1,
527  "result": [
528    {
529      "params": {
530        "base_bdev": "Malloc2",
531        "split_size_mb": 0,
532        "split_count": 2
533      },
534      "method": "bdev_split_create"
535    },
536    {
537      "params": {
538        "trtype": "PCIe",
539        "name": "Nvme1",
540        "traddr": "0000:01:00.0"
541      },
542      "method": "bdev_nvme_attach_controller"
543    },
544    {
545      "params": {
546        "trtype": "PCIe",
547        "name": "Nvme2",
548        "traddr": "0000:03:00.0"
549      },
550      "method": "bdev_nvme_attach_controller"
551    },
552    {
553      "params": {
554        "block_size": 512,
555        "num_blocks": 131072,
556        "name": "Malloc0",
557        "uuid": "913fc008-79a7-447f-b2c4-c73543638c31"
558      },
559      "method": "bdev_malloc_create"
560    },
561    {
562      "params": {
563        "block_size": 512,
564        "num_blocks": 131072,
565        "name": "Malloc1",
566        "uuid": "dd5b8f6e-b67a-4506-b606-7fff5a859920"
567      },
568      "method": "bdev_malloc_create"
569    }
570  ]
571}
572~~~
573
574## framework_get_reactors {#rpc_framework_get_reactors}
575
576Retrieve an array of all reactors.
577
578### Parameters
579
580This method has no parameters.
581
582### Response
583
584The response is an array of all reactors.
585
586### Example
587
588Example request:
589~~~
590{
591  "jsonrpc": "2.0",
592  "method": "framework_get_reactors",
593  "id": 1
594}
595~~~
596
597Example response:
598~~~
599{
600  "jsonrpc": "2.0",
601  "id": 1,
602  "result": {
603    "tick_rate": 2400000000,
604    "reactors": [
605      {
606        "lcore": 0,
607        "busy": 41289723495,
608        "idle": 3624832946,
609        "lw_threads": [
610          {
611            "name": "app_thread",
612            "id", 1,
613            "cpumask": "1",
614            "elapsed": 44910853363
615          }
616        ]
617      }
618    ]
619  }
620}
621~~~
622
623## thread_get_stats {#rpc_thread_get_stats}
624
625Retrieve current statistics of all the threads.
626
627### Parameters
628
629This method has no parameters.
630
631### Response
632
633The response is an array of objects containing threads statistics.
634
635### Example
636
637Example request:
638~~~
639{
640  "jsonrpc": "2.0",
641  "method": "thread_get_stats",
642  "id": 1
643}
644~~~
645
646Example response:
647~~~
648{
649  "jsonrpc": "2.0",
650  "id": 1,
651  "result": {
652    "tick_rate": 2400000000,
653    "threads": [
654      {
655        "name": "app_thread",
656        "id": 1,
657	"cpumask": "1",
658        "busy": 139223208,
659        "idle": 8641080608,
660        "active_pollers_count": 1,
661        "timed_pollers_count": 2,
662        "paused_pollers_count": 0
663      }
664    ]
665  }
666}
667~~~
668
669## thread_set_cpumask {#rpc_thread_set_cpumask}
670
671Set the cpumask of the thread to the specified value. The thread may be migrated
672to one of the specified CPUs.
673
674### Parameters
675
676Name                    | Optional | Type        | Description
677----------------------- | -------- | ----------- | -----------
678id                      | Required | string      | Thread ID
679cpumask                 | Required | string      | Cpumask for this thread
680
681### Response
682
683Completion status of the operation is returned as a boolean.
684
685### Example
686
687Example request:
688
689~~~
690{
691  "jsonrpc": "2.0",
692  "method": "thread_set_cpumask",
693  "id": 1,
694  "params": {
695    "id": "1",
696    "cpumask": "1"
697  }
698}
699~~~
700
701Example response:
702
703~~~
704{
705  "jsonrpc": "2.0",
706  "id": 1,
707  "result": true
708}
709~~~
710
711## thread_get_pollers {#rpc_thread_get_pollers}
712
713Retrieve current pollers of all the threads.
714
715### Parameters
716
717This method has no parameters.
718
719### Response
720
721The response is an array of objects containing pollers of all the threads.
722
723### Example
724
725Example request:
726~~~
727{
728  "jsonrpc": "2.0",
729  "method": "thread_get_pollers",
730  "id": 1
731}
732~~~
733
734Example response:
735~~~
736{
737  "jsonrpc": "2.0",
738  "id": 1,
739  "result": {
740    "tick_rate": 2500000000,
741    "threads": [
742      {
743        "name": "app_thread",
744        "id": 1,
745        "active_pollers": [],
746        "timed_pollers": [
747          {
748            "name": "spdk_rpc_subsystem_poll",
749            "state": "waiting",
750            "run_count": 12345,
751            "busy_count": 10000,
752            "period_ticks": 10000000
753          }
754        ],
755        "paused_pollers": []
756      }
757    ]
758  }
759}
760~~~
761
762## thread_get_io_channels {#rpc_thread_get_io_channels}
763
764Retrieve current IO channels of all the threads.
765
766### Parameters
767
768This method has no parameters.
769
770### Response
771
772The response is an array of objects containing IO channels of all the threads.
773
774### Example
775
776Example request:
777~~~
778{
779  "jsonrpc": "2.0",
780  "method": "thread_get_io_channels",
781  "id": 1
782}
783~~~
784
785Example response:
786~~~
787{
788  "jsonrpc": "2.0",
789  "id": 1,
790  "result": {
791    "tick_rate": 2500000000,
792    "threads": [
793      {
794        "name": "app_thread",
795        "io_channels": [
796          {
797            "name": "nvmf_tgt",
798            "ref": 1
799          }
800        ]
801      }
802    ]
803  }
804}
805~~~
806# Block Device Abstraction Layer {#jsonrpc_components_bdev}
807
808## bdev_set_options {#rpc_bdev_set_options}
809
810Set global parameters for the block device (bdev) subsystem.  This RPC may only be called
811before SPDK subsystems have been initialized.
812
813### Parameters
814
815Name                    | Optional | Type        | Description
816----------------------- | -------- | ----------- | -----------
817bdev_io_pool_size       | Optional | number      | Number of spdk_bdev_io structures in shared buffer pool
818bdev_io_cache_size      | Optional | number      | Maximum number of spdk_bdev_io structures cached per thread
819bdev_auto_examine       | Optional | boolean     | If set to false, the bdev layer will not examine every disks automatically
820
821### Example
822
823Example request:
824
825~~~
826{
827  "jsonrpc": "2.0",
828  "id": 1,
829  "method": "bdev_set_options",
830  "params": {
831    "bdev_io_pool_size": 65536,
832    "bdev_io_cache_size": 256
833  }
834}
835~~~
836
837Example response:
838
839~~~
840{
841  "jsonrpc": "2.0",
842  "id": 1,
843  "result": true
844}
845~~~
846
847## bdev_get_bdevs {#rpc_bdev_get_bdevs}
848
849Get information about block devices (bdevs).
850
851### Parameters
852
853The user may specify no parameters in order to list all block devices, or a block device may be
854specified by name.
855
856Name                    | Optional | Type        | Description
857----------------------- | -------- | ----------- | -----------
858name                    | Optional | string      | Block device name
859
860### Response
861
862The response is an array of objects containing information about the requested block devices.
863
864### Example
865
866Example request:
867
868~~~
869{
870  "jsonrpc": "2.0",
871  "id": 1,
872  "method": "bdev_get_bdevs",
873  "params": {
874    "name": "Malloc0"
875  }
876}
877~~~
878
879Example response:
880
881~~~
882{
883  "jsonrpc": "2.0",
884  "id": 1,
885  "result": [
886    {
887      "name": "Malloc0",
888      "product_name": "Malloc disk",
889      "block_size": 512,
890      "num_blocks": 20480,
891      "claimed": false,
892      "zoned": false,
893      "supported_io_types": {
894        "read": true,
895        "write": true,
896        "unmap": true,
897        "write_zeroes": true,
898        "flush": true,
899        "reset": true,
900        "nvme_admin": false,
901        "nvme_io": false
902      },
903      "driver_specific": {}
904    }
905  ]
906}
907~~~
908
909## bdev_get_iostat {#rpc_bdev_get_iostat}
910
911Get I/O statistics of block devices (bdevs).
912
913### Parameters
914
915The user may specify no parameters in order to list all block devices, or a block device may be
916specified by name.
917
918Name                    | Optional | Type        | Description
919----------------------- | -------- | ----------- | -----------
920name                    | Optional | string      | Block device name
921
922### Response
923
924The response is an array of objects containing I/O statistics of the requested block devices.
925
926### Example
927
928Example request:
929
930~~~
931{
932  "jsonrpc": "2.0",
933  "id": 1,
934  "method": "bdev_get_iostat",
935  "params": {
936    "name": "Nvme0n1"
937  }
938}
939~~~
940
941Example response:
942
943~~~
944{
945  "jsonrpc": "2.0",
946  "id": 1,
947  "result": {
948    "tick_rate": 2200000000,
949    "bdevs" : [
950      {
951        "name": "Nvme0n1",
952        "bytes_read": 36864,
953        "num_read_ops": 2,
954        "bytes_written": 0,
955        "num_write_ops": 0,
956        "bytes_unmapped": 0,
957        "num_unmap_ops": 0,
958        "read_latency_ticks": 178904,
959        "write_latency_ticks": 0,
960        "unmap_latency_ticks": 0,
961        "queue_depth_polling_period": 2,
962        "queue_depth": 0,
963        "io_time": 0,
964        "weighted_io_time": 0
965      }
966    ]
967  }
968}
969~~~
970
971## bdev_enable_histogram {#rpc_bdev_enable_histogram}
972
973Control whether collecting data for histogram is enabled for specified bdev.
974
975### Parameters
976
977Name                    | Optional | Type        | Description
978----------------------- | -------- | ----------- | -----------
979name                    | Required | string      | Block device name
980enable                  | Required | boolean     | Enable or disable histogram on specified device
981
982### Example
983
984Example request:
985
986~~~
987{
988  "jsonrpc": "2.0",
989  "id": 1,
990  "method": "bdev_enable_histogram",
991  "params": {
992    "name": "Nvme0n1"
993    "enable": true
994  }
995}
996~~~
997
998Example response:
999
1000~~~
1001{
1002  "jsonrpc": "2.0",
1003  "id": 1,
1004  "result": true
1005}
1006~~~
1007
1008## bdev_get_histogram {#rpc_bdev_get_histogram}
1009
1010Get latency histogram for specified bdev.
1011
1012### Parameters
1013
1014Name                    | Optional | Type        | Description
1015----------------------- | -------- | ----------- | -----------
1016name                    | Required | string      | Block device name
1017
1018### Result
1019
1020Name                    | Description
1021------------------------| -----------
1022histogram               | Base64 encoded histogram
1023bucket_shift            | Granularity of the histogram buckets
1024tsc_rate                | Ticks per second
1025
1026### Example
1027
1028Example request:
1029
1030~~~
1031{
1032  "jsonrpc": "2.0",
1033  "id": 1,
1034  "method": "bdev_get_histogram",
1035  "params": {
1036    "name": "Nvme0n1"
1037  }
1038}
1039~~~
1040
1041Example response:
1042Note that histogram field is trimmed, actual encoded histogram length is ~80kb.
1043
1044~~~
1045{
1046  "jsonrpc": "2.0",
1047  "id": 1,
1048  "result": {
1049    "histogram": "AAAAAAAAAAAAAA...AAAAAAAAA==",
1050    "tsc_rate": 2300000000,
1051    "bucket_shift": 7
1052  }
1053}
1054~~~
1055
1056## bdev_set_qos_limit {#rpc_bdev_set_qos_limit}
1057
1058Set the quality of service rate limit on a bdev.
1059
1060### Parameters
1061
1062Name                    | Optional | Type        | Description
1063----------------------- | -------- | ----------- | -----------
1064name                    | Required | string      | Block device name
1065rw_ios_per_sec          | Optional | number      | Number of R/W I/Os per second to allow. 0 means unlimited.
1066rw_mbytes_per_sec       | Optional | number      | Number of R/W megabytes per second to allow. 0 means unlimited.
1067r_mbytes_per_sec        | Optional | number      | Number of Read megabytes per second to allow. 0 means unlimited.
1068w_mbytes_per_sec        | Optional | number      | Number of Write megabytes per second to allow. 0 means unlimited.
1069
1070### Example
1071
1072Example request:
1073
1074~~~
1075{
1076  "jsonrpc": "2.0",
1077  "id": 1,
1078  "method": "bdev_set_qos_limit",
1079  "params": {
1080    "name": "Malloc0"
1081    "rw_ios_per_sec": 20000
1082    "rw_mbytes_per_sec": 100
1083    "r_mbytes_per_sec": 50
1084    "w_mbytes_per_sec": 50
1085  }
1086}
1087~~~
1088
1089Example response:
1090
1091~~~
1092{
1093  "jsonrpc": "2.0",
1094  "id": 1,
1095  "result": true
1096}
1097~~~
1098
1099## bdev_ocf_create {#rpc_bdev_ocf_create}
1100
1101Construct new OCF bdev.
1102Command accepts cache mode that is going to be used.
1103Currently, we support Write-Through, Pass-Through and Write-Back OCF cache modes.
1104
1105### Parameters
1106
1107Name                    | Optional | Type        | Description
1108----------------------- | -------- | ----------- | -----------
1109name                    | Required | string      | Bdev name to use
1110mode                    | Required | string      | OCF cache mode ('wb' or 'wt' or 'pt')
1111cache_bdev_name         | Required | string      | Name of underlying cache bdev
1112core_bdev_name          | Required | string      | Name of underlying core bdev
1113
1114### Result
1115
1116Name of newly created bdev.
1117
1118### Example
1119
1120Example request:
1121
1122~~~
1123{
1124  "params": {
1125    "name": "ocf0",
1126    "mode": "wt",
1127    "cache_bdev_name": "Nvme0n1"
1128    "core_bdev_name": "aio0"
1129  },
1130  "jsonrpc": "2.0",
1131  "method": "bdev_ocf_create",
1132  "id": 1
1133}
1134~~~
1135
1136Example response:
1137
1138~~~
1139{
1140  "jsonrpc": "2.0",
1141  "id": 1,
1142  "result": "ocf0"
1143}
1144~~~
1145
1146## bdev_ocf_delete {#rpc_bdev_ocf_delete}
1147
1148Delete the OCF bdev
1149
1150### Parameters
1151
1152Name                    | Optional | Type        | Description
1153----------------------- | -------- | ----------- | -----------
1154name                    | Required | string      | Bdev name
1155
1156### Example
1157
1158Example request:
1159
1160~~~
1161{
1162  "params": {
1163    "name": "ocf0"
1164  },
1165  "jsonrpc": "2.0",
1166  "method": "bdev_ocf_delete",
1167  "id": 1
1168}
1169~~~
1170
1171Example response:
1172
1173~~~
1174{
1175  "jsonrpc": "2.0",
1176  "id": 1,
1177  "result": true
1178}
1179~~~
1180
1181## bdev_ocf_get_stats {#rpc_bdev_ocf_get_stats}
1182
1183Get statistics of chosen OCF block device.
1184
1185### Parameters
1186
1187Name                    | Optional | Type        | Description
1188----------------------- | -------- | ----------- | -----------
1189name                    | Required | string      | Block device name
1190
1191### Response
1192
1193Statistics as json object.
1194
1195### Example
1196
1197Example request:
1198
1199~~~
1200{
1201  "jsonrpc": "2.0",
1202  "method": "bdev_ocf_get_stats",
1203  "id": 1
1204}
1205~~~
1206
1207Example response:
1208
1209~~~
1210{
1211  "jsonrpc": "2.0",
1212  "id": 1,
1213  "result": [
1214  "usage": {
1215    "clean": {
1216      "count": 76033,
1217      "units": "4KiB blocks",
1218      "percentage": "100.0"
1219    },
1220    "free": {
1221      "count": 767,
1222      "units": "4KiB blocks",
1223      "percentage": "0.9"
1224    },
1225    "occupancy": {
1226      "count": 76033,
1227      "units": "4KiB blocks",
1228      "percentage": "99.0"
1229    },
1230    "dirty": {
1231      "count": 0,
1232      "units": "4KiB blocks",
1233      "percentage": "0.0"
1234    }
1235  },
1236  "requests": {
1237    "rd_total": {
1238      "count": 2,
1239      "units": "Requests",
1240      "percentage": "0.0"
1241    },
1242    "wr_full_misses": {
1243      "count": 76280,
1244      "units": "Requests",
1245      "percentage": "35.6"
1246    },
1247    "rd_full_misses": {
1248      "count": 1,
1249      "units": "Requests",
1250      "percentage": "0.0"
1251    },
1252    "rd_partial_misses": {
1253      "count": 0,
1254      "units": "Requests",
1255      "percentage": "0.0"
1256    },
1257    "wr_total": {
1258      "count": 212416,
1259      "units": "Requests",
1260      "percentage": "99.2"
1261    },
1262    "wr_pt": {
1263      "count": 1535,
1264      "units": "Requests",
1265      "percentage": "0.7"
1266    },
1267    "wr_partial_misses": {
1268      "count": 0,
1269      "units": "Requests",
1270      "percentage": "0.0"
1271    },
1272    "serviced": {
1273      "count": 212418,
1274      "units": "Requests",
1275      "percentage": "99.2"
1276    },
1277    "rd_pt": {
1278      "count": 0,
1279      "units": "Requests",
1280      "percentage": "0.0"
1281    },
1282    "total": {
1283      "count": 213953,
1284      "units": "Requests",
1285      "percentage": "100.0"
1286    },
1287    "rd_hits": {
1288      "count": 1,
1289      "units": "Requests",
1290      "percentage": "0.0"
1291    },
1292    "wr_hits": {
1293      "count": 136136,
1294      "units": "Requests",
1295      "percentage": "63.6"
1296    }
1297  },
1298  "errors": {
1299    "total": {
1300      "count": 0,
1301      "units": "Requests",
1302      "percentage": "0.0"
1303    },
1304    "cache_obj_total": {
1305      "count": 0,
1306      "units": "Requests",
1307      "percentage": "0.0"
1308    },
1309    "core_obj_total": {
1310      "count": 0,
1311      "units": "Requests",
1312      "percentage": "0.0"
1313    },
1314    "cache_obj_rd": {
1315      "count": 0,
1316      "units": "Requests",
1317      "percentage": "0.0"
1318    },
1319    "core_obj_wr": {
1320      "count": 0,
1321      "units": "Requests",
1322      "percentage": "0.0"
1323    },
1324    "core_obj_rd": {
1325      "count": 0,
1326      "units": "Requests",
1327      "percentage": "0.0"
1328    },
1329    "cache_obj_wr": {
1330      "count": 0,
1331      "units": "Requests",
1332      "percentage": "0.0"
1333    }
1334  },
1335  "blocks": {
1336    "volume_rd": {
1337      "count": 9,
1338      "units": "4KiB blocks",
1339      "percentage": "0.0"
1340    },
1341    "volume_wr": {
1342      "count": 213951,
1343      "units": "4KiB blocks",
1344      "percentage": "99.9"
1345    },
1346    "cache_obj_total": {
1347      "count": 212425,
1348      "units": "4KiB blocks",
1349      "percentage": "100.0"
1350    },
1351    "core_obj_total": {
1352      "count": 213959,
1353      "units": "4KiB blocks",
1354      "percentage": "100.0"
1355    },
1356    "cache_obj_rd": {
1357      "count": 1,
1358      "units": "4KiB blocks",
1359      "percentage": "0.0"
1360    },
1361    "core_obj_wr": {
1362      "count": 213951,
1363      "units": "4KiB blocks",
1364      "percentage": "99.9"
1365    },
1366    "volume_total": {
1367      "count": 213960,
1368      "units": "4KiB blocks",
1369      "percentage": "100.0"
1370    },
1371    "core_obj_rd": {
1372      "count": 8,
1373      "units": "4KiB blocks",
1374      "percentage": "0.0"
1375    },
1376    "cache_obj_wr": {
1377      "count": 212424,
1378      "units": "4KiB blocks",
1379      "percentage": "99.9"
1380    }
1381  ]
1382}
1383~~~
1384
1385## bdev_ocf_get_bdevs {#rpc_bdev_ocf_get_bdevs}
1386
1387Get list of OCF devices including unregistered ones.
1388
1389### Parameters
1390
1391Name                    | Optional | Type        | Description
1392----------------------- | -------- | ----------- | -----------
1393name                    | Optional | string      | Name of OCF vbdev or name of cache device or name of core device
1394
1395### Response
1396
1397Array of OCF devices with their current status, along with core and cache bdevs.
1398
1399### Example
1400
1401Example request:
1402
1403~~~
1404{
1405  "jsonrpc": "2.0",
1406  "method": "bdev_ocf_get_bdevs",
1407  "id": 1
1408}
1409~~~
1410
1411Example response:
1412
1413~~~
1414{
1415  "jsonrpc": "2.0",
1416  "id": 1,
1417  "result": [
1418    {
1419      "name": "PartCache",
1420      "started": false,
1421      "cache": {
1422        "name": "Malloc0",
1423        "attached": true
1424      },
1425      "core": {
1426        "name": "Malloc1",
1427        "attached": false
1428      }
1429    }
1430  ]
1431}
1432~~~
1433
1434## bdev_malloc_create {#rpc_bdev_malloc_create}
1435
1436Construct @ref bdev_config_malloc
1437
1438### Parameters
1439
1440Name                    | Optional | Type        | Description
1441----------------------- | -------- | ----------- | -----------
1442name                    | Optional | string      | Bdev name to use
1443block_size              | Required | number      | Block size in bytes -must be multiple of 512
1444num_blocks              | Required | number      | Number of blocks
1445uuid                    | Optional | string      | UUID of new bdev
1446
1447### Result
1448
1449Name of newly created bdev.
1450
1451### Example
1452
1453Example request:
1454
1455~~~
1456{
1457  "params": {
1458    "block_size": 4096,
1459    "num_blocks": 16384,
1460    "name": "Malloc0",
1461    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90"
1462  },
1463  "jsonrpc": "2.0",
1464  "method": "bdev_malloc_create",
1465  "id": 1
1466}
1467~~~
1468
1469Example response:
1470
1471~~~
1472{
1473  "jsonrpc": "2.0",
1474  "id": 1,
1475  "result": "Malloc0"
1476}
1477~~~
1478
1479## bdev_malloc_delete {#rpc_bdev_malloc_delete}
1480
1481Delete @ref bdev_config_malloc
1482
1483### Parameters
1484
1485Name                    | Optional | Type        | Description
1486----------------------- | -------- | ----------- | -----------
1487name                    | Required | string      | Bdev name
1488
1489### Example
1490
1491Example request:
1492
1493~~~
1494{
1495  "params": {
1496    "name": "Malloc0"
1497  },
1498  "jsonrpc": "2.0",
1499  "method": "bdev_malloc_delete",
1500  "id": 1
1501}
1502~~~
1503
1504Example response:
1505
1506~~~
1507{
1508  "jsonrpc": "2.0",
1509  "id": 1,
1510  "result": true
1511}
1512~~~
1513
1514## bdev_null_create {#rpc_bdev_null_create}
1515
1516Construct @ref bdev_config_null
1517
1518### Parameters
1519
1520Name                    | Optional | Type        | Description
1521----------------------- | -------- | ----------- | -----------
1522name                    | Optional | string      | Bdev name to use
1523block_size              | Required | number      | Block size in bytes
1524num_blocks              | Required | number      | Number of blocks
1525uuid                    | Optional | string      | UUID of new bdev
1526md_size                 | Optional | number      | Metadata size in bytes
1527dif_type                | Optional | number      | Protection information type (0, 1, 2 or 3). Default: 0 - no protection.
1528dif_is_head_of_md       | Optional | boolean     | Protection information is in the first 8 bytes of MD. Default: in the last 8 bytes.
1529
1530### Result
1531
1532Name of newly created bdev.
1533
1534### Example
1535
1536Example request:
1537
1538~~~
1539{
1540  "params": {
1541    "block_size": 4104,
1542    "num_blocks": 16384,
1543    "name": "Null0",
1544    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90",
1545    "md_size": 8,
1546    "dif_type": 1,
1547    "dif_is_head_of_md": true
1548  },
1549  "jsonrpc": "2.0",
1550  "method": "bdev_null_create",
1551  "id": 1
1552}
1553~~~
1554
1555Example response:
1556
1557~~~
1558{
1559  "jsonrpc": "2.0",
1560  "id": 1,
1561  "result": "Null0"
1562}
1563~~~
1564
1565## bdev_null_delete {#rpc_bdev_null_delete}
1566
1567Delete @ref bdev_config_null.
1568
1569### Parameters
1570
1571Name                    | Optional | Type        | Description
1572----------------------- | -------- | ----------- | -----------
1573name                    | Required | string      | Bdev name
1574
1575### Example
1576
1577Example request:
1578
1579~~~
1580{
1581  "params": {
1582    "name": "Null0"
1583  },
1584  "jsonrpc": "2.0",
1585  "method": "bdev_null_delete",
1586  "id": 1
1587}
1588~~~
1589
1590Example response:
1591
1592~~~
1593{
1594  "jsonrpc": "2.0",
1595  "id": 1,
1596  "result": true
1597}
1598~~~
1599
1600## bdev_aio_create {#rpc_bdev_aio_create}
1601
1602Construct @ref bdev_config_aio.
1603
1604### Parameters
1605
1606Name                    | Optional | Type        | Description
1607----------------------- | -------- | ----------- | -----------
1608name                    | Required | string      | Bdev name to use
1609filename                | Required | number      | Path to device or file
1610block_size              | Optional | number      | Block size in bytes
1611
1612### Result
1613
1614Name of newly created bdev.
1615
1616### Example
1617
1618Example request:
1619
1620~~~
1621{
1622  "params": {
1623    "block_size": 4096,
1624    "name": "Aio0",
1625    "filename": "/tmp/aio_bdev_file"
1626  },
1627  "jsonrpc": "2.0",
1628  "method": "bdev_aio_create",
1629  "id": 1
1630}
1631~~~
1632
1633Example response:
1634
1635~~~
1636{
1637  "jsonrpc": "2.0",
1638  "id": 1,
1639  "result": "Aio0"
1640}
1641~~~
1642
1643## bdev_aio_delete {#rpc_bdev_aio_delete}
1644
1645Delete @ref bdev_config_aio.
1646
1647### Parameters
1648
1649Name                    | Optional | Type        | Description
1650----------------------- | -------- | ----------- | -----------
1651name                    | Required | string      | Bdev name
1652
1653### Example
1654
1655Example request:
1656
1657~~~
1658{
1659  "params": {
1660    "name": "Aio0"
1661  },
1662  "jsonrpc": "2.0",
1663  "method": "bdev_aio_delete",
1664  "id": 1
1665}
1666~~~
1667
1668Example response:
1669
1670~~~
1671{
1672  "jsonrpc": "2.0",
1673  "id": 1,
1674  "result": true
1675}
1676~~~
1677
1678## bdev_nvme_set_options {#rpc_bdev_nvme_set_options}
1679
1680Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized or any bdev NVMe has been created.
1681
1682### Parameters
1683
1684Name                       | Optional | Type        | Description
1685-------------------------- | -------- | ----------- | -----------
1686action_on_timeout          | Optional | string      | Action to take on command time out: none, reset or abort
1687timeout_us                 | Optional | number      | Timeout for each command, in microseconds. If 0, don't track timeouts
1688retry_count                | Optional | number      | The number of attempts per I/O before an I/O fails
1689arbitration_burst          | Optional | number      | The value is expressed as a power of two, a value of 111b indicates no limit
1690low_priority_weight        | Optional | number      | The maximum number of commands that the controller may launch at one time from a low priority queue
1691medium_priority_weight     | Optional | number      | The maximum number of commands that the controller may launch at one time from a medium priority queue
1692high_priority_weight       | Optional | number      | The maximum number of commands that the controller may launch at one time from a high priority queue
1693nvme_adminq_poll_period_us | Optional | number      | How often the admin queue is polled for asynchronous events in microseconds
1694nvme_ioq_poll_period_us    | Optional | number      | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible).
1695io_queue_requests          | Optional | number      | The number of requests allocated for each NVMe I/O queue. Default: 512.
1696delay_cmd_submit           | Optional | boolean     | Enable delaying NVMe command submission to allow batching of multiple commands. Default: `true`.
1697
1698### Example
1699
1700Example request:
1701
1702~~~
1703request:
1704{
1705  "params": {
1706    "retry_count": 5,
1707    "arbitration_burst": 3,
1708    "low_priority_weight": 8,
1709    "medium_priority_weight":8,
1710    "high_priority_weight": 8,
1711    "nvme_adminq_poll_period_us": 2000,
1712    "timeout_us": 10000000,
1713    "action_on_timeout": "reset",
1714    "io_queue_requests" : 2048,
1715    "delay_cmd_submit": true
1716  },
1717  "jsonrpc": "2.0",
1718  "method": "bdev_nvme_set_options",
1719  "id": 1
1720}
1721~~~
1722
1723Example response:
1724
1725~~~
1726{
1727  "jsonrpc": "2.0",
1728  "id": 1,
1729  "result": true
1730}
1731~~~
1732
1733## bdev_nvme_set_hotplug {#rpc_bdev_nvme_set_hotplug}
1734
1735Change settings of the NVMe hotplug feature. If enabled, PCIe NVMe bdevs will be automatically discovered on insertion
1736and deleted on removal.
1737
1738### Parameters
1739
1740Name                    | Optional | Type        | Description
1741----------------------- | -------- | ----------- | -----------
1742enabled                 | Required | string      | True to enable, false to disable
1743period_us               | Optional | number      | How often to poll for hot-insert and hot-remove events. Values: 0 - reset/use default or 1 to 10000000.
1744
1745### Example
1746
1747Example request:
1748
1749~~~
1750request:
1751{
1752  "params": {
1753    "enabled": true,
1754    "period_us": 2000
1755  },
1756  "jsonrpc": "2.0",
1757  "method": "bdev_nvme_set_hotplug",
1758  "id": 1
1759}
1760~~~
1761
1762Example response:
1763
1764~~~
1765{
1766  "jsonrpc": "2.0",
1767  "id": 1,
1768  "result": true
1769}
1770~~~
1771
1772## bdev_nvme_attach_controller {#rpc_bdev_nvme_attach_controller}
1773
1774Construct @ref bdev_config_nvme. This RPC can also be used to add additional paths to an existing controller to enable
1775multipathing. This is done by specifying the `name` parameter as an existing controller. When adding an additional
1776path, the hostnqn, hostsvcid, hostaddr, prchk_reftag, and prchk_guard_arguments must not be specified and are assumed
1777to have the same value as the existing path.
1778
1779### Result
1780
1781Array of names of newly created bdevs.
1782
1783### Parameters
1784
1785Name                    | Optional | Type        | Description
1786----------------------- | -------- | ----------- | -----------
1787name                    | Required | string      | Name of the NVMe controller, prefix for each bdev name
1788trtype                  | Required | string      | NVMe-oF target trtype: rdma or pcie
1789traddr                  | Required | string      | NVMe-oF target address: ip or BDF
1790adrfam                  | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
1791trsvcid                 | Optional | string      | NVMe-oF target trsvcid: port number
1792subnqn                  | Optional | string      | NVMe-oF target subnqn
1793hostnqn                 | Optional | string      | NVMe-oF target hostnqn
1794hostaddr                | Optional | string      | NVMe-oF host address: ip address
1795hostsvcid               | Optional | string      | NVMe-oF host trsvcid: port number
1796prchk_reftag            | Optional | bool        | Enable checking of PI reference tag for I/O processing
1797prchk_guard             | Optional | bool        | Enable checking of PI guard for I/O processing
1798
1799### Example
1800
1801Example request:
1802
1803~~~
1804{
1805  "params": {
1806    "trtype": "pcie",
1807    "name": "Nvme0",
1808    "traddr": "0000:0a:00.0"
1809  },
1810  "jsonrpc": "2.0",
1811  "method": "bdev_nvme_attach_controller",
1812  "id": 1
1813}
1814~~~
1815
1816Example response:
1817
1818~~~
1819{
1820  "jsonrpc": "2.0",
1821  "id": 1,
1822  "result": [
1823    "Nvme0n1"
1824  ]
1825}
1826~~~
1827
1828## bdev_nvme_get_controllers {#rpc_bdev_nvme_get_controllers}
1829
1830Get information about NVMe controllers.
1831
1832### Parameters
1833
1834The user may specify no parameters in order to list all NVMe controllers, or one NVMe controller may be
1835specified by name.
1836
1837Name                    | Optional | Type        | Description
1838----------------------- | -------- | ----------- | -----------
1839name                    | Optional | string      | NVMe controller name
1840
1841### Response
1842
1843The response is an array of objects containing information about the requested NVMe controllers.
1844
1845### Example
1846
1847Example request:
1848
1849~~~
1850{
1851  "jsonrpc": "2.0",
1852  "id": 1,
1853  "method": "bdev_nvme_get_controllers",
1854  "params": {
1855    "name": "Nvme0"
1856  }
1857}
1858~~~
1859
1860Example response:
1861
1862~~~
1863{
1864  "jsonrpc": "2.0",
1865  "id": 1,
1866  "result": [
1867    {
1868      "name": "Nvme0",
1869      "trid": {
1870        "trtype": "PCIe",
1871        "traddr": "0000:05:00.0"
1872      }
1873    }
1874  ]
1875}
1876~~~
1877
1878## bdev_nvme_detach_controller {#rpc_bdev_nvme_detach_controller}
1879
1880Detach NVMe controller and delete any associated bdevs.
1881
1882### Parameters
1883
1884Name                    | Optional | Type        | Description
1885----------------------- | -------- | ----------- | -----------
1886name                    | Required | string      | Controller name
1887
1888### Example
1889
1890Example requests:
1891
1892~~~
1893{
1894  "params": {
1895    "name": "Nvme0"
1896  },
1897  "jsonrpc": "2.0",
1898  "method": "bdev_nvme_detach_controller",
1899  "id": 1
1900}
1901~~~
1902
1903Example response:
1904
1905~~~
1906{
1907  "jsonrpc": "2.0",
1908  "id": 1,
1909  "result": true
1910}
1911~~~
1912
1913## bdev_nvme_cuse_register {#rpc_bdev_nvme_cuse_register}
1914
1915Register CUSE device on NVMe controller.
1916This feature is considered as experimental.
1917
1918### Parameters
1919
1920Name                    | Optional | Type        | Description
1921----------------------- | -------- | ----------- | -----------
1922name                    | Required | string      | Name of the NVMe controller
1923dev_path                | Required | string      | Path to the CUSE controller device, e.g. spdk/nvme0
1924
1925### Example
1926
1927Example request:
1928
1929~~~
1930{
1931  "params": {
1932    "dev_path": "spdk/nvme0",
1933    "name": "Nvme0"
1934  },
1935  "jsonrpc": "2.0",
1936  "method": "bdev_nvme_cuse_register",
1937  "id": 1
1938}
1939~~~
1940
1941Example response:
1942
1943~~~
1944{
1945  "jsonrpc": "2.0",
1946  "id": 1,
1947  "result": true
1948}
1949~~~
1950
1951## bdev_nvme_cuse_unregister {#rpc_bdev_nvme_cuse_unregister}
1952
1953Unregister CUSE device on NVMe controller.
1954This feature is considered as experimental.
1955
1956### Parameters
1957
1958Name                    | Optional | Type        | Description
1959----------------------- | -------- | ----------- | -----------
1960name                    | Required | string      | Name of the NVMe controller
1961
1962### Example
1963
1964Example request:
1965
1966~~~
1967{
1968  "params": {
1969    "name": "Nvme0"
1970  },
1971  "jsonrpc": "2.0",
1972  "method": "bdev_nvme_cuse_unregister",
1973  "id": 1
1974}
1975~~~
1976
1977Example response:
1978
1979~~~
1980{
1981  "jsonrpc": "2.0",
1982  "id": 1,
1983  "result": true
1984}
1985~~~
1986
1987## bdev_rbd_create {#rpc_bdev_rbd_create}
1988
1989Create @ref bdev_config_rbd bdev
1990
1991This method is available only if SPDK was build with Ceph RBD support.
1992
1993### Parameters
1994
1995Name                    | Optional | Type        | Description
1996----------------------- | -------- | ----------- | -----------
1997name                    | Optional | string      | Bdev name
1998user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
1999pool_name               | Required | string      | Pool name
2000rbd_name                | Required | string      | Image name
2001block_size              | Required | number      | Block size
2002config                  | Optional | string map  | Explicit librados configuration
2003
2004If no config is specified, Ceph configuration files must exist with
2005all relevant settings for accessing the pool. If a config map is
2006passed, the configuration files are ignored and instead all key/value
2007pairs are passed to rados_conf_set to configure cluster access. In
2008practice, "mon_host" (= list of monitor address+port) and "key" (= the
2009secret key stored in Ceph keyrings) are enough.
2010
2011When accessing the image as some user other than "admin" (the
2012default), the "user_id" has to be set.
2013
2014### Result
2015
2016Name of newly created bdev.
2017
2018### Example
2019
2020Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`:
2021
2022~~~
2023{
2024  "params": {
2025    "pool_name": "rbd",
2026    "rbd_name": "foo",
2027    "config": {
2028      "mon_host": "192.168.7.1:6789,192.168.7.2:6789",
2029      "key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ==",
2030    }
2031    "block_size": 4096
2032  },
2033  "jsonrpc": "2.0",
2034  "method": "bdev_rbd_create",
2035  "id": 1
2036}
2037~~~
2038
2039Example response:
2040
2041~~~
2042response:
2043{
2044  "jsonrpc": "2.0",
2045  "id": 1,
2046  "result": "Ceph0"
2047}
2048~~~
2049
2050## bdev_rbd_delete {#rpc_bdev_rbd_delete}
2051
2052Delete @ref bdev_config_rbd bdev
2053
2054This method is available only if SPDK was build with Ceph RBD support.
2055
2056### Result
2057
2058`true` if bdev with provided name was deleted or `false` otherwise.
2059
2060### Parameters
2061
2062Name                    | Optional | Type        | Description
2063----------------------- | -------- | ----------- | -----------
2064name                    | Required | string      | Bdev name
2065
2066### Example
2067
2068Example request:
2069
2070~~~
2071{
2072  "params": {
2073    "name": "Rbd0"
2074  },
2075  "jsonrpc": "2.0",
2076  "method": "bdev_rbd_delete",
2077  "id": 1
2078}
2079~~~
2080
2081Example response:
2082
2083~~~
2084{
2085  "jsonrpc": "2.0",
2086  "id": 1,
2087  "result": true
2088}
2089~~~
2090
2091## bdev_rbd_resize {#rpc_bdev_rbd_resize}
2092
2093Resize @ref bdev_config_rbd bdev
2094
2095This method is available only if SPDK was build with Ceph RBD support.
2096
2097### Result
2098
2099`true` if bdev with provided name was resized or `false` otherwise.
2100
2101### Parameters
2102
2103Name                    | Optional | Type        | Description
2104----------------------- | -------- | ----------- | -----------
2105name                    | Required | string      | Bdev name
2106new_size                | Required | int         | New bdev size for resize operation in MiB
2107
2108### Example
2109
2110Example request:
2111
2112~~~
2113{
2114  "params": {
2115    "name": "Rbd0"
2116    "new_size": "4096"
2117  },
2118  "jsonrpc": "2.0",
2119  "method": "bdev_rbd_resize",
2120  "id": 1
2121}
2122~~~
2123
2124Example response:
2125
2126~~~
2127{
2128  "jsonrpc": "2.0",
2129  "id": 1,
2130  "result": true
2131}
2132~~~
2133
2134## bdev_delay_create {#rpc_bdev_delay_create}
2135
2136Create delay bdev. This bdev type redirects all IO to it's base bdev and inserts a delay on the completion
2137path to create an artificial drive latency. All latency values supplied to this bdev should be in microseconds.
2138
2139### Parameters
2140
2141Name                    | Optional | Type        | Description
2142----------------------- | -------- | ----------- | -----------
2143name                    | Required | string      | Bdev name
2144base_bdev_name          | Required | string      | Base bdev name
2145avg_read_latency        | Required | number      | average read latency (us)
2146p99_read_latency        | Required | number      | p99 read latency (us)
2147avg_write_latency       | Required | number      | average write latency (us)
2148p99_write_latency       | Required | number      | p99 write latency (us)
2149
2150### Result
2151
2152Name of newly created bdev.
2153
2154### Example
2155
2156Example request:
2157
2158~~~
2159{
2160  "params": {
2161    "base_bdev_name": "Null0",
2162    "name": "Delay0",
2163    "avg_read_latency": "15",
2164    "p99_read_latency": "50",
2165    "avg_write_latency": "40",
2166    "p99_write_latency": "110",
2167  },
2168  "jsonrpc": "2.0",
2169  "method": "bdev_delay_create",
2170  "id": 1
2171}
2172~~~
2173
2174Example response:
2175
2176~~~
2177{
2178  "jsonrpc": "2.0",
2179  "id": 1,
2180  "result": "Delay0"
2181}
2182~~~
2183
2184## bdev_delay_delete {#rpc_bdev_delay_delete}
2185
2186Delete delay bdev.
2187
2188### Parameters
2189
2190Name                    | Optional | Type        | Description
2191----------------------- | -------- | ----------- | -----------
2192name                    | Required | string      | Bdev name
2193
2194### Example
2195
2196Example request:
2197
2198~~~
2199{
2200  "params": {
2201    "name": "Delay0"
2202  },
2203  "jsonrpc": "2.0",
2204  "method": "bdev_delay_delete",
2205  "id": 1
2206}
2207
2208~~~
2209
2210Example response:
2211
2212~~~
2213{
2214  "jsonrpc": "2.0",
2215  "id": 1,
2216  "result": true
2217}
2218~~~
2219
2220## bdev_delay_update_latency {#rpc_bdev_delay_update_latency}
2221
2222Update a target latency value associated with a given delay bdev. Any currently
2223outstanding I/O will be completed with the old latency.
2224
2225### Parameters
2226
2227Name                    | Optional | Type        | Description
2228----------------------- | -------- | ----------- | -----------
2229delay_bdev_name         | Required | string      | Name of the delay bdev
2230latency_type            | Required | string      | One of: avg_read, avg_write, p99_read, p99_write
2231latency_us              | Required | number      | The new latency value in microseconds
2232
2233### Result
2234
2235Name of newly created bdev.
2236
2237### Example
2238
2239Example request:
2240
2241~~~
2242{
2243  "params": {
2244    "delay_bdev_name": "Delay0",
2245    "latency_type": "avg_read",
2246    "latency_us": "100",
2247  },
2248  "jsonrpc": "2.0",
2249  "method": "bdev_delay_update_latency",
2250  "id": 1
2251}
2252~~~
2253
2254Example response:
2255
2256~~~
2257{
2258  "result": "true"
2259}
2260~~~
2261
2262## bdev_error_create {#rpc_bdev_error_create}
2263
2264Construct error bdev.
2265
2266### Parameters
2267
2268Name                    | Optional | Type        | Description
2269----------------------- | -------- | ----------- | -----------
2270base_name               | Required | string      | Base bdev name
2271
2272### Example
2273
2274Example request:
2275
2276~~~
2277{
2278  "params": {
2279    "base_name": "Malloc0"
2280  },
2281  "jsonrpc": "2.0",
2282  "method": "bdev_error_create",
2283  "id": 1
2284}
2285~~~
2286
2287Example response:
2288
2289~~~
2290{
2291  "jsonrpc": "2.0",
2292  "id": 1,
2293  "result": true
2294}
2295~~~
2296
2297## bdev_error_delete {#rpc_bdev_error_delete}
2298
2299Delete error bdev
2300
2301### Result
2302
2303`true` if bdev with provided name was deleted or `false` otherwise.
2304
2305### Parameters
2306
2307Name                    | Optional | Type        | Description
2308----------------------- | -------- | ----------- | -----------
2309name                    | Required | string      | Error bdev name
2310
2311### Example
2312
2313Example request:
2314
2315~~~
2316{
2317  "params": {
2318    "name": "EE_Malloc0"
2319  },
2320  "jsonrpc": "2.0",
2321  "method": "bdev_error_delete",
2322  "id": 1
2323}
2324~~~
2325
2326Example response:
2327
2328~~~
2329{
2330  "jsonrpc": "2.0",
2331  "id": 1,
2332  "result": true
2333}
2334~~~
2335
2336## bdev_iscsi_create {#rpc_bdev_iscsi_create}
2337
2338Connect to iSCSI target and create bdev backed by this connection.
2339
2340This method is available only if SPDK was build with iSCSI initiator support.
2341
2342### Parameters
2343
2344Name                    | Optional | Type        | Description
2345----------------------- | -------- | ----------- | -----------
2346name                    | Required | string      | Bdev name
2347initiator_iqn           | Required | string      | IQN name used during connection
2348url                     | Required | string      | iSCSI resource URI
2349
2350### Result
2351
2352Name of newly created bdev.
2353
2354### Example
2355
2356Example request:
2357
2358~~~
2359{
2360  "params": {
2361    "url": "iscsi://127.0.0.1/iqn.2016-06.io.spdk:disk1/0",
2362    "initiator_iqn": "iqn.2016-06.io.spdk:init",
2363    "name": "iSCSI0"
2364  },
2365  "jsonrpc": "2.0",
2366  "method": "bdev_iscsi_create",
2367  "id": 1
2368}
2369~~~
2370
2371Example response:
2372
2373~~~
2374{
2375  "jsonrpc": "2.0",
2376  "id": 1,
2377  "result": "iSCSI0"
2378}
2379~~~
2380
2381## bdev_iscsi_delete {#rpc_bdev_iscsi_delete}
2382
2383Delete iSCSI bdev and terminate connection to target.
2384
2385This method is available only if SPDK was built with iSCSI initiator support.
2386
2387### Parameters
2388
2389Name                    | Optional | Type        | Description
2390----------------------- | -------- | ----------- | -----------
2391name                    | Required | string      | Bdev name
2392
2393### Example
2394
2395Example request:
2396
2397~~~
2398{
2399  "params": {
2400    "name": "iSCSI0"
2401  },
2402  "jsonrpc": "2.0",
2403  "method": "bdev_iscsi_delete",
2404  "id": 1
2405}
2406~~~
2407
2408Example response:
2409
2410~~~
2411{
2412  "jsonrpc": "2.0",
2413  "id": 1,
2414  "result": true
2415}
2416~~~
2417
2418## bdev_ftl_create {#rpc_bdev_ftl_create}
2419
2420Create FTL bdev.
2421
2422This RPC is subject to change.
2423
2424### Parameters
2425
2426Name                    | Optional | Type        | Description
2427----------------------- | -------- | ----------- | -----------
2428name                    | Required | string      | Bdev name
2429trtype                  | Required | string      | Transport type
2430traddr                  | Required | string      | NVMe target address
2431punits                  | Required | string      | Parallel unit range in the form of start-end e.g 4-8
2432uuid                    | Optional | string      | UUID of restored bdev (not applicable when creating new instance)
2433cache                   | Optional | string      | Name of the bdev to be used as a write buffer cache
2434
2435### Result
2436
2437Name of newly created bdev.
2438
2439### Example
2440
2441Example request:
2442
2443~~~
2444{
2445  "params": {
2446    "name": "nvme0"
2447    "trtype" "pcie"
2448    "traddr": "0000:00:04.0"
2449    "punits": "0-3"
2450    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
2451  },
2452  "jsonrpc": "2.0",
2453  "method": "bdev_ftl_create",
2454  "id": 1
2455}
2456~~~
2457
2458Example response:
2459
2460~~~
2461{
2462  "jsonrpc": "2.0",
2463  "id": 1,
2464  "result": {
2465      "name" : "nvme0"
2466      "uuid" : "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
2467  }
2468}
2469~~~
2470
2471## bdev_ftl_delete {#rpc_bdev_ftl_delete}
2472
2473Delete FTL bdev.
2474
2475This RPC is subject to change.
2476
2477### Parameters
2478
2479Name                    | Optional | Type        | Description
2480----------------------- | -------- | ----------- | -----------
2481name                    | Required | string      | Bdev name
2482
2483### Example
2484
2485Example request:
2486
2487~~~
2488{
2489  "params": {
2490    "name": "nvme0"
2491  },
2492  "jsonrpc": "2.0",
2493  "method": "bdev_ftl_delete",
2494  "id": 1
2495}
2496~~~
2497
2498Example response:
2499
2500~~~
2501{
2502  "jsonrpc": "2.0",
2503  "id": 1,
2504  "result": true
2505}
2506~~~
2507
2508## bdev_pmem_create_pool {#rpc_bdev_pmem_create_pool}
2509
2510Create a @ref bdev_config_pmem blk pool file. It is equivalent of following `pmempool create` command:
2511
2512~~~
2513pmempool create -s $((num_blocks * block_size)) blk $block_size $pmem_file
2514~~~
2515
2516This method is available only if SPDK was built with PMDK support.
2517
2518### Parameters
2519
2520Name                    | Optional | Type        | Description
2521----------------------- | -------- | ----------- | -----------
2522pmem_file               | Required | string      | Path to new pmem file
2523num_blocks              | Required | number      | Number of blocks
2524block_size              | Required | number      | Size of each block in bytes
2525
2526### Example
2527
2528Example request:
2529
2530~~~
2531{
2532  "params": {
2533    "block_size": 512,
2534    "num_blocks": 131072,
2535    "pmem_file": "/tmp/pmem_file"
2536  },
2537  "jsonrpc": "2.0",
2538  "method": "bdev_pmem_create_pool",
2539  "id": 1
2540}
2541~~~
2542
2543Example response:
2544
2545~~~
2546{
2547  "jsonrpc": "2.0",
2548  "id": 1,
2549  "result": true
2550}
2551~~~
2552
2553## bdev_pmem_get_pool_info {#rpc_bdev_pmem_get_pool_info}
2554
2555Retrieve basic information about PMDK memory pool.
2556
2557This method is available only if SPDK was built with PMDK support.
2558
2559### Parameters
2560
2561Name                    | Optional | Type        | Description
2562----------------------- | -------- | ----------- | -----------
2563pmem_file               | Required | string      | Path to existing pmem file
2564
2565### Result
2566
2567Array of objects describing memory pool:
2568
2569Name                    | Type        | Description
2570----------------------- | ----------- | -----------
2571num_blocks              | number      | Number of blocks
2572block_size              | number      | Size of each block in bytes
2573
2574### Example
2575
2576Example request:
2577
2578~~~
2579request:
2580{
2581  "params": {
2582    "pmem_file": "/tmp/pmem_file"
2583  },
2584  "jsonrpc": "2.0",
2585  "method": "bdev_pmem_get_pool_info",
2586  "id": 1
2587}
2588~~~
2589
2590Example response:
2591
2592~~~
2593{
2594  "jsonrpc": "2.0",
2595  "id": 1,
2596  "result": [
2597    {
2598      "block_size": 512,
2599      "num_blocks": 129728
2600    }
2601  ]
2602}
2603~~~
2604
2605## bdev_pmem_delete_pool {#rpc_bdev_pmem_delete_pool}
2606
2607Delete pmem pool by removing file `pmem_file`. This method will fail if `pmem_file` is not a
2608valid pmem pool file.
2609
2610This method is available only if SPDK was built with PMDK support.
2611
2612### Parameters
2613
2614Name                    | Optional | Type        | Description
2615----------------------- | -------- | ----------- | -----------
2616pmem_file               | Required | string      | Path to new pmem file
2617
2618### Example
2619
2620Example request:
2621
2622~~~
2623{
2624  "params": {
2625    "pmem_file": "/tmp/pmem_file"
2626  },
2627  "jsonrpc": "2.0",
2628  "method": "bdev_pmem_delete_pool",
2629  "id": 1
2630}
2631~~~
2632
2633Example response:
2634
2635~~~
2636{
2637  "jsonrpc": "2.0",
2638  "id": 1,
2639  "result": true
2640}
2641~~~
2642
2643## bdev_pmem_create {#rpc_bdev_pmem_create}
2644
2645Construct @ref bdev_config_pmem bdev.
2646
2647This method is available only if SPDK was built with PMDK support.
2648
2649### Parameters
2650
2651Name                    | Optional | Type        | Description
2652----------------------- | -------- | ----------- | -----------
2653name                    | Required | string      | Bdev name
2654pmem_file               | Required | string      | Path to existing pmem blk pool file
2655
2656### Result
2657
2658Name of newly created bdev.
2659
2660### Example
2661
2662Example request:
2663
2664~~~
2665{
2666  "params": {
2667    "pmem_file": "/tmp/pmem_file",
2668    "name": "Pmem0"
2669  },
2670  "jsonrpc": "2.0",
2671  "method": "bdev_pmem_create",
2672  "id": 1
2673}
2674~~~
2675
2676Example response:
2677
2678~~~
2679{
2680  "jsonrpc": "2.0",
2681  "id": 1,
2682  "result": "Pmem0"
2683}
2684~~~
2685
2686## bdev_pmem_delete {#rpc_bdev_pmem_delete}
2687
2688Delete @ref bdev_config_pmem bdev. This call will not remove backing pool files.
2689
2690This method is available only if SPDK was built with PMDK support.
2691
2692### Result
2693
2694`true` if bdev with provided name was deleted or `false` otherwise.
2695
2696### Parameters
2697
2698Name                    | Optional | Type        | Description
2699----------------------- | -------- | ----------- | -----------
2700name                    | Required | string      | Bdev name
2701
2702### Example
2703
2704Example request:
2705
2706~~~
2707{
2708  "params": {
2709    "name": "Pmem0"
2710  },
2711  "jsonrpc": "2.0",
2712  "method": "bdev_pmem_delete",
2713  "id": 1
2714}
2715~~~
2716
2717Example response:
2718
2719~~~
2720{
2721  "jsonrpc": "2.0",
2722  "id": 1,
2723  "result": true
2724}
2725~~~
2726
2727## bdev_passthru_create {#rpc_bdev_passthru_create}
2728
2729Create passthru bdev. This bdev type redirects all IO to it's base bdev. It has no other purpose than being an example
2730and a starting point in development of new bdev type.
2731
2732### Parameters
2733
2734Name                    | Optional | Type        | Description
2735----------------------- | -------- | ----------- | -----------
2736name                    | Required | string      | Bdev name
2737base_bdev_name          | Required | string      | Base bdev name
2738
2739### Result
2740
2741Name of newly created bdev.
2742
2743### Example
2744
2745Example request:
2746
2747~~~
2748{
2749  "params": {
2750    "base_bdev_name": "Malloc0",
2751    "name": "Passsthru0"
2752  },
2753  "jsonrpc": "2.0",
2754  "method": "bdev_passthru_create",
2755  "id": 1
2756}
2757~~~
2758
2759Example response:
2760
2761~~~
2762{
2763  "jsonrpc": "2.0",
2764  "id": 1,
2765  "result": "Passsthru0"
2766}
2767~~~
2768
2769## bdev_passthru_delete {#rpc_bdev_passthru_delete}
2770
2771Delete passthru bdev.
2772
2773### Parameters
2774
2775Name                    | Optional | Type        | Description
2776----------------------- | -------- | ----------- | -----------
2777name                    | Required | string      | Bdev name
2778
2779### Example
2780
2781Example request:
2782
2783~~~
2784{
2785  "params": {
2786    "name": "Passsthru0"
2787  },
2788  "jsonrpc": "2.0",
2789  "method": "bdev_passthru_delete",
2790  "id": 1
2791}
2792
2793~~~
2794
2795Example response:
2796
2797~~~
2798{
2799  "jsonrpc": "2.0",
2800  "id": 1,
2801  "result": true
2802}
2803~~~
2804
2805## bdev_virtio_attach_controller {#rpc_bdev_virtio_attach_controller}
2806
2807Create new initiator @ref bdev_config_virtio_scsi or @ref bdev_config_virtio_blk and expose all found bdevs.
2808
2809### Parameters
2810
2811Name                    | Optional | Type        | Description
2812----------------------- | -------- | ----------- | -----------
2813name                    | Required | string      | Virtio SCSI base bdev name or Virtio Blk bdev name
2814trtype                  | Required | string      | Virtio target trtype: pci or user
2815traddr                  | Required | string      | target address: BDF or UNIX socket file path
2816dev_type                | Required | string      | Virtio device type: blk or scsi
2817vq_count                | Optional | number      | Number of queues this controller will utilize (default: 1)
2818vq_size                 | Optional | number      | Size of each queue. Must be power of 2. (default: 512)
2819
2820In case of Virtio SCSI the `name` parameter will be base name for new created bdevs. For Virtio Blk `name` will be the
2821name of created bdev.
2822
2823`vq_count` and `vq_size` parameters are valid only if `trtype` is `user`.
2824
2825### Result
2826
2827Array of names of newly created bdevs.
2828
2829### Example
2830
2831Example request:
2832
2833~~~
2834{
2835  "params": {
2836    "name": "VirtioScsi0",
2837    "trtype": "user",
2838    "vq_size": 128,
2839    "dev_type": "scsi",
2840    "traddr": "/tmp/VhostScsi0",
2841    "vq_count": 4
2842  },
2843  "jsonrpc": "2.0",
2844  "method": "bdev_virtio_attach_controller",
2845  "id": 1
2846}
2847~~~
2848
2849Example response:
2850
2851~~~
2852{
2853  "jsonrpc": "2.0",
2854  "id": 1,
2855  "result": ["VirtioScsi0t2", "VirtioScsi0t4"]
2856}
2857~~~
2858
2859## bdev_virtio_scsi_get_devices {#rpc_bdev_virtio_scsi_get_devices}
2860
2861Show information about all available Virtio SCSI devices.
2862
2863### Parameters
2864
2865This method has no parameters.
2866
2867### Result
2868
2869Array of Virtio SCSI information objects.
2870
2871### Example
2872
2873Example request:
2874
2875~~~
2876{
2877  "jsonrpc": "2.0",
2878  "method": "bdev_virtio_scsi_get_devices",
2879  "id": 1
2880}
2881~~~
2882
2883Example response:
2884
2885~~~
2886{
2887  "jsonrpc": "2.0",
2888  "id": 1,
2889  "result": [
2890    {
2891      "name": "VirtioScsi0",
2892      "virtio": {
2893          "vq_size": 128,
2894          "vq_count": 4,
2895          "type": "user",
2896          "socket": "/tmp/VhostScsi0"
2897      }
2898    }
2899  ]
2900}
2901~~~
2902
2903## bdev_virtio_detach_controller {#rpc_bdev_virtio_detach_controller}
2904
2905Remove a Virtio device. This command can be used to remove any type of virtio device.
2906
2907### Parameters
2908
2909Name                    | Optional | Type        | Description
2910----------------------- | -------- | ----------- | -----------
2911name                    | Required | string      | Virtio name
2912
2913### Example
2914
2915Example request:
2916
2917~~~
2918{
2919  "params": {
2920    "name": "VirtioUser0"
2921  },
2922  "jsonrpc": "2.0",
2923  "method": "bdev_virtio_detach_controller",
2924  "id": 1
2925}
2926
2927~~~
2928
2929Example response:
2930
2931~~~
2932{
2933  "jsonrpc": "2.0",
2934  "id": 1,
2935  "result": true
2936}
2937~~~
2938
2939# iSCSI Target {#jsonrpc_components_iscsi_tgt}
2940
2941## iscsi_set_options method {#rpc_iscsi_set_options}
2942
2943Set global parameters for iSCSI targets.
2944
2945This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once.
2946
2947### Parameters
2948
2949Name                        | Optional | Type    | Description
2950--------------------------- | -------- | ------- | -----------
2951auth_file                   | Optional | string  | Path to CHAP shared secret file (default: "")
2952node_base                   | Optional | string  | Prefix of the name of iSCSI target node (default: "iqn.2016-06.io.spdk")
2953nop_timeout                 | Optional | number  | Timeout in seconds to nop-in request to the initiator (default: 60)
2954nop_in_interval             | Optional | number  | Time interval in secs between nop-in requests by the target (default: 30)
2955disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
2956require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
2957mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
2958chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
2959max_sessions                | Optional | number  | Maximum number of sessions in the host (default: 128)
2960max_queue_depth             | Optional | number  | Maximum number of outstanding I/Os per queue (default: 64)
2961max_connections_per_session | Optional | number  | Session specific parameter, MaxConnections (default: 2)
2962default_time2wait           | Optional | number  | Session specific parameter, DefaultTime2Wait (default: 2)
2963default_time2retain         | Optional | number  | Session specific parameter, DefaultTime2Retain (default: 20)
2964first_burst_length          | Optional | number  | Session specific parameter, FirstBurstLength (default: 8192)
2965immediate_data              | Optional | boolean | Session specific parameter, ImmediateData (default: `true`)
2966error_recovery_level        | Optional | number  | Session specific parameter, ErrorRecoveryLevel (default: 0)
2967allow_duplicated_isid       | Optional | boolean | Allow duplicated initiator session ID (default: `false`)
2968
2969To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.
2970
2971Parameters `disable_chap` and `require_chap` are mutually exclusive. Parameters `no_discovery_auth`, `req_discovery_auth`, `req_discovery_auth_mutual`, and `discovery_auth_group` are still available instead of `disable_chap`, `require_chap`, `mutual_chap`, and `chap_group`, respectivey but will be removed in future releases.
2972
2973### Example
2974
2975Example request:
2976
2977~~~
2978{
2979  "params": {
2980    "allow_duplicated_isid": true,
2981    "default_time2retain": 60,
2982    "first_burst_length": 8192,
2983    "immediate_data": true,
2984    "node_base": "iqn.2016-06.io.spdk",
2985    "max_sessions": 128,
2986    "nop_timeout": 30,
2987    "nop_in_interval": 30,
2988    "auth_file": "/usr/local/etc/spdk/auth.conf",
2989    "disable_chap": true,
2990    "default_time2wait": 2
2991  },
2992  "jsonrpc": "2.0",
2993  "method": "iscsi_set_options",
2994  "id": 1
2995}
2996~~~
2997
2998Example response:
2999
3000~~~
3001{
3002  "jsonrpc": "2.0",
3003  "id": 1,
3004  "result": true
3005}
3006~~~
3007
3008## iscsi_get_options method {#rpc_iscsi_get_options}
3009
3010Show global parameters of iSCSI targets.
3011
3012### Parameters
3013
3014This method has no parameters.
3015
3016### Example
3017
3018Example request:
3019
3020~~~
3021request:
3022{
3023  "jsonrpc": "2.0",
3024  "method": "iscsi_get_options",
3025  "id": 1
3026}
3027~~~
3028
3029Example response:
3030
3031~~~
3032{
3033  "jsonrpc": "2.0",
3034  "id": 1,
3035  "result": {
3036    "allow_duplicated_isid": true,
3037    "default_time2retain": 60,
3038    "first_burst_length": 8192,
3039    "immediate_data": true,
3040    "node_base": "iqn.2016-06.io.spdk",
3041    "mutual_chap": false,
3042    "nop_in_interval": 30,
3043    "chap_group": 0,
3044    "max_connections_per_session": 2,
3045    "max_queue_depth": 64,
3046    "nop_timeout": 30,
3047    "max_sessions": 128,
3048    "error_recovery_level": 0,
3049    "auth_file": "/usr/local/etc/spdk/auth.conf",
3050    "disable_chap": true,
3051    "default_time2wait": 2,
3052    "require_chap": false
3053  }
3054}
3055~~~
3056## iscsi_set_discovery_auth method {#rpc_iscsi_set_discovery_auth}
3057
3058Set CHAP authentication for sessions dynamically.
3059
3060### Parameters
3061
3062Name                        | Optional | Type    | Description
3063--------------------------- | -------- | --------| -----------
3064disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
3065require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
3066mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
3067chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
3068
3069Parameters `disable_chap` and `require_chap` are mutually exclusive.
3070
3071### Example
3072
3073Example request:
3074
3075~~~
3076request:
3077{
3078  "params": {
3079    "chap_group": 1,
3080    "require_chap": true,
3081    "mutual_chap": true
3082  },
3083  "jsonrpc": "2.0",
3084  "method": "iscsi_set_discovery_auth",
3085  "id": 1
3086}
3087~~~
3088
3089Example response:
3090
3091~~~
3092{
3093  "jsonrpc": "2.0",
3094  "id": 1,
3095  "result": true
3096}
3097~~~
3098
3099## iscsi_create_auth_group method {#rpc_iscsi_create_auth_group}
3100
3101Create an authentication group for CHAP authentication.
3102
3103### Parameters
3104
3105Name                        | Optional | Type    | Description
3106--------------------------- | -------- | --------| -----------
3107tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3108secrets                     | Optional | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
3109
3110### secret {#rpc_iscsi_create_auth_group_secret}
3111
3112Name                        | Optional | Type    | Description
3113--------------------------- | ---------| --------| -----------
3114user                        | Required | string  | Unidirectional CHAP name
3115secret                      | Required | string  | Unidirectional CHAP secret
3116muser                       | Optional | string  | Bidirectional CHAP name
3117msecret                     | Optional | string  | Bidirectional CHAP secret
3118
3119### Example
3120
3121Example request:
3122
3123~~~
3124{
3125  "params": {
3126    "secrets": [
3127      {
3128        "muser": "mu1",
3129        "secret": "s1",
3130        "user": "u1",
3131        "msecret": "ms1"
3132      }
3133    ],
3134    "tag": 2
3135  },
3136  "jsonrpc": "2.0",
3137  "method": "iscsi_create_auth_group",
3138  "id": 1
3139}
3140~~~
3141
3142Example response:
3143
3144~~~
3145{
3146  "jsonrpc": "2.0",
3147  "id": 1,
3148  "result": true
3149}
3150~~~
3151
3152## iscsi_delete_auth_group method {#rpc_iscsi_delete_auth_group}
3153
3154Delete an existing authentication group for CHAP authentication.
3155
3156### Parameters
3157
3158Name                        | Optional | Type    | Description
3159--------------------------- | -------- | --------| -----------
3160tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3161
3162### Example
3163
3164Example request:
3165
3166~~~
3167{
3168  "params": {
3169    "tag": 2
3170  },
3171  "jsonrpc": "2.0",
3172  "method": "iscsi_delete_auth_group",
3173  "id": 1
3174}
3175~~~
3176
3177Example response:
3178
3179~~~
3180{
3181  "jsonrpc": "2.0",
3182  "id": 1,
3183  "result": true
3184}
3185~~~
3186
3187## iscsi_get_auth_groups {#rpc_iscsi_get_auth_groups}
3188
3189Show information about all existing authentication group for CHAP authentication.
3190
3191### Parameters
3192
3193This method has no parameters.
3194
3195### Result
3196
3197Array of objects describing authentication group.
3198
3199Name                        | Type    | Description
3200--------------------------- | --------| -----------
3201tag                         | number  | Authentication group tag
3202secrets                     | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
3203
3204### Example
3205
3206Example request:
3207
3208~~~
3209{
3210  "jsonrpc": "2.0",
3211  "method": "iscsi_get_auth_groups",
3212  "id": 1
3213}
3214~~~
3215Example response:
3216
3217~~~
3218{
3219  "jsonrpc": "2.0",
3220  "id": 1,
3221  "result": [
3222    {
3223      "secrets": [
3224        {
3225          "muser": "mu1",
3226          "secret": "s1",
3227          "user": "u1",
3228          "msecret": "ms1"
3229        }
3230      ],
3231      "tag": 1
3232    },
3233    {
3234      "secrets": [
3235        {
3236          "secret": "s2",
3237          "user": "u2"
3238        }
3239      ],
3240      "tag": 2
3241    }
3242  ]
3243}
3244~~~
3245
3246## iscsi_auth_group_add_secret {#rpc_iscsi_auth_group_add_secret}
3247
3248Add a secret to an existing authentication group for CHAP authentication.
3249
3250### Parameters
3251
3252Name                        | Optional | Type    | Description
3253--------------------------- | -------- | --------| -----------
3254tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3255user                        | Required | string  | Unidirectional CHAP name
3256secret                      | Required | string  | Unidirectional CHAP secret
3257muser                       | Optional | string  | Bidirectional CHAP name
3258msecret                     | Optional | string  | Bidirectional CHAP secret
3259
3260### Example
3261
3262Example request:
3263
3264~~~
3265{
3266  "params": {
3267    "muser": "mu3",
3268    "secret": "s3",
3269    "tag": 2,
3270    "user": "u3",
3271    "msecret": "ms3"
3272  },
3273  "jsonrpc": "2.0",
3274  "method": "iscsi_auth_group_add_secret",
3275  "id": 1
3276}
3277~~~
3278
3279Example response:
3280
3281~~~
3282{
3283  "jsonrpc": "2.0",
3284  "id": 1,
3285  "result": true
3286}
3287~~~
3288
3289## iscsi_auth_group_remove_secret {#rpc_iscsi_auth_group_remove_secret}
3290
3291Remove a secret from an existing authentication group for CHAP authentication.
3292
3293### Parameters
3294
3295Name                        | Optional | Type    | Description
3296--------------------------- | -------- | --------| -----------
3297tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3298user                        | Required | string  | Unidirectional CHAP name
3299
3300### Example
3301
3302Example request:
3303
3304~~~
3305{
3306  "params": {
3307    "tag": 2,
3308    "user": "u3"
3309  },
3310  "jsonrpc": "2.0",
3311  "method": "iscsi_auth_group_remove_secret",
3312  "id": 1
3313}
3314~~~
3315
3316Example response:
3317
3318~~~
3319{
3320  "jsonrpc": "2.0",
3321  "id": 1,
3322  "result": true
3323}
3324~~~
3325
3326## iscsi_get_initiator_groups method {#rpc_iscsi_get_initiator_groups}
3327
3328Show information about all available initiator groups.
3329
3330### Parameters
3331
3332This method has no parameters.
3333
3334### Result
3335
3336Array of objects describing initiator groups.
3337
3338Name                        | Type    | Description
3339--------------------------- | --------| -----------
3340tag                         | number  | Initiator group tag
3341initiators                  | array   | Array of initiator hostnames or IP addresses
3342netmasks                    | array   | Array of initiator netmasks
3343
3344### Example
3345
3346Example request:
3347
3348~~~
3349{
3350  "jsonrpc": "2.0",
3351  "method": "iscsi_get_initiator_groups",
3352  "id": 1
3353}
3354~~~
3355
3356Example response:
3357
3358~~~
3359{
3360  "jsonrpc": "2.0",
3361  "id": 1,
3362  "result": [
3363    {
3364      "initiators": [
3365        "iqn.2016-06.io.spdk:host1",
3366        "iqn.2016-06.io.spdk:host2"
3367      ],
3368      "tag": 1,
3369      "netmasks": [
3370        "192.168.1.0/24"
3371      ]
3372    }
3373  ]
3374}
3375~~~
3376
3377## iscsi_create_initiator_group method {#rpc_iscsi_create_initiator_group}
3378
3379Add an initiator group.
3380
3381### Parameters
3382
3383Name                        | Optional | Type    | Description
3384--------------------------- | -------- | --------| -----------
3385tag                         | Required | number  | Initiator group tag (unique, integer > 0)
3386initiators                  | Required | array   | Not empty array of initiator hostnames or IP addresses
3387netmasks                    | Required | array   | Not empty array of initiator netmasks
3388
3389### Example
3390
3391Example request:
3392
3393~~~
3394{
3395  "params": {
3396    "initiators": [
3397      "iqn.2016-06.io.spdk:host1",
3398      "iqn.2016-06.io.spdk:host2"
3399    ],
3400    "tag": 1,
3401    "netmasks": [
3402      "192.168.1.0/24"
3403    ]
3404  },
3405  "jsonrpc": "2.0",
3406  "method": "iscsi_create_initiator_group",
3407  "id": 1
3408}
3409~~~
3410
3411Example response:
3412
3413~~~
3414response:
3415{
3416  "jsonrpc": "2.0",
3417  "id": 1,
3418  "result": true
3419}
3420~~~
3421
3422## iscsi_delete_initiator_group method {#rpc_iscsi_delete_initiator_group}
3423
3424Delete an existing initiator group.
3425
3426### Parameters
3427
3428Name                        | Optional | Type    | Description
3429--------------------------- | -------- | --------| -----------
3430tag                         | Required | number  | Initiator group tag (unique, integer > 0)
3431
3432### Example
3433
3434Example request:
3435
3436~~~
3437{
3438  "params": {
3439    "tag": 1
3440  },
3441  "jsonrpc": "2.0",
3442  "method": "iscsi_delete_initiator_group",
3443  "id": 1
3444}
3445~~~
3446
3447Example response:
3448
3449~~~
3450{
3451  "jsonrpc": "2.0",
3452  "id": 1,
3453  "result": true
3454}
3455~~~
3456
3457## iscsi_initiator_group_add_initiators method {#rpc_iscsi_initiator_group_add_initiators}
3458
3459Add initiators to an existing initiator group.
3460
3461### Parameters
3462
3463Name                        | Optional | Type    | Description
3464--------------------------- | -------- | --------| -----------
3465tag                         | Required | number  | Existing initiator group tag.
3466initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
3467netmasks                    | Optional | array   | Array of initiator netmasks
3468
3469### Example
3470
3471Example request:
3472
3473~~~
3474request:
3475{
3476  "params": {
3477    "initiators": [
3478      "iqn.2016-06.io.spdk:host3"
3479    ],
3480    "tag": 1,
3481    "netmasks": [
3482      "255.255.255.1"
3483    ]
3484  },
3485  "jsonrpc": "2.0",
3486  "method": "iscsi_initiator_group_add_initiators",
3487  "id": 1
3488}
3489~~~
3490
3491Example response:
3492
3493~~~
3494response:
3495{
3496  "jsonrpc": "2.0",
3497  "id": 1,
3498  "result": true
3499}
3500~~~
3501
3502## iscsi_get_target_nodes method {#rpc_iscsi_get_target_nodes}
3503
3504Show information about all available iSCSI target nodes.
3505
3506### Parameters
3507
3508This method has no parameters.
3509
3510### Result
3511
3512Array of objects describing target node.
3513
3514Name                        | Type    | Description
3515--------------------------- | --------| -----------
3516name                        | string  | Target node name (ASCII)
3517alias_name                  | string  | Target node alias name (ASCII)
3518pg_ig_maps                  | array   | Array of Portal_Group_Tag:Initiator_Group_Tag mappings
3519luns                        | array   | Array of Bdev names to LUN ID mappings
3520queue_depth                 | number  | Target queue depth
3521disable_chap                | boolean | CHAP authentication should be disabled for this target
3522require_chap                | boolean | CHAP authentication should be required for this target
3523mutual_chap                 | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
3524chap_group                  | number  | Authentication group ID for this target node
3525header_digest               | boolean | Header Digest should be required for this target node
3526data_digest                 | boolean | Data Digest should be required for this target node
3527
3528### Example
3529
3530Example request:
3531
3532~~~
3533{
3534  "jsonrpc": "2.0",
3535  "method": "iscsi_get_target_nodes",
3536  "id": 1
3537}
3538~~~
3539
3540Example response:
3541
3542~~~
3543{
3544  "jsonrpc": "2.0",
3545  "id": 1,
3546  "result": [
3547    {
3548      "luns": [
3549        {
3550          "lun_id": 0,
3551          "bdev_name": "Nvme0n1"
3552        }
3553      ],
3554      "mutual_chap": false,
3555      "name": "iqn.2016-06.io.spdk:target1",
3556      "alias_name": "iscsi-target1-alias",
3557      "require_chap": false,
3558      "chap_group": 0,
3559      "pg_ig_maps": [
3560        {
3561          "ig_tag": 1,
3562          "pg_tag": 1
3563        }
3564      ],
3565      "data_digest": false,
3566      "disable_chap": false,
3567      "header_digest": false,
3568      "queue_depth": 64
3569    }
3570  ]
3571}
3572~~~
3573
3574## iscsi_create_target_node method {#rpc_iscsi_create_target_node}
3575
3576Add an iSCSI target node.
3577
3578### Parameters
3579
3580Name                        | Optional | Type    | Description
3581--------------------------- | -------- | --------| -----------
3582name                        | Required | string  | Target node name (ASCII)
3583alias_name                  | Required | string  | Target node alias name (ASCII)
3584pg_ig_maps                  | Required | array   | Array of (Portal_Group_Tag:Initiator_Group_Tag) mappings
3585luns                        | Required | array   | Array of Bdev names to LUN ID mappings
3586queue_depth                 | Required | number  | Target queue depth
3587disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
3588require_chap                | Optional | boolean | CHAP authentication should be required for this target
3589mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
3590chap_group                  | Optional | number  | Authentication group ID for this target node
3591header_digest               | Optional | boolean | Header Digest should be required for this target node
3592data_digest                 | Optional | boolean | Data Digest should be required for this target node
3593
3594Parameters `disable_chap` and `require_chap` are mutually exclusive.
3595
3596### Example
3597
3598Example request:
3599
3600~~~
3601{
3602  "params": {
3603    "luns": [
3604      {
3605        "lun_id": 0,
3606        "bdev_name": "Nvme0n1"
3607      }
3608    ],
3609    "mutual_chap": true,
3610    "name": "target2",
3611    "alias_name": "iscsi-target2-alias",
3612    "pg_ig_maps": [
3613      {
3614        "ig_tag": 1,
3615        "pg_tag": 1
3616      },
3617      {
3618        "ig_tag": 2,
3619        "pg_tag": 2
3620      }
3621    ],
3622    "data_digest": true,
3623    "disable_chap": true,
3624    "header_digest": true,
3625    "queue_depth": 24
3626  },
3627  "jsonrpc": "2.0",
3628  "method": "iscsi_create_target_node",
3629  "id": 1
3630}
3631~~~
3632
3633Example response:
3634
3635~~~
3636{
3637  "jsonrpc": "2.0",
3638  "id": 1,
3639  "result": true
3640}
3641~~~
3642
3643## iscsi_target_node_set_auth method {#rpc_iscsi_target_node_set_auth}
3644
3645Set CHAP authentication to an existing iSCSI target node.
3646
3647### Parameters
3648
3649Name                        | Optional | Type    | Description
3650--------------------------- | -------- | --------| -----------
3651name                        | Required | string  | Target node name (ASCII)
3652disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
3653require_chap                | Optional | boolean | CHAP authentication should be required for this target
3654mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
3655chap_group                  | Optional | number  | Authentication group ID for this target node
3656
3657Parameters `disable_chap` and `require_chap` are mutually exclusive.
3658
3659### Example
3660
3661Example request:
3662
3663~~~
3664{
3665  "params": {
3666    "chap_group": 1,
3667    "require_chap": true,
3668    "name": "iqn.2016-06.io.spdk:target1",
3669    "mutual_chap": true
3670  },
3671  "jsonrpc": "2.0",
3672  "method": "iscsi_target_node_set_auth",
3673  "id": 1
3674}
3675~~~
3676
3677Example response:
3678
3679~~~
3680{
3681  "jsonrpc": "2.0",
3682  "id": 1,
3683  "result": true
3684}
3685~~~
3686
3687## iscsi_target_node_add_pg_ig_maps method {#rpc_iscsi_target_node_add_pg_ig_maps}
3688
3689Add initiator group to portal group mappings to an existing iSCSI target node.
3690
3691### Parameters
3692
3693Name                        | Optional | Type    | Description
3694--------------------------- | -------- | --------| -----------
3695name                        | Required | string  | Target node name (ASCII)
3696pg_ig_maps                  | Required | array   | Not empty array of initiator to portal group mappings objects
3697
3698Portal to Initiator group mappings object:
3699
3700Name                        | Optional | Type    | Description
3701--------------------------- | -------- | --------| -----------
3702ig_tag                      | Required | number  | Existing initiator group tag
3703pg_tag                      | Required | number  | Existing portal group tag
3704
3705### Example
3706
3707Example request:
3708
3709~~~
3710{
3711  "params": {
3712    "pg_ig_maps": [
3713      {
3714        "ig_tag": 1,
3715        "pg_tag": 1
3716      },
3717      {
3718        "ig_tag": 2,
3719        "pg_tag": 2
3720      },
3721      {
3722        "ig_tag": 3,
3723        "pg_tag": 3
3724      }
3725    ],
3726    "name": "iqn.2016-06.io.spdk:target3"
3727  },
3728  "jsonrpc": "2.0",
3729  "method": "iscsi_target_node_add_pg_ig_maps",
3730  "id": 1
3731}
3732~~~
3733
3734Example response:
3735
3736~~~
3737{
3738  "jsonrpc": "2.0",
3739  "id": 1,
3740  "result": true
3741}
3742~~~
3743
3744## iscsi_target_node_remove_pg_ig_maps method {#rpc_iscsi_target_node_remove_pg_ig_maps}
3745
3746Delete initiator group to portal group mappings from an existing iSCSI target node.
3747
3748### Parameters
3749
3750Name                        | Optional | Type    | Description
3751--------------------------- | -------- | --------| -----------
3752name                        | Required | string  | Target node name (ASCII)
3753pg_ig_maps                  | Required | array   | Not empty array of Portal to Initiator group mappings objects
3754
3755Portal to Initiator group mappings object:
3756
3757Name                        | Optional | Type    | Description
3758--------------------------- | -------- | --------| -----------
3759ig_tag                      | Required | number  | Existing initiator group tag
3760pg_tag                      | Required | number  | Existing portal group tag
3761
3762### Example
3763
3764Example request:
3765
3766~~~
3767{
3768  "params": {
3769    "pg_ig_maps": [
3770      {
3771        "ig_tag": 1,
3772        "pg_tag": 1
3773      },
3774      {
3775        "ig_tag": 2,
3776        "pg_tag": 2
3777      },
3778      {
3779        "ig_tag": 3,
3780        "pg_tag": 3
3781      }
3782    ],
3783    "name": "iqn.2016-06.io.spdk:target3"
3784  },
3785  "jsonrpc": "2.0",
3786  "method": "iscsi_target_node_remove_pg_ig_maps",
3787  "id": 1
3788}
3789~~~
3790
3791Example response:
3792
3793~~~
3794{
3795  "jsonrpc": "2.0",
3796  "id": 1,
3797  "result": true
3798}
3799~~~
3800
3801## iscsi_delete_target_node method {#rpc_iscsi_delete_target_node}
3802
3803Delete an iSCSI target node.
3804
3805### Parameters
3806
3807Name                        | Optional | Type    | Description
3808--------------------------- | -------- | --------| -----------
3809name                        | Required | string  | Target node name (ASCII)
3810
3811### Example
3812
3813Example request:
3814
3815~~~
3816{
3817  "params": {
3818    "name": "iqn.2016-06.io.spdk:target1"
3819  },
3820  "jsonrpc": "2.0",
3821  "method": "iscsi_delete_target_node",
3822  "id": 1
3823}
3824~~~
3825
3826Example response:
3827
3828~~~
3829{
3830  "jsonrpc": "2.0",
3831  "id": 1,
3832  "result": true
3833}
3834~~~
3835
3836## iscsi_get_portal_groups method {#rpc_iscsi_get_portal_groups}
3837
3838Show information about all available portal groups.
3839
3840### Parameters
3841
3842This method has no parameters.
3843
3844### Example
3845
3846Example request:
3847
3848~~~
3849request:
3850{
3851  "jsonrpc": "2.0",
3852  "method": "iscsi_get_portal_groups",
3853  "id": 1
3854}
3855~~~
3856
3857Example response:
3858
3859~~~
3860{
3861  "jsonrpc": "2.0",
3862  "id": 1,
3863  "result": [
3864    {
3865      "portals": [
3866        {
3867          "host": "127.0.0.1",
3868          "port": "3260"
3869        }
3870      ],
3871      "tag": 1
3872    }
3873  ]
3874}
3875~~~
3876
3877## iscsi_create_portal_group method {#rpc_iscsi_create_portal_group}
3878
3879Add a portal group.
3880
3881### Parameters
3882
3883Name                        | Optional | Type    | Description
3884--------------------------- | -------- | --------| -----------
3885tag                         | Required | number  | Portal group tag
3886portals                     | Required | array   | Not empty array of portals
3887
3888Portal object
3889
3890Name                        | Optional | Type    | Description
3891--------------------------- | -------- | --------| -----------
3892host                        | Required | string  | Hostname or IP address
3893port                        | Required | string  | Port number
3894
3895### Example
3896
3897Example request:
3898
3899~~~
3900{
3901  "params": {
3902    "portals": [
3903      {
3904        "host": "127.0.0.1",
3905        "port": "3260"
3906      }
3907    ],
3908    "tag": 1
3909  },
3910  "jsonrpc": "2.0",
3911  "method": "iscsi_create_portal_group",
3912  "id": 1
3913}
3914~~~
3915
3916Example response:
3917
3918~~~
3919{
3920  "jsonrpc": "2.0",
3921  "id": 1,
3922  "result": true
3923}
3924~~~
3925
3926## iscsi_delete_portal_group method {#rpc_iscsi_delete_portal_group}
3927
3928Delete an existing portal group.
3929
3930### Parameters
3931
3932Name                        | Optional | Type    | Description
3933--------------------------- | -------- | --------| -----------
3934tag                         | Required | number  | Existing portal group tag
3935
3936### Example
3937
3938Example request:
3939
3940~~~
3941{
3942  "params": {
3943    "tag": 1
3944  },
3945  "jsonrpc": "2.0",
3946  "method": "iscsi_delete_portal_group",
3947  "id": 1
3948}
3949~~~
3950
3951Example response:
3952
3953~~~
3954{
3955  "jsonrpc": "2.0",
3956  "id": 1,
3957  "result": true
3958}
3959~~~
3960
3961### iscsi_portal_group_set_auth method {#rpc_iscsi_portal_group_set_auth}
3962
3963Set CHAP authentication for discovery sessions specific for the existing iSCSI portal group.
3964This RPC overwrites the setting by the global parameters for the iSCSI portal group.
3965
3966### Parameters
3967
3968Name                        | Optional | Type    | Description
3969--------------------------- | -------- | --------| -----------
3970disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
3971require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
3972mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
3973chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
3974
3975Parameters `disable_chap` and `require_chap` are mutually exclusive.
3976
3977### Example
3978
3979Example request:
3980
3981~~~
3982request:
3983{
3984  "params": {
3985    "tag": 1,
3986    "chap_group": 1,
3987    "require_chap": true,
3988    "mutual_chap": true
3989  },
3990  "jsonrpc": "2.0",
3991  "method": "iscsi_portal_group_set_auth",
3992  "id": 1
3993}
3994~~~
3995
3996Example response:
3997
3998~~~
3999{
4000  "jsonrpc": "2.0",
4001  "id": 1,
4002  "result": true
4003}
4004~~~
4005
4006## iscsi_get_connections method {#rpc_iscsi_get_connections}
4007
4008Show information about all active connections.
4009
4010### Parameters
4011
4012This method has no parameters.
4013
4014### Results
4015
4016Array of objects describing iSCSI connection.
4017
4018Name                        | Type    | Description
4019--------------------------- | --------| -----------
4020id                          | number  | Index (used for TTT - Target Transfer Tag)
4021cid                         | number  | CID (Connection ID)
4022tsih                        | number  | TSIH (Target Session Identifying Handle)
4023lcore_id                    | number  | Core number on which the iSCSI connection runs
4024initiator_addr              | string  | Initiator address
4025target_addr                 | string  | Target address
4026target_node_name            | string  | Target node name (ASCII) without prefix
4027
4028### Example
4029
4030Example request:
4031
4032~~~
4033{
4034  "jsonrpc": "2.0",
4035  "method": "iscsi_get_connections",
4036  "id": 1
4037}
4038~~~
4039
4040Example response:
4041
4042~~~
4043{
4044  "jsonrpc": "2.0",
4045  "id": 1,
4046  "result": [
4047    {
4048      "tsih": 4,
4049      "cid": 0,
4050      "target_node_name": "target1",
4051      "lcore_id": 0,
4052      "initiator_addr": "10.0.0.2",
4053      "target_addr": "10.0.0.1",
4054      "id": 0
4055    }
4056  ]
4057}
4058~~~
4059
4060## iscsi_target_node_add_lun method {#rpc_iscsi_target_node_add_lun}
4061
4062Add an LUN to an existing iSCSI target node.
4063
4064### Parameters
4065
4066Name                        | Optional | Type    | Description
4067--------------------------- | -------- | --------| -----------
4068name                        | Required | string  | Target node name (ASCII)
4069bdev_name                   | Required | string  | bdev name to be added as a LUN
4070lun_id                      | Optional | number  | LUN ID (default: first free ID)
4071
4072### Example
4073
4074Example request:
4075
4076~~~
4077{
4078  "params": {
4079    "lun_id": 2,
4080    "name": "iqn.2016-06.io.spdk:target1",
4081    "bdev_name": "Malloc0"
4082  },
4083  "jsonrpc": "2.0",
4084  "method": "iscsi_target_node_add_lun",
4085  "id": 1
4086}
4087~~~
4088
4089Example response:
4090
4091~~~
4092{
4093  "jsonrpc": "2.0",
4094  "id": 1,
4095  "result": true
4096}
4097~~~
4098
4099# NVMe-oF Target {#jsonrpc_components_nvmf_tgt}
4100
4101## nvmf_create_transport method {#rpc_nvmf_create_transport}
4102
4103Initialize an NVMe-oF transport with the given options.
4104
4105### Parameters
4106
4107Name                        | Optional | Type    | Description
4108--------------------------- | -------- | --------| -----------
4109trtype                      | Required | string  | Transport type (ex. RDMA)
4110tgt_name                    | Optional | string  | Parent NVMe-oF target name.
4111max_queue_depth             | Optional | number  | Max number of outstanding I/O per queue
4112max_qpairs_per_ctrlr        | Optional | number  | Max number of SQ and CQ per controller (deprecated, use max_io_qpairs_per_ctrlr)
4113max_io_qpairs_per_ctrlr     | Optional | number  | Max number of IO qpairs per controller
4114in_capsule_data_size        | Optional | number  | Max number of in-capsule data size
4115max_io_size                 | Optional | number  | Max I/O size (bytes)
4116io_unit_size                | Optional | number  | I/O unit size (bytes)
4117max_aq_depth                | Optional | number  | Max number of admin cmds per AQ
4118num_shared_buffers          | Optional | number  | The number of pooled data buffers available to the transport
4119buf_cache_size              | Optional | number  | The number of shared buffers to reserve for each poll group
4120max_srq_depth               | Optional | number  | The number of elements in a per-thread shared receive queue (RDMA only)
4121no_srq                      | Optional | boolean | Disable shared receive queue even for devices that support it. (RDMA only)
4122c2h_success                 | Optional | boolean | Disable C2H success optimization (TCP only)
4123dif_insert_or_strip         | Optional | boolean | Enable DIF insert for write I/O and DIF strip for read I/O DIF
4124sock_priority               | Optional | number  | The socket priority of the connection owned by this transport (TCP only)
4125acceptor_backlog            | Optional | number  | The number of pending connections allowed in backlog before failing new connection attempts (RDMA only)
4126abort_timeout_sec           | Optional | number  | Abort execution timeout value, in seconds
4127
4128### Example
4129
4130Example request:
4131
4132~~~
4133{
4134  "jsonrpc": "2.0",
4135  "method": "nvmf_create_transport",
4136  "id": 1,
4137  "params": {
4138    "trtype": "RDMA",
4139    "max_queue_depth": 32
4140  }
4141}
4142~~~
4143
4144Example response:
4145
4146~~~
4147{
4148  "jsonrpc": "2.0",
4149  "id": 1,
4150  "result": true
4151}
4152~~~
4153
4154## nvmf_get_subsystems method {#rpc_nvmf_get_subsystems}
4155
4156### Parameters
4157
4158Name                        | Optional | Type        | Description
4159--------------------------- | -------- | ------------| -----------
4160tgt_name                    | Optional | string      | Parent NVMe-oF target name.
4161
4162### Example
4163
4164Example request:
4165
4166~~~
4167{
4168  "jsonrpc": "2.0",
4169  "id": 1,
4170  "method": "nvmf_get_subsystems"
4171}
4172~~~
4173
4174Example response:
4175
4176~~~
4177{
4178  "jsonrpc": "2.0",
4179  "id": 1,
4180  "result": [
4181    {
4182      "nqn": "nqn.2014-08.org.nvmexpress.discovery",
4183      "subtype": "Discovery"
4184      "listen_addresses": [],
4185      "hosts": [],
4186      "allow_any_host": true
4187    },
4188    {
4189      "nqn": "nqn.2016-06.io.spdk:cnode1",
4190      "subtype": "NVMe",
4191      "listen_addresses": [
4192        {
4193          "trtype": "RDMA",
4194          "adrfam": "IPv4",
4195          "traddr": "192.168.0.123",
4196          "trsvcid": "4420"
4197        }
4198      ],
4199      "hosts": [
4200        {"nqn": "nqn.2016-06.io.spdk:host1"}
4201      ],
4202      "allow_any_host": false,
4203      "serial_number": "abcdef",
4204      "model_number": "ghijklmnop",
4205      "namespaces": [
4206        {"nsid": 1, "name": "Malloc2"},
4207        {"nsid": 2, "name": "Nvme0n1"}
4208      ]
4209    }
4210  ]
4211}
4212~~~
4213
4214## nvmf_create_subsystem method {#rpc_nvmf_create_subsystem}
4215
4216Construct an NVMe over Fabrics target subsystem.
4217
4218### Parameters
4219
4220Name                    | Optional | Type        | Description
4221----------------------- | -------- | ----------- | -----------
4222nqn                     | Required | string      | Subsystem NQN
4223tgt_name                | Optional | string      | Parent NVMe-oF target name.
4224serial_number           | Optional | string      | Serial number of virtual controller
4225model_number            | Optional | string      | Model number of virtual controller
4226max_namespaces          | Optional | number      | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
4227allow_any_host          | Optional | boolean     | Allow any host (`true`) or enforce allowed host whitelist (`false`). Default: `false`.
4228
4229### Example
4230
4231Example request:
4232
4233~~~
4234{
4235  "jsonrpc": "2.0",
4236  "id": 1,
4237  "method": "nvmf_create_subsystem",
4238  "params": {
4239    "nqn": "nqn.2016-06.io.spdk:cnode1",
4240    "allow_any_host": false,
4241    "serial_number": "abcdef",
4242    "model_number": "ghijklmnop"
4243  }
4244}
4245~~~
4246
4247Example response:
4248
4249~~~
4250{
4251  "jsonrpc": "2.0",
4252  "id": 1,
4253  "result": true
4254}
4255~~~
4256
4257## nvmf_delete_subsystem method {#rpc_nvmf_delete_subsystem}
4258
4259Delete an existing NVMe-oF subsystem.
4260
4261### Parameters
4262
4263Parameter              | Optional | Type        | Description
4264---------------------- | -------- | ----------- | -----------
4265nqn                    | Required | string      | Subsystem NQN to delete.
4266tgt_name               | Optional | string      | Parent NVMe-oF target name.
4267
4268### Example
4269
4270Example request:
4271
4272~~~
4273{
4274  "jsonrpc": "2.0",
4275  "id": 1,
4276  "method": "nvmf_delete_subsystem",
4277  "params": {
4278    "nqn": "nqn.2016-06.io.spdk:cnode1"
4279  }
4280}
4281~~~
4282
4283Example response:
4284
4285~~~
4286{
4287  "jsonrpc": "2.0",
4288  "id": 1,
4289  "result": true
4290}
4291~~~
4292
4293## nvmf_subsystem_add_listener  method {#rpc_nvmf_subsystem_add_listener}
4294
4295Add a new listen address to an NVMe-oF subsystem.
4296
4297### Parameters
4298
4299Name                    | Optional | Type        | Description
4300----------------------- | -------- | ----------- | -----------
4301nqn                     | Required | string      | Subsystem NQN
4302tgt_name                | Optional | string      | Parent NVMe-oF target name.
4303listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
4304
4305### listen_address {#rpc_nvmf_listen_address}
4306
4307Name                    | Optional | Type        | Description
4308----------------------- | -------- | ----------- | -----------
4309trtype                  | Required | string      | Transport type ("RDMA")
4310adrfam                  | Required | string      | Address family ("IPv4", "IPv6", "IB", or "FC")
4311traddr                  | Required | string      | Transport address
4312trsvcid                 | Required | string      | Transport service ID
4313
4314### Example
4315
4316Example request:
4317
4318~~~
4319{
4320  "jsonrpc": "2.0",
4321  "id": 1,
4322  "method": "nvmf_subsystem_add_listener",
4323  "params": {
4324    "nqn": "nqn.2016-06.io.spdk:cnode1",
4325    "listen_address": {
4326      "trtype": "RDMA",
4327      "adrfam": "IPv4",
4328      "traddr": "192.168.0.123",
4329      "trsvcid": "4420"
4330    }
4331  }
4332}
4333~~~
4334
4335Example response:
4336
4337~~~
4338{
4339  "jsonrpc": "2.0",
4340  "id": 1,
4341  "result": true
4342}
4343~~~
4344
4345## nvmf_subsystem_add_ns method {#rpc_nvmf_subsystem_add_ns}
4346
4347Add a namespace to a subsystem. The namespace ID is returned as the result.
4348
4349### Parameters
4350
4351Name                    | Optional | Type        | Description
4352----------------------- | -------- | ----------- | -----------
4353nqn                     | Required | string      | Subsystem NQN
4354namespace               | Required | object      | @ref rpc_nvmf_namespace object
4355tgt_name                | Optional | string      | Parent NVMe-oF target name.
4356
4357### namespace {#rpc_nvmf_namespace}
4358
4359Name                    | Optional | Type        | Description
4360----------------------- | -------- | ----------- | -----------
4361nsid                    | Optional | number      | Namespace ID between 1 and 4294967294, inclusive. Default: Automatically assign NSID.
4362bdev_name               | Required | string      | Name of bdev to expose as a namespace.
4363nguid                   | Optional | string      | 16-byte namespace globally unique identifier in hexadecimal (e.g. "ABCDEF0123456789ABCDEF0123456789")
4364eui64                   | Optional | string      | 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789")
4365uuid                    | Optional | string      | RFC 4122 UUID (e.g. "ceccf520-691e-4b46-9546-34af789907c5")
4366ptpl_file               | Optional | string      | File path to save/restore persistent reservation information
4367
4368### Example
4369
4370Example request:
4371
4372~~~
4373{
4374  "jsonrpc": "2.0",
4375  "id": 1,
4376  "method": "nvmf_subsystem_add_ns",
4377  "params": {
4378    "nqn": "nqn.2016-06.io.spdk:cnode1",
4379    "namespace": {
4380      "nsid": 3,
4381      "bdev_name": "Nvme0n1",
4382      "ptpl_file": "/opt/Nvme0n1PR.json"
4383    }
4384  }
4385}
4386~~~
4387
4388Example response:
4389
4390~~~
4391{
4392  "jsonrpc": "2.0",
4393  "id": 1,
4394  "result": 3
4395}
4396~~~
4397
4398## nvmf_subsystem_remove_ns method {#rpc_nvmf_subsystem_remove_ns}
4399
4400Remove a namespace from a subsystem.
4401
4402### Parameters
4403
4404Name                    | Optional | Type        | Description
4405----------------------- | -------- | ----------- | -----------
4406nqn                     | Required | string      | Subsystem NQN
4407nsid                    | Required | number      | Namespace ID
4408tgt_name                | Optional | string      | Parent NVMe-oF target name.
4409
4410### Example
4411
4412Example request:
4413
4414~~~
4415{
4416  "jsonrpc": "2.0",
4417  "id": 1,
4418  "method": "nvmf_subsystem_remove_ns",
4419  "params": {
4420    "nqn": "nqn.2016-06.io.spdk:cnode1",
4421    "nsid": 1
4422  }
4423}
4424~~~
4425
4426Example response:
4427
4428~~~
4429{
4430  "jsonrpc": "2.0",
4431  "id": 1,
4432  "result": true
4433}
4434~~~
4435
4436## nvmf_subsystem_add_host method {#rpc_nvmf_subsystem_add_host}
4437
4438Add a host NQN to the whitelist of allowed hosts.
4439
4440### Parameters
4441
4442Name                    | Optional | Type        | Description
4443----------------------- | -------- | ----------- | -----------
4444nqn                     | Required | string      | Subsystem NQN
4445host                    | Required | string      | Host NQN to add to the list of allowed host NQNs
4446tgt_name                | Optional | string      | Parent NVMe-oF target name.
4447
4448### Example
4449
4450Example request:
4451
4452~~~
4453{
4454  "jsonrpc": "2.0",
4455  "id": 1,
4456  "method": "nvmf_subsystem_add_host",
4457  "params": {
4458    "nqn": "nqn.2016-06.io.spdk:cnode1",
4459    "host": "nqn.2016-06.io.spdk:host1"
4460  }
4461}
4462~~~
4463
4464Example response:
4465
4466~~~
4467{
4468  "jsonrpc": "2.0",
4469  "id": 1,
4470  "result": true
4471}
4472~~~
4473
4474## nvmf_subsystem_remove_host method {#rpc_nvmf_subsystem_remove_host}
4475
4476Remove a host NQN from the whitelist of allowed hosts.
4477
4478### Parameters
4479
4480Name                    | Optional | Type        | Description
4481----------------------- | -------- | ----------- | -----------
4482nqn                     | Required | string      | Subsystem NQN
4483host                    | Required | string      | Host NQN to remove from the list of allowed host NQNs
4484tgt_name                | Optional | string      | Parent NVMe-oF target name.
4485
4486### Example
4487
4488Example request:
4489
4490~~~
4491{
4492  "jsonrpc": "2.0",
4493  "id": 1,
4494  "method": "nvmf_subsystem_remove_host",
4495  "params": {
4496    "nqn": "nqn.2016-06.io.spdk:cnode1",
4497    "host": "nqn.2016-06.io.spdk:host1"
4498  }
4499}
4500~~~
4501
4502Example response:
4503
4504~~~
4505{
4506  "jsonrpc": "2.0",
4507  "id": 1,
4508  "result": true
4509}
4510~~~
4511
4512## nvmf_subsystem_allow_any_host method {#rpc_nvmf_subsystem_allow_any_host}
4513
4514Configure a subsystem to allow any host to connect or to enforce the host NQN whitelist.
4515
4516### Parameters
4517
4518Name                    | Optional | Type        | Description
4519----------------------- | -------- | ----------- | -----------
4520nqn                     | Required | string      | Subsystem NQN
4521allow_any_host          | Required | boolean     | Allow any host (`true`) or enforce allowed host whitelist (`false`).
4522tgt_name                | Optional | string      | Parent NVMe-oF target name.
4523
4524### Example
4525
4526Example request:
4527
4528~~~
4529{
4530  "jsonrpc": "2.0",
4531  "id": 1,
4532  "method": "nvmf_subsystem_allow_any_host",
4533  "params": {
4534    "nqn": "nqn.2016-06.io.spdk:cnode1",
4535    "allow_any_host": true
4536  }
4537}
4538~~~
4539
4540Example response:
4541
4542~~~
4543{
4544  "jsonrpc": "2.0",
4545  "id": 1,
4546  "result": true
4547}
4548~~~
4549
4550## nvmf_set_max_subsystems {#rpc_nvmf_set_max_subsystems}
4551
4552Set the maximum allowed subsystems for the NVMe-oF target.  This RPC may only be called
4553before SPDK subsystems have been initialized.
4554
4555### Parameters
4556
4557Name                    | Optional | Type        | Description
4558----------------------- | -------- | ----------- | -----------
4559max_subsystems          | Required | number      | Maximum number of NVMe-oF subsystems
4560
4561### Example
4562
4563Example request:
4564
4565~~~
4566{
4567  "jsonrpc": "2.0",
4568  "id": 1,
4569  "method": "nvmf_set_max_subsystems",
4570  "params": {
4571    "max_subsystems": 1024
4572  }
4573}
4574~~~
4575
4576Example response:
4577
4578~~~
4579{
4580  "jsonrpc": "2.0",
4581  "id": 1,
4582  "result": true
4583}
4584~~~
4585
4586## nvmf_set_config {#rpc_nvmf_set_config}
4587
4588Set global configuration of NVMe-oF target.  This RPC may only be called before SPDK subsystems
4589have been initialized.
4590
4591### Parameters
4592
4593Name                    | Optional | Type        | Description
4594----------------------- | -------- | ----------- | -----------
4595acceptor_poll_rate      | Optional | number      | Polling interval of the acceptor for incoming connections (microseconds)
4596admin_cmd_passthru      | Optional | object      | Admin command passthru configuration
4597
4598### admin_cmd_passthru {#spdk_nvmf_admin_passthru_conf}
4599
4600Name                    | Optional | Type        | Description
4601----------------------- | -------- | ----------- | -----------
4602identify_ctrlr          | Required | bool        | If true, enables custom identify handler that reports some identify attributes from the underlying NVMe drive
4603
4604### Example
4605
4606Example request:
4607
4608~~~
4609{
4610  "jsonrpc": "2.0",
4611  "id": 1,
4612  "method": "nvmf_set_config",
4613  "params": {
4614    "acceptor_poll_rate": 10000
4615  }
4616}
4617~~~
4618
4619Example response:
4620
4621~~~
4622{
4623  "jsonrpc": "2.0",
4624  "id": 1,
4625  "result": true
4626}
4627~~~
4628
4629## nvmf_get_transports method {#rpc_nvmf_get_transports}
4630
4631### Parameters
4632
4633Name                        | Optional | Type        | Description
4634--------------------------- | -------- | ------------| -----------
4635tgt_name                    | Optional | string      | Parent NVMe-oF target name.
4636
4637### Example
4638
4639Example request:
4640
4641~~~
4642{
4643  "jsonrpc": "2.0",
4644  "id": 1,
4645  "method": "nvmf_get_transports"
4646}
4647~~~
4648
4649Example response:
4650
4651~~~
4652{
4653  "jsonrpc": "2.0",
4654  "id": 1,
4655  "result": [
4656    {
4657      "type": "RDMA".
4658      "max_queue_depth": 128,
4659      "max_io_qpairs_per_ctrlr": 64,
4660      "in_capsule_data_size": 4096,
4661      "max_io_size": 131072,
4662      "io_unit_size": 131072,
4663      "abort_timeout_sec": 1
4664    }
4665  ]
4666}
4667~~~
4668
4669## nvmf_get_stats method {#rpc_nvmf_get_stats}
4670
4671Retrieve current statistics of the NVMf subsystem.
4672
4673### Parameters
4674
4675Name                        | Optional | Type        | Description
4676--------------------------- | -------- | ------------| -----------
4677tgt_name                    | Optional | string      | Parent NVMe-oF target name.
4678
4679### Response
4680
4681The response is an object containing NVMf subsystem statistics.
4682
4683### Example
4684
4685Example request:
4686~~~
4687{
4688  "jsonrpc": "2.0",
4689  "method": "nvmf_get_stats",
4690  "id": 1
4691}
4692~~~
4693
4694Example response:
4695~~~
4696{
4697  "jsonrpc": "2.0",
4698  "id": 1,
4699  "result": {
4700    "tick_rate": 2400000000,
4701    "poll_groups": [
4702      {
4703        "name": "app_thread",
4704        "admin_qpairs": 1,
4705        "io_qpairs": 4,
4706        "pending_bdev_io": 1721,
4707        "transports": [
4708          {
4709            "trtype": "RDMA",
4710            "pending_data_buffer": 12131888,
4711            "devices": [
4712              {
4713                "name": "mlx5_1",
4714                "polls": 72284105,
4715                "completions": 0,
4716                "requests": 0,
4717                "request_latency": 0,
4718                "pending_free_request": 0,
4719                "pending_rdma_read": 0,
4720                "pending_rdma_write": 0
4721              },
4722              {
4723                "name": "mlx5_0",
4724                "polls": 72284105,
4725                "completions": 15165875,
4726                "requests": 7582935,
4727                "request_latency": 1249323766184,
4728                "pending_free_request": 0,
4729                "pending_rdma_read": 337602,
4730                "pending_rdma_write": 0
4731              }
4732            ]
4733          }
4734        ]
4735      }
4736    ]
4737  }
4738}
4739~~~
4740
4741# Vhost Target {#jsonrpc_components_vhost_tgt}
4742
4743The following common preconditions need to be met in all target types.
4744
4745Controller name will be used to create UNIX domain socket. This implies that name concatenated with vhost socket
4746directory path needs to be valid UNIX socket name.
4747
4748@ref cpu_mask parameter is used to choose CPU on which pollers will be launched when new initiator is connecting.
4749It must be a subset of application CPU mask. Default value is CPU mask of the application.
4750
4751## vhost_controller_set_coalescing {#rpc_vhost_controller_set_coalescing}
4752
4753Controls interrupt coalescing for specific target. Because `delay_base_us` is used to calculate delay in CPU ticks
4754there is no hardcoded limit for this parameter. Only limitation is that final delay in CPU ticks might not overflow
475532 bit unsigned integer (which is more than 1s @ 4GHz CPU). In real scenarios `delay_base_us` should be much lower
4756than 150us. To disable coalescing set `delay_base_us` to 0.
4757
4758### Parameters
4759
4760Name                    | Optional | Type        | Description
4761----------------------- | -------- | ----------- | -----------
4762ctrlr                   | Required | string      | Controller name
4763delay_base_us           | Required | number      | Base (minimum) coalescing time in microseconds
4764iops_threshold          | Required | number      | Coalescing activation level greater than 0 in IO per second
4765
4766### Example
4767
4768Example request:
4769
4770~~~
4771{
4772  "params": {
4773    "iops_threshold": 100000,
4774    "ctrlr": "VhostScsi0",
4775    "delay_base_us": 80
4776  },
4777  "jsonrpc": "2.0",
4778  "method": "vhost_controller_set_coalescing",
4779  "id": 1
4780}
4781~~~
4782
4783Example response:
4784
4785~~~
4786{
4787  "jsonrpc": "2.0",
4788  "id": 1,
4789  "result": true
4790}
4791~~~
4792
4793## vhost_create_scsi_controller {#rpc_vhost_create_scsi_controller}
4794
4795Construct vhost SCSI target.
4796
4797### Parameters
4798
4799Name                    | Optional | Type        | Description
4800----------------------- | -------- | ----------- | -----------
4801ctrlr                   | Required | string      | Controller name
4802cpumask                 | Optional | string      | @ref cpu_mask for this controller
4803
4804### Example
4805
4806Example request:
4807
4808~~~
4809{
4810  "params": {
4811    "cpumask": "0x2",
4812    "ctrlr": "VhostScsi0"
4813  },
4814  "jsonrpc": "2.0",
4815  "method": "vhost_create_scsi_controller",
4816  "id": 1
4817}
4818~~~
4819
4820Example response:
4821
4822~~~
4823{
4824  "jsonrpc": "2.0",
4825  "id": 1,
4826  "result": true
4827}
4828~~~
4829
4830## vhost_scsi_controller_add_target {#rpc_vhost_scsi_controller_add_target}
4831
4832In vhost target `ctrlr` create SCSI target with ID `scsi_target_num` and add `bdev_name` as LUN 0.
4833
4834### Parameters
4835
4836Name                    | Optional | Type        | Description
4837----------------------- | -------- | ----------- | -----------
4838ctrlr                   | Required | string      | Controller name
4839scsi_target_num         | Required | number      | SCSI target ID between 0 and 7 or -1 to use first free ID.
4840bdev_name               | Required | string      | Name of bdev to expose as a LUN 0
4841
4842### Response
4843
4844SCSI target ID.
4845
4846### Example
4847
4848Example request:
4849
4850~~~
4851{
4852  "params": {
4853    "scsi_target_num": 1,
4854    "bdev_name": "Malloc0",
4855    "ctrlr": "VhostScsi0"
4856  },
4857  "jsonrpc": "2.0",
4858  "method": "vhost_scsi_controller_add_target",
4859  "id": 1
4860}
4861~~~
4862
4863Example response:
4864
4865~~~
4866response:
4867{
4868  "jsonrpc": "2.0",
4869  "id": 1,
4870  "result": 1
4871}
4872~~~
4873
4874## vhost_scsi_controller_remove_target {#rpc_vhost_scsi_controller_remove_target}
4875
4876Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`.
4877
4878This method will fail if initiator is connected, but doesn't support hot-remove (the `VIRTIO_SCSI_F_HOTPLUG` is not negotiated).
4879
4880### Parameters
4881
4882Name                    | Optional | Type        | Description
4883----------------------- | -------- | ----------- | -----------
4884ctrlr                   | Required | string      | Controller name
4885scsi_target_num         | Required | number      | SCSI target ID between 0 and 7
4886
4887### Example
4888
4889Example request:
4890
4891~~~
4892request:
4893{
4894  "params": {
4895    "scsi_target_num": 1,
4896    "ctrlr": "VhostScsi0"
4897  },
4898  "jsonrpc": "2.0",
4899  "method": "vhost_scsi_controller_remove_target",
4900  "id": 1
4901}
4902~~~
4903
4904Example response:
4905
4906~~~
4907{
4908  "jsonrpc": "2.0",
4909  "id": 1,
4910  "result": true
4911}
4912~~~
4913
4914## vhost_create_nvme_controller {#rpc_vhost_create_nvme_controller}
4915
4916Construct empty vhost NVMe controller.
4917
4918### Parameters
4919
4920Name                    | Optional | Type        | Description
4921----------------------- | -------- | ----------- | -----------
4922ctrlr                   | Required | string      | Controller name
4923io_queues               | Required | number      | Number between 1 and 31 of IO queues for the controller
4924cpumask                 | Optional | string      | @ref cpu_mask for this controller
4925
4926### Example
4927
4928Example request:
4929
4930~~~
4931{
4932  "params": {
4933    "cpumask": "0x2",
4934    "io_queues": 4,
4935    "ctrlr": "VhostNvme0"
4936  },
4937  "jsonrpc": "2.0",
4938  "method": "vhost_create_nvme_controller",
4939  "id": 1
4940}
4941~~~
4942
4943Example response:
4944
4945~~~
4946{
4947  "jsonrpc": "2.0",
4948  "id": 1,
4949  "result": true
4950}
4951~~~
4952
4953## vhost_nvme_controller_add_ns {#rpc_vhost_nvme_controller_add_ns}
4954
4955Add namespace backed by `bdev_name`
4956
4957### Parameters
4958
4959Name                    | Optional | Type        | Description
4960----------------------- | -------- | ----------- | -----------
4961ctrlr                   | Required | string      | Controller name
4962bdev_name               | Required | string      | Name of bdev to expose as a namespace
4963cpumask                 | Optional | string      | @ref cpu_mask for this controller
4964
4965### Example
4966
4967Example request:
4968
4969~~~
4970{
4971  "params": {
4972    "bdev_name": "Malloc0",
4973    "ctrlr": "VhostNvme0"
4974  },
4975  "jsonrpc": "2.0",
4976  "method": "vhost_nvme_controller_add_ns",
4977  "id": 1
4978}
4979~~~
4980
4981Example response:
4982
4983~~~
4984{
4985  "jsonrpc": "2.0",
4986  "id": 1,
4987  "result": true
4988}
4989~~~
4990
4991## vhost_create_blk_controller {#rpc_vhost_create_blk_controller}
4992
4993Create vhost block controller
4994
4995If `readonly` is `true` then vhost block target will be created as read only and fail any write requests.
4996The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator.
4997
4998### Parameters
4999
5000Name                    | Optional | Type        | Description
5001----------------------- | -------- | ----------- | -----------
5002ctrlr                   | Required | string      | Controller name
5003bdev_name               | Required | string      | Name of bdev to expose block device
5004readonly                | Optional | boolean     | If true, this target will be read only (default: false)
5005cpumask                 | Optional | string      | @ref cpu_mask for this controller
5006
5007### Example
5008
5009Example request:
5010
5011~~~
5012{
5013  "params": {
5014    "dev_name": "Malloc0",
5015    "ctrlr": "VhostBlk0"
5016  },
5017  "jsonrpc": "2.0",
5018  "method": "vhost_create_blk_controller",
5019  "id": 1
5020}
5021~~~
5022
5023Example response:
5024
5025~~~
5026{
5027  "jsonrpc": "2.0",
5028  "id": 1,
5029  "result": true
5030}
5031~~~
5032
5033## vhost_get_controllers {#rpc_vhost_get_controllers}
5034
5035Display information about all or specific vhost controller(s).
5036
5037### Parameters
5038
5039The user may specify no parameters in order to list all controllers, or a controller may be
5040specified by name.
5041
5042Name                    | Optional | Type        | Description
5043----------------------- | -------- | ----------- | -----------
5044name                    | Optional | string      | Vhost controller name
5045
5046### Response {#rpc_vhost_get_controllers_response}
5047
5048Response is an array of objects describing requested controller(s). Common fields are:
5049
5050Name                    | Type        | Description
5051----------------------- | ----------- | -----------
5052ctrlr                   | string      | Controller name
5053cpumask                 | string      | @ref cpu_mask of this controller
5054delay_base_us           | number      | Base (minimum) coalescing time in microseconds (0 if disabled)
5055iops_threshold          | number      | Coalescing activation level
5056backend_specific        | object      | Backend specific informations
5057
5058### Vhost block {#rpc_vhost_get_controllers_blk}
5059
5060`backend_specific` contains one `block` object  of type:
5061
5062Name                    | Type        | Description
5063----------------------- | ----------- | -----------
5064bdev                    | string      | Backing bdev name or Null if bdev is hot-removed
5065readonly                | boolean     | True if controllers is readonly, false otherwise
5066
5067### Vhost SCSI {#rpc_vhost_get_controllers_scsi}
5068
5069`backend_specific` contains `scsi` array of following objects:
5070
5071Name                    | Type        | Description
5072----------------------- | ----------- | -----------
5073target_name             | string      | Name of this SCSI target
5074id                      | number      | Unique SPDK global SCSI target ID
5075scsi_dev_num            | number      | SCSI target ID initiator will see when scanning this controller
5076luns                    | array       | array of objects describing @ref rpc_vhost_get_controllers_scsi_luns
5077
5078### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns}
5079
5080Object of type:
5081
5082Name                    | Type        | Description
5083----------------------- | ----------- | -----------
5084id                      | number      | SCSI LUN ID
5085bdev_name               | string      | Backing bdev name
5086
5087### Vhost NVMe {#rpc_vhost_get_controllers_nvme}
5088
5089`backend_specific` contains `namespaces` array of following objects:
5090
5091Name                    | Type        | Description
5092----------------------- | ----------- | -----------
5093nsid                    | number      | Namespace ID
5094bdev                    | string      | Backing bdev name
5095
5096### Example
5097
5098Example request:
5099
5100~~~
5101{
5102  "jsonrpc": "2.0",
5103  "method": "vhost_get_controllers",
5104  "id": 1
5105}
5106~~~
5107
5108Example response:
5109
5110~~~
5111{
5112  "jsonrpc": "2.0",
5113  "id": 1,
5114  "result": [
5115    {
5116      "cpumask": "0x2",
5117      "backend_specific": {
5118        "block": {
5119          "readonly": false,
5120          "bdev": "Malloc0"
5121        }
5122      },
5123      "iops_threshold": 60000,
5124      "ctrlr": "VhostBlk0",
5125      "delay_base_us": 100
5126    },
5127    {
5128      "cpumask": "0x2",
5129      "backend_specific": {
5130        "scsi": [
5131          {
5132            "target_name": "Target 2",
5133            "luns": [
5134              {
5135                "id": 0,
5136                "bdev_name": "Malloc1"
5137              }
5138            ],
5139            "id": 0,
5140            "scsi_dev_num": 2
5141          },
5142          {
5143            "target_name": "Target 5",
5144            "luns": [
5145              {
5146                "id": 0,
5147                "bdev_name": "Malloc2"
5148              }
5149            ],
5150            "id": 1,
5151            "scsi_dev_num": 5
5152          }
5153        ]
5154      },
5155      "iops_threshold": 60000,
5156      "ctrlr": "VhostScsi0",
5157      "delay_base_us": 0
5158    },
5159    {
5160      "cpumask": "0x2",
5161      "backend_specific": {
5162        "namespaces": [
5163          {
5164            "bdev": "Malloc3",
5165            "nsid": 1
5166          },
5167          {
5168            "bdev": "Malloc4",
5169            "nsid": 2
5170          }
5171        ]
5172      },
5173      "iops_threshold": 60000,
5174      "ctrlr": "VhostNvme0",
5175      "delay_base_us": 0
5176    }
5177  ]
5178}
5179~~~
5180
5181## vhost_delete_controller {#rpc_vhost_delete_controller}
5182
5183Remove vhost target.
5184
5185This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of
5186vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_vhost_scsi_controller_remove_target.
5187
5188### Parameters
5189
5190Name                    | Optional | Type        | Description
5191----------------------- | -------- | ----------- | -----------
5192ctrlr                   | Required | string      | Controller name
5193
5194### Example
5195
5196Example request:
5197
5198~~~
5199{
5200  "params": {
5201    "ctrlr": "VhostNvme0"
5202  },
5203  "jsonrpc": "2.0",
5204  "method": "vhost_delete_controller",
5205  "id": 1
5206}
5207~~~
5208
5209Example response:
5210
5211~~~
5212{
5213  "jsonrpc": "2.0",
5214  "id": 1,
5215  "result": true
5216}
5217~~~
5218
5219# Logical Volume {#jsonrpc_components_lvol}
5220
5221Identification of logical volume store and logical volume is explained first.
5222
5223A logical volume store has a UUID and a name for its identification.
5224The UUID is generated on creation and it can be used as a unique identifier.
5225The name is specified on creation and can be renamed.
5226Either UUID or name is used to access logical volume store in RPCs.
5227
5228A logical volume has a UUID and a name for its identification.
5229The UUID of the logical volume is generated on creation and it can be unique identifier.
5230The alias of the logical volume takes the format _lvs_name/lvol_name_ where:
5231
5232* _lvs_name_ is the name of the logical volume store.
5233* _lvol_name_ is specified on creation and can be renamed.
5234
5235## bdev_lvol_create_lvstore {#rpc_bdev_lvol_create_lvstore}
5236
5237Construct a logical volume store.
5238
5239### Parameters
5240
5241Name                    | Optional | Type        | Description
5242----------------------- | -------- | ----------- | -----------
5243bdev_name               | Required | string      | Bdev on which to construct logical volume store
5244lvs_name                | Required | string      | Name of the logical volume store to create
5245cluster_sz              | Optional | number      | Cluster size of the logical volume store in bytes
5246clear_method            | Optional | string      | Change clear method for data region. Available: none, unmap (default), write_zeroes
5247
5248### Response
5249
5250UUID of the created logical volume store is returned.
5251
5252### Example
5253
5254Example request:
5255
5256~~~
5257{
5258  "jsonrpc": "2.0",
5259  "id": 1,
5260  "method": "bdev_lvol_create_lvstore",
5261  "params": {
5262    "lvs_name": "LVS0",
5263    "bdev_name": "Malloc0"
5264    "clear_method": "write_zeroes"
5265  }
5266}
5267~~~
5268
5269Example response:
5270
5271~~~
5272{
5273  "jsonrpc": "2.0",
5274  "id": 1,
5275  "result": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
5276}
5277~~~
5278
5279## bdev_lvol_delete_lvstore {#rpc_bdev_lvol_delete_lvstore}
5280
5281Destroy a logical volume store.
5282
5283### Parameters
5284
5285Name                    | Optional | Type        | Description
5286----------------------- | -------- | ----------- | -----------
5287uuid                    | Optional | string      | UUID of the logical volume store to destroy
5288lvs_name                | Optional | string      | Name of the logical volume store to destroy
5289
5290Either uuid or lvs_name must be specified, but not both.
5291
5292### Example
5293
5294Example request:
5295
5296~~~
5297{
5298  "jsonrpc": "2.0",
5299  "method": "bdev_lvol_delete_lvstore",
5300  "id": 1
5301  "params": {
5302    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
5303  }
5304}
5305~~~
5306
5307Example response:
5308
5309~~~
5310{
5311  "jsonrpc": "2.0",
5312  "id": 1,
5313  "result": true
5314}
5315~~~
5316
5317## bdev_lvol_get_lvstores {#rpc_bdev_lvol_get_lvstores}
5318
5319Get a list of logical volume stores.
5320
5321### Parameters
5322
5323Name                    | Optional | Type        | Description
5324----------------------- | -------- | ----------- | -----------
5325uuid                    | Optional | string      | UUID of the logical volume store to retrieve information about
5326lvs_name                | Optional | string      | Name of the logical volume store to retrieve information about
5327
5328Either uuid or lvs_name may be specified, but not both.
5329If both uuid and lvs_name are omitted, information about all logical volume stores is returned.
5330
5331### Example
5332
5333Example request:
5334
5335~~~
5336{
5337  "jsonrpc": "2.0",
5338  "method": "bdev_lvol_get_lvstores",
5339  "id": 1,
5340  "params": {
5341    "lvs_name": "LVS0"
5342  }
5343}
5344~~~
5345
5346Example response:
5347
5348~~~
5349{
5350  "jsonrpc": "2.0",
5351  "id": 1,
5352  "result": [
5353    {
5354      "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5",
5355      "base_bdev": "Malloc0",
5356      "free_clusters": 31,
5357      "cluster_size": 4194304,
5358      "total_data_clusters": 31,
5359      "block_size": 4096,
5360      "name": "LVS0"
5361    }
5362  ]
5363}
5364~~~
5365
5366## bdev_lvol_rename_lvstore {#rpc_bdev_lvol_rename_lvstore}
5367
5368Rename a logical volume store.
5369
5370### Parameters
5371
5372Name                    | Optional | Type        | Description
5373----------------------- | -------- | ----------- | -----------
5374old_name                | Required | string      | Existing logical volume store name
5375new_name                | Required | string      | New logical volume store name
5376
5377### Example
5378
5379Example request:
5380
5381~~~
5382{
5383  "jsonrpc": "2.0",
5384  "method": "bdev_lvol_rename_lvstore",
5385  "id": 1,
5386  "params": {
5387    "old_name": "LVS0",
5388    "new_name": "LVS2"
5389  }
5390}
5391~~~
5392
5393Example response:
5394
5395~~~
5396{
5397  "jsonrpc": "2.0",
5398  "id": 1,
5399  "result": true
5400}
5401~~~
5402
5403## bdev_lvol_create {#rpc_bdev_lvol_create}
5404
5405Create a logical volume on a logical volume store.
5406
5407### Parameters
5408
5409Name                    | Optional | Type        | Description
5410----------------------- | -------- | ----------- | -----------
5411lvol_name               | Required | string      | Name of logical volume to create
5412size                    | Required | number      | Desired size of logical volume in bytes
5413thin_provision          | Optional | boolean     | True to enable thin provisioning
5414uuid                    | Optional | string      | UUID of logical volume store to create logical volume on
5415lvs_name                | Optional | string      | Name of logical volume store to create logical volume on
5416clear_method            | Optional | string      | Change default data clusters clear method. Available: none, unmap, write_zeroes
5417
5418Size will be rounded up to a multiple of cluster size. Either uuid or lvs_name must be specified, but not both.
5419lvol_name will be used in the alias of the created logical volume.
5420
5421### Response
5422
5423UUID of the created logical volume is returned.
5424
5425### Example
5426
5427Example request:
5428
5429~~~
5430{
5431  "jsonrpc": "2.0",
5432  "method": "bdev_lvol_create",
5433  "id": 1,
5434  "params": {
5435    "lvol_name": "LVOL0",
5436    "size": 1048576,
5437    "lvs_name": "LVS0",
5438    "clear_method": "unmap",
5439    "thin_provision": true
5440  }
5441}
5442~~~
5443
5444Example response:
5445
5446~~~
5447{
5448  "jsonrpc": "2.0",
5449  "id": 1,
5450  "result": "1b38702c-7f0c-411e-a962-92c6a5a8a602"
5451}
5452~~~
5453
5454## bdev_lvol_snapshot {#rpc_bdev_lvol_snapshot}
5455
5456Capture a snapshot of the current state of a logical volume.
5457
5458### Parameters
5459
5460Name                    | Optional | Type        | Description
5461----------------------- | -------- | ----------- | -----------
5462lvol_name               | Required | string      | UUID or alias of the logical volume to create a snapshot from
5463snapshot_name           | Required | string      | Name for the newly created snapshot
5464
5465### Response
5466
5467UUID of the created logical volume snapshot is returned.
5468
5469### Example
5470
5471Example request:
5472
5473~~~
5474{
5475  "jsonrpc": "2.0",
5476  "method": "bdev_lvol_snapshot",
5477  "id": 1,
5478  "params": {
5479    "lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602",
5480    "snapshot_name": "SNAP1"
5481  }
5482}
5483~~~
5484
5485Example response:
5486
5487~~~
5488{
5489  "jsonrpc": "2.0",
5490  "id": 1,
5491  "result": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670"
5492}
5493~~~
5494
5495## bdev_lvol_clone {#rpc_bdev_lvol_clone}
5496
5497Create a logical volume based on a snapshot.
5498
5499### Parameters
5500
5501Name                    | Optional | Type        | Description
5502----------------------- | -------- | ----------- | -----------
5503snapshot_name           | Required | string      | UUID or alias of the snapshot to clone
5504clone_name              | Required | string      | Name for the logical volume to create
5505
5506### Response
5507
5508UUID of the created logical volume clone is returned.
5509
5510### Example
5511
5512Example request:
5513
5514~~~
5515{
5516  "jsonrpc": "2.0"
5517  "method": "bdev_lvol_clone",
5518  "id": 1,
5519  "params": {
5520    "snapshot_name": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670",
5521    "clone_name": "CLONE1"
5522  }
5523}
5524~~~
5525
5526Example response:
5527
5528~~~
5529{
5530  "jsonrpc": "2.0",
5531  "id": 1,
5532  "result": "8d87fccc-c278-49f0-9d4c-6237951aca09"
5533}
5534~~~
5535
5536## bdev_lvol_rename {#rpc_bdev_lvol_rename}
5537
5538Rename a logical volume. New name will rename only the alias of the logical volume.
5539
5540### Parameters
5541
5542Name                    | Optional | Type        | Description
5543----------------------- | -------- | ----------- | -----------
5544old_name                | Required | string      | UUID or alias of the existing logical volume
5545new_name                | Required | string      | New logical volume name
5546
5547### Example
5548
5549Example request:
5550
5551~~~
5552{
5553  "jsonrpc": "2.0",
5554  "method": "bdev_lvol_rename",
5555  "id": 1,
5556  "params": {
5557    "old_name": "067df606-6dbc-4143-a499-0d05855cb3b8",
5558    "new_name": "LVOL2"
5559  }
5560}
5561~~~
5562
5563Example response:
5564
5565~~~
5566{
5567  "jsonrpc": "2.0",
5568  "id": 1,
5569  "result": true
5570}
5571~~~
5572
5573## bdev_lvol_resize {#rpc_bdev_lvol_resize}
5574
5575Resize a logical volume.
5576
5577### Parameters
5578
5579Name                    | Optional | Type        | Description
5580----------------------- | -------- | ----------- | -----------
5581name                    | Required | string      | UUID or alias of the logical volume to resize
5582size                    | Required | number      | Desired size of the logical volume in bytes
5583
5584### Example
5585
5586Example request:
5587
5588~~~
5589{
5590  "jsonrpc": "2.0",
5591  "method": "bdev_lvol_resize",
5592  "id": 1,
5593  "params": {
5594    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
5595    "size": 2097152
5596  }
5597}
5598~~~
5599
5600Example response:
5601
5602~~~
5603{
5604  "jsonrpc": "2.0",
5605  "id": 1,
5606  "result": true
5607}
5608~~~
5609
5610## bdev_lvol_set_read_only{#rpc_bdev_lvol_set_read_only}
5611
5612Mark logical volume as read only.
5613
5614### Parameters
5615
5616Name                    | Optional | Type        | Description
5617----------------------- | -------- | ----------- | -----------
5618name                    | Required | string      | UUID or alias of the logical volume to set as read only
5619
5620### Example
5621
5622Example request:
5623
5624~~~
5625{
5626  "jsonrpc": "2.0",
5627  "method": "bdev_lvol_set_read_only",
5628  "id": 1,
5629  "params": {
5630    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
5631  }
5632}
5633~~~
5634
5635Example response:
5636
5637~~~
5638{
5639  "jsonrpc": "2.0",
5640  "id": 1,
5641  "result": true
5642}
5643~~~
5644
5645## bdev_lvol_delete {#rpc_bdev_lvol_delete}
5646
5647Destroy a logical volume.
5648
5649### Parameters
5650
5651Name                    | Optional | Type        | Description
5652----------------------- | -------- | ----------- | -----------
5653name                    | Required | string      | UUID or alias of the logical volume to destroy
5654
5655### Example
5656
5657Example request:
5658
5659~~~
5660{
5661  "jsonrpc": "2.0",
5662  "method": "bdev_lvol_delete",
5663  "id": 1,
5664  "params": {
5665    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a"
5666  }
5667}
5668~~~
5669
5670Example response:
5671
5672~~~
5673{
5674  "jsonrpc": "2.0",
5675  "id": 1,
5676  "result": true
5677}
5678~~~
5679
5680## bdev_lvol_inflate {#rpc_bdev_lvol_inflate}
5681
5682Inflate a logical volume. All unallocated clusters are allocated and copied from the parent or zero filled if not allocated in the parent. Then all dependencies on the parent are removed.
5683
5684### Parameters
5685
5686Name                    | Optional | Type        | Description
5687----------------------- | -------- | ----------- | -----------
5688name                    | Required | string      | UUID or alias of the logical volume to inflate
5689
5690### Example
5691
5692Example request:
5693
5694~~~
5695{
5696  "jsonrpc": "2.0",
5697  "method": "bdev_lvol_inflate",
5698  "id": 1,
5699  "params": {
5700    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
5701  }
5702}
5703~~~
5704
5705Example response:
5706
5707~~~
5708{
5709  "jsonrpc": "2.0",
5710  "id": 1,
5711  "result": true
5712}
5713~~~
5714
5715## bdev_lvol_decouple_parent {#rpc_bdev_lvol_decouple_parent}
5716
5717Decouple the parent of a logical volume. For unallocated clusters which is allocated in the parent, they are allocated and copied from the parent, but for unallocated clusters which is thin provisioned in the parent, they are kept thin provisioned. Then all dependencies on the parent are removed.
5718
5719### Parameters
5720
5721Name                    | Optional | Type        | Description
5722----------------------- | -------- | ----------- | -----------
5723name                    | Required | string      | UUID or alias of the logical volume to decouple the parent of it
5724
5725### Example
5726
5727Example request:
5728
5729~~~
5730{
5731  "jsonrpc": "2.0",
5732  "method": "bdev_lvol_decouple_parent",
5733  "id": 1.
5734  "params": {
5735    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
5736  }
5737}
5738~~~
5739
5740Example response:
5741
5742~~~
5743{
5744  "jsonrpc": "2.0",
5745  "id": 1,
5746  "result": true
5747}
5748~~~
5749
5750# RAID
5751
5752## bdev_raid_get_bdevs {#rpc_bdev_raid_get_bdevs}
5753
5754This is used to list all the raid bdev names based on the input category requested. Category should be one
5755of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether they are online or
5756configuring or offline. 'online' is the raid bdev which is registered with bdev layer. 'configuring' is
5757the raid bdev which does not have full configuration discovered yet. 'offline' is the raid bdev which is
5758not registered with bdev as of now and it has encountered any error or user has requested to offline
5759the raid bdev.
5760
5761### Parameters
5762
5763Name                    | Optional | Type        | Description
5764----------------------- | -------- | ----------- | -----------
5765category                | Required | string      | all or online or configuring or offline
5766
5767### Example
5768
5769Example request:
5770
5771~~~
5772{
5773  "jsonrpc": "2.0",
5774  "method": "bdev_raid_get_bdevs",
5775  "id": 1,
5776  "params": {
5777    "category": "all"
5778  }
5779}
5780~~~
5781
5782Example response:
5783
5784~~~
5785{
5786  "jsonrpc": "2.0",
5787  "id": 1,
5788  "result": [
5789    "Raid0"
5790  ]
5791}
5792~~~
5793
5794## bdev_raid_create {#rpc_bdev_raid_create}
5795
5796Constructs new RAID bdev.
5797
5798### Parameters
5799
5800Name                    | Optional | Type        | Description
5801----------------------- | -------- | ----------- | -----------
5802name                    | Required | string      | RAID bdev name
5803strip_size_kb           | Required | number      | Strip size in KB
5804raid_level              | Required | string      | RAID level
5805base_bdevs              | Required | string      | Base bdevs name, whitespace separated list in quotes
5806
5807### Example
5808
5809Example request:
5810
5811~~~
5812{
5813  "jsonrpc": "2.0",
5814  "method": "bdev_raid_create",
5815  "id": 1,
5816  "params": {
5817    "name": "Raid0",
5818    "raid_level": "0",
5819    "base_bdevs": [
5820      "Malloc0",
5821      "Malloc1",
5822      "Malloc2",
5823      "Malloc3"
5824    ],
5825    "strip_size": 4096
5826  }
5827}
5828~~~
5829
5830Example response:
5831
5832~~~
5833{
5834  "jsonrpc": "2.0",
5835  "id": 1,
5836  "result": true
5837}
5838~~~
5839
5840## bdev_raid_delete {#rpc_bdev_raid_delete}
5841
5842Removes RAID bdev.
5843
5844### Parameters
5845
5846Name                    | Optional | Type        | Description
5847----------------------- | -------- | ----------- | -----------
5848name                    | Required | string      | RAID bdev name
5849
5850### Example
5851
5852Example request:
5853
5854~~~
5855{
5856  "jsonrpc": "2.0",
5857  "method": "bdev_raid_delete",
5858  "id": 1,
5859  "params": {
5860    "name": "Raid0"
5861  }
5862}
5863~~~
5864
5865Example response:
5866
5867~~~
5868{
5869  "jsonrpc": "2.0",
5870  "id": 1,
5871  "result": true
5872}
5873~~~
5874
5875# OPAL
5876
5877## bdev_nvme_opal_init {#rpc_bdev_nvme_opal_init}
5878
5879This is used to initialize OPAL of a given NVMe ctrlr, including taking ownership and activating.
5880
5881### Parameters
5882
5883Name                    | Optional | Type        | Description
5884----------------------- | -------- | ----------- | -----------
5885nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
5886password                | Required | string      | admin password of OPAL
5887
5888### Example
5889
5890Example request:
5891
5892~~~
5893{
5894  "jsonrpc": "2.0",
5895  "method": "bdev_nvme_opal_init",
5896  "id": 1,
5897  "params": {
5898    "nvme_ctrlr_name": "nvme0",
5899    "password": "*****"
5900  }
5901}
5902~~~
5903
5904Example response:
5905
5906~~~
5907{
5908  "jsonrpc": "2.0",
5909  "id": 1,
5910  "result": true
5911}
5912~~~
5913
5914## bdev_nvme_opal_revert {#rpc_bdev_nvme_opal_revert}
5915
5916This is used to revert OPAL to its factory settings. Erase all user configuration and data.
5917
5918### Parameters
5919
5920Name                    | Optional | Type        | Description
5921----------------------- | -------- | ----------- | -----------
5922nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
5923password                | Required | string      | admin password of OPAL
5924
5925### Example
5926
5927Example request:
5928
5929~~~
5930{
5931  "jsonrpc": "2.0",
5932  "method": "bdev_nvme_opal_revert",
5933  "id": 1,
5934  "params": {
5935    "nvme_ctrlr_name": "nvme0",
5936    "password": "*****"
5937  }
5938}
5939~~~
5940
5941Example response:
5942
5943~~~
5944{
5945  "jsonrpc": "2.0",
5946  "id": 1,
5947  "result": true
5948}
5949~~~
5950
5951## bdev_opal_create {#rpc_bdev_opal_create}
5952
5953This is used to create an OPAL virtual bdev.
5954
5955### Parameters
5956
5957Name                    | Optional | Type        | Description
5958----------------------- | -------- | ----------- | -----------
5959nvme_ctrlr_name         | Required | string      | name of nvme ctrlr that supports OPAL
5960nsid                    | Required | number      | namespace ID
5961locking_range_id        | Required | number      | OPAL locking range ID
5962range_start             | Required | number      | locking range start LBA
5963range_length            | Required | number      | locking range length
5964password                | Required | string      | admin password of OPAL
5965
5966### Response
5967
5968The response is the name of created OPAL virtual bdev.
5969
5970### Example
5971
5972Example request:
5973
5974~~~
5975{
5976  "jsonrpc": "2.0",
5977  "method": "bdev_opal_create",
5978  "id": 1,
5979  "params": {
5980    "nvme_ctrlr_name": "nvme0",
5981    "nsid": 1,
5982    "locking_range_id": 1,
5983    "range_start": 0,
5984    "range_length": 4096,
5985    "password": "*****"
5986  }
5987}
5988~~~
5989
5990Example response:
5991
5992~~~
5993{
5994  "jsonrpc": "2.0",
5995  "id": 1,
5996  "result": "nvme0n1r1"
5997}
5998~~~
5999
6000## bdev_opal_get_info {#rpc_bdev_opal_get_info}
6001
6002This is used to get information of a given OPAL bdev.
6003
6004### Parameters
6005
6006Name                    | Optional | Type        | Description
6007----------------------- | -------- | ----------- | -----------
6008bdev_name               | Required | string      | name of OPAL vbdev
6009password                | Required | string      | admin password
6010
6011### Response
6012
6013The response is the locking info of OPAL virtual bdev.
6014
6015### Example
6016
6017Example request:
6018
6019~~~
6020{
6021  "jsonrpc": "2.0",
6022  "method": "bdev_opal_get_info",
6023  "id": 1,
6024  "params": {
6025    "bdev_name": "nvme0n1r1",
6026    "password": "*****"
6027  }
6028}
6029~~~
6030
6031Example response:
6032
6033~~~
6034{
6035  "jsonrpc": "2.0",
6036  "id": 1,
6037  "result": {
6038      "name": "nvme0n1r1",
6039      "range_start": 0,
6040      "range_length": 4096,
6041      "read_lock_enabled": true,
6042      "write_lock_enabled": true,
6043      "read_locked": false,
6044      "write_locked": false
6045    }
6046}
6047~~~
6048
6049## bdev_opal_delete {#rpc_bdev_opal_delete}
6050
6051This is used to delete OPAL vbdev.
6052
6053### Parameters
6054
6055Name                    | Optional | Type        | Description
6056----------------------- | -------- | ----------- | -----------
6057bdev_name               | Required | string      | name of OPAL vbdev
6058password                | Required | string      | admin password
6059
6060### Example
6061
6062Example request:
6063
6064~~~
6065{
6066  "jsonrpc": "2.0",
6067  "method": "bdev_opal_delete",
6068  "id": 1,
6069  "params": {
6070    "bdev_name": "nvme0n1r1",
6071    "password": "*****"
6072  }
6073}
6074~~~
6075
6076Example response:
6077
6078~~~
6079{
6080  "jsonrpc": "2.0",
6081  "id": 1,
6082  "result": true
6083}
6084~~~
6085
6086## bdev_opal_new_user {#rpc_bdev_opal_new_user}
6087
6088This enables a new user to the specified opal bdev so that the user can lock/unlock the bdev.
6089Recalling this for the same opal bdev, only the newest user will have the privilege.
6090
6091### Parameters
6092
6093Name                    | Optional | Type        | Description
6094----------------------- | -------- | ----------- | -----------
6095bdev_name               | Required | string      | name of OPAL vbdev
6096admin_password          | Required | string      | admin password
6097user_id                 | Required | number      | user ID
6098user_password           | Required | string      | user password
6099
6100### Example
6101
6102Example request:
6103
6104~~~
6105{
6106  "jsonrpc": "2.0",
6107  "method": "bdev_opal_new_user",
6108  "id": 1,
6109  "params": {
6110    "bdev_name": "nvme0n1r1",
6111    "admin_password": "*****",
6112    "user_id": "1",
6113    "user_password": "********"
6114  }
6115}
6116~~~
6117
6118Example response:
6119
6120~~~
6121{
6122  "jsonrpc": "2.0",
6123  "id": 1,
6124  "result": true
6125}
6126~~~
6127
6128## bdev_opal_set_lock_state {#rpc_bdev_opal_set_lock_state}
6129
6130This is used to lock/unlock specific opal bdev providing user ID and password.
6131
6132### Parameters
6133
6134Name                    | Optional | Type        | Description
6135----------------------- | -------- | ----------- | -----------
6136bdev_name               | Required | string      | name of OPAL vbdev
6137user_id                 | Required | number      | user ID
6138password                | Required | string      | user password
6139lock_state              | Required | string      | lock state
6140
6141### Example
6142
6143Example request:
6144
6145~~~
6146{
6147  "jsonrpc": "2.0",
6148  "method": "bdev_opal_set_lock_state",
6149  "id": 1,
6150  "params": {
6151    "bdev_name": "nvme0n1r1",
6152    "user_id": "1",
6153    "user_password": "********",
6154    "lock_state": "rwlock"
6155  }
6156}
6157~~~
6158
6159Example response:
6160
6161~~~
6162{
6163  "jsonrpc": "2.0",
6164  "id": 1,
6165  "result": true
6166}
6167~~~
6168
6169# Notifications
6170
6171## notify_get_types {#rpc_notify_get_types}
6172
6173Return list of all supported notification types.
6174
6175### Parameters
6176
6177None
6178
6179### Response
6180
6181The response is an array of strings - supported RPC notification types.
6182
6183### Example
6184
6185Example request:
6186
6187~~~
6188{
6189  "jsonrpc": "2.0",
6190  "method": "notify_get_types",
6191  "id": 1
6192}
6193~~~
6194
6195Example response:
6196
6197~~~
6198{
6199  "id": 1,
6200  "result": [
6201    "bdev_register",
6202    "bdev_unregister"
6203  ],
6204  "jsonrpc": "2.0"
6205}
6206~~~
6207
6208## notify_get_notifications {#notify_get_notifications}
6209
6210Request notifications. Returns array of notifications that happend since the specified id (or first that is available).
6211
6212Notice: Notifications are kept in circular buffer with limited size. Older notifications might be inaccesible due to being overwritten by new ones.
6213
6214### Parameters
6215
6216Name                    | Optional | Type        | Description
6217----------------------- | -------- | ----------- | -----------
6218id                      | Optional | number      | First Event ID to fetch (default: first available).
6219max                     | Optional | number      | Maximum number of event to return (default: no limit).
6220
6221### Response
6222
6223Response is an array of event objects.
6224
6225Name                    | Optional | Type        | Description
6226----------------------- | -------- | ----------- | -----------
6227id                      | Optional | number      | Event ID.
6228type                    | Optional | number      | Type of the event.
6229ctx                     | Optional | string      | Event context.
6230
6231### Example
6232
6233Example request:
6234
6235~~~
6236{
6237  "id": 1,
6238  "jsonrpc": "2.0",
6239  "method": "notify_get_notifications",
6240  "params": {
6241    "id": 1,
6242    "max": 10
6243  }
6244}
6245
6246~~~
6247
6248Example response:
6249
6250~~~
6251{
6252  "jsonrpc": "2.0",
6253  "id": 1,
6254  "result": [
6255    {
6256      "ctx": "Malloc0",
6257      "type": "bdev_register",
6258      "id": 1
6259    },
6260    {
6261      "ctx": "Malloc2",
6262      "type": "bdev_register",
6263      "id": 2
6264    }
6265  ]
6266}
6267~~~
6268
6269# Linux Network Block Device (NBD) {#jsonrpc_components_nbd}
6270
6271SPDK 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.
6272
6273In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.
6274
6275## nbd_start_disk {#rpc_nbd_start_disk}
6276
6277Start to export one SPDK bdev as NBD disk
6278
6279### Parameters
6280
6281Name                    | Optional | Type        | Description
6282----------------------- | -------- | ----------- | -----------
6283bdev_name               | Required | string      | Bdev name to export
6284nbd_device              | Optional | string      | NBD device name to assign
6285
6286### Response
6287
6288Path of exported NBD disk
6289
6290### Example
6291
6292Example request:
6293
6294~~~
6295{
6296 "params": {
6297    "nbd_device": "/dev/nbd1",
6298    "bdev_name": "Malloc1"
6299  },
6300  "jsonrpc": "2.0",
6301  "method": "nbd_start_disk",
6302  "id": 1
6303}
6304~~~
6305
6306Example response:
6307
6308~~~
6309{
6310  "jsonrpc": "2.0",
6311  "id": 1,
6312  "result": "/dev/nbd1"
6313}
6314~~~
6315
6316## nbd_stop_disk {#rpc_nbd_stop_disk}
6317
6318Stop one NBD disk which is based on SPDK bdev.
6319
6320### Parameters
6321
6322Name                    | Optional | Type        | Description
6323----------------------- | -------- | ----------- | -----------
6324nbd_device              | Required | string      | NBD device name to stop
6325
6326### Example
6327
6328Example request:
6329
6330~~~
6331{
6332 "params": {
6333    "nbd_device": "/dev/nbd1",
6334  },
6335  "jsonrpc": "2.0",
6336  "method": "nbd_stop_disk",
6337  "id": 1
6338}
6339~~~
6340
6341Example response:
6342
6343~~~
6344{
6345  "jsonrpc": "2.0",
6346  "id": 1,
6347  "result": "true"
6348}
6349~~~
6350
6351## nbd_get_disks {#rpc_nbd_get_disks}
6352
6353Display all or specified NBD device list
6354
6355### Parameters
6356
6357Name                    | Optional | Type        | Description
6358----------------------- | -------- | ----------- | -----------
6359nbd_device              | Optional | string      | NBD device name to display
6360
6361### Response
6362
6363The response is an array of exported NBD devices and their corresponding SPDK bdev.
6364
6365### Example
6366
6367Example request:
6368
6369~~~
6370{
6371  "jsonrpc": "2.0",
6372  "method": "nbd_get_disks",
6373  "id": 1
6374}
6375~~~
6376
6377Example response:
6378
6379~~~
6380{
6381  "jsonrpc": "2.0",
6382  "id": 1,
6383  "result":  [
6384    {
6385      "bdev_name": "Malloc0",
6386      "nbd_device": "/dev/nbd0"
6387    },
6388    {
6389      "bdev_name": "Malloc1",
6390      "nbd_device": "/dev/nbd1"
6391    }
6392  ]
6393}
6394~~~
6395
6396# Blobfs {#jsonrpc_components_blobfs}
6397
6398## blobfs_detect {#rpc_blobfs_detect}
6399
6400Detect whether a blobfs exists on bdev.
6401
6402### Parameters
6403
6404Name                    | Optional | Type        | Description
6405----------------------- | -------- | ----------- | -----------
6406bdev_name               | Required | string      | Block device name to detect blobfs
6407
6408### Response
6409
6410True if a blobfs exists on the bdev; False otherwise.
6411
6412### Example
6413
6414Example request:
6415
6416~~~
6417{
6418  "jsonrpc": "2.0",
6419  "id": 1,
6420  "method": "blobfs_detect",
6421  "params": {
6422    "bdev_name": "Malloc0"
6423  }
6424}
6425~~~
6426
6427Example response:
6428
6429~~~
6430{
6431  "jsonrpc": "2.0",
6432  "id": 1,
6433  "result": "true"
6434}
6435~~~
6436
6437## blobfs_create {#rpc_blobfs_create}
6438
6439Build blobfs on bdev.
6440
6441### Parameters
6442
6443Name                    | Optional | Type        | Description
6444----------------------- | -------- | ----------- | -----------
6445bdev_name               | Required | string      | Block device name to create blobfs
6446cluster_sz              | Optional | number      | Size of cluster in bytes. Must be multiple of 4KiB page size, default and minimal value is 1M.
6447
6448### Example
6449
6450Example request:
6451
6452~~~
6453{
6454  "jsonrpc": "2.0",
6455  "id": 1,
6456  "method": "blobfs_create",
6457  "params": {
6458    "bdev_name": "Malloc0",
6459    "cluster_sz": 1M
6460  }
6461}
6462~~~
6463
6464Example response:
6465
6466~~~
6467{
6468  "jsonrpc": "2.0",
6469  "id": 1,
6470  "result": "true"
6471}
6472~~~
6473
6474## blobfs_mount {#rpc_blobfs_mount}
6475
6476Mount a blobfs on bdev to one host path through FUSE
6477
6478### Parameters
6479
6480Name                    | Optional | Type        | Description
6481----------------------- | -------- | ----------- | -----------
6482bdev_name               | Required | string      | Block device name where the blobfs is
6483mountpoint              | Required | string      | Mountpoint path in host to mount blobfs
6484
6485### Example
6486
6487Example request:
6488
6489~~~
6490{
6491  "jsonrpc": "2.0",
6492  "id": 1,
6493  "method": ""blobfs_mount"",
6494  "params": {
6495    "bdev_name": "Malloc0",
6496    "mountpoint": "/mnt/"
6497  }
6498}
6499~~~
6500
6501Example response:
6502
6503~~~
6504{
6505  "jsonrpc": "2.0",
6506  "id": 1,
6507  "result": "true"
6508}
6509~~
6510
6511## blobfs_set_cache_size {#rpc_blobfs_set_cache_size}
6512
6513Set cache pool size for blobfs filesystems.  This RPC is only permitted when the cache pool is not already initialized.
6514
6515The cache pool is initialized when the first blobfs filesystem is initialized or loaded.  It is freed when the all initialized or loaded filesystems are unloaded.
6516
6517### Parameters
6518
6519Name                    | Optional | Type        | Description
6520----------------------- | -------- | ----------- | -----------
6521size_in_mb              | Required | number      | Cache size in megabytes
6522
6523### Response
6524
6525True if cache size is set successfully; False if failed to set.
6526
6527### Example
6528
6529Example request:
6530
6531~~~
6532{
6533  "jsonrpc": "2.0",
6534  "id": 1,
6535  "method": "blobfs_set_cache_size",
6536  "params": {
6537    "size_in_mb": 512,
6538  }
6539}
6540~~~
6541
6542Example response:
6543
6544~~~
6545{
6546  "jsonrpc": "2.0",
6547  "id": 1,
6548  "result": true
6549}
6550~~~
6551
6552# Socket layer {#jsonrpc_components_sock}
6553
6554## sock_impl_get_options {#rpc_sock_impl_get_options}
6555
6556Get parameters for the socket layer implementation.
6557
6558### Parameters
6559
6560Name                    | Optional | Type        | Description
6561----------------------- | -------- | ----------- | -----------
6562impl_name               | Required | string      | Name of socket implementation, e.g. posix
6563
6564### Response
6565
6566Response is an object with current socket layer options for requested implementation.
6567
6568### Example
6569
6570Example request:
6571
6572~~~
6573{
6574  "jsonrpc": "2.0",
6575  "method": "sock_impl_get_options",
6576  "id": 1,
6577  "params": {
6578    "impl_name": "posix"
6579  }
6580}
6581~~~
6582
6583Example response:
6584
6585~~~
6586{
6587  "jsonrpc": "2.0",
6588  "id": 1,
6589  "result": {
6590    "recv_buf_size": 2097152,
6591    "send_buf_size": 2097152,
6592    "enable_recv_pipe": true
6593    "enable_zerocopy_send": true
6594  }
6595}
6596~~~
6597
6598## sock_impl_set_options {#rpc_sock_impl_set_options}
6599
6600Set parameters for the socket layer implementation.
6601
6602### Parameters
6603
6604Name                    | Optional | Type        | Description
6605----------------------- | -------- | ----------- | -----------
6606impl_name               | Required | string      | Name of socket implementation, e.g. posix
6607recv_buf_size           | Optional | number      | Size of socket receive buffer in bytes
6608send_buf_size           | Optional | number      | Size of socket send buffer in bytes
6609enable_recv_pipe        | Optional | boolean     | Enable or disable receive pipe
6610enable_zerocopy_send    | Optional | boolean     | Enable or disable zero copy on send
6611
6612### Response
6613
6614True if socket layer options were set successfully.
6615
6616### Example
6617
6618Example request:
6619
6620~~~
6621{
6622  "jsonrpc": "2.0",
6623  "method": "sock_impl_set_options",
6624  "id": 1,
6625  "params": {
6626    "impl_name": "posix",
6627    "recv_buf_size": 2097152,
6628    "send_buf_size": 2097152,
6629    "enable_recv_pipe": false
6630    "enable_zerocopy_send": true
6631  }
6632}
6633~~~
6634
6635Example response:
6636
6637~~~
6638{
6639  "jsonrpc": "2.0",
6640  "id": 1,
6641  "result": true
6642}
6643~~~
6644
6645# Miscellaneous RPC commands
6646
6647## bdev_nvme_send_cmd {#rpc_bdev_nvme_send_cmd}
6648
6649Send NVMe command directly to NVMe controller or namespace. Parameters and responses encoded by base64 urlsafe need further processing.
6650
6651Notice: bdev_nvme_send_cmd requires user to guarentee the correctness of NVMe command itself, and also optional parameters. Illegal command contents or mismatching buffer size may result in unpredictable behavior.
6652
6653### Parameters
6654
6655Name                    | Optional | Type        | Description
6656----------------------- | -------- | ----------- | -----------
6657name                    | Required | string      | Name of the operating NVMe controller
6658cmd_type                | Required | string      | Type of nvme cmd. Valid values are: admin, io
6659data_direction          | Required | string      | Direction of data transfer. Valid values are: c2h, h2c
6660cmdbuf                  | Required | string      | NVMe command encoded by base64 urlsafe
6661data                    | Optional | string      | Data transferring to controller from host, encoded by base64 urlsafe
6662metadata                | Optional | string      | Metadata transferring to controller from host, encoded by base64 urlsafe
6663data_len                | Optional | number      | Data length required to transfer from controller to host
6664metadata_len            | Optional | number      | Metadata length required to transfer from controller to host
6665timeout_ms              | Optional | number      | Command execution timeout value, in milliseconds
6666
6667### Response
6668
6669Name                    | Type        | Description
6670----------------------- | ----------- | -----------
6671cpl                     | string      | NVMe completion queue entry, encoded by base64 urlsafe
6672data                    | string      | Data transferred from controller to host, encoded by base64 urlsafe
6673metadata                | string      | Metadata transferred from controller to host, encoded by base64 urlsafe
6674
6675### Example
6676
6677Example request:
6678
6679~~~
6680{
6681  "jsonrpc": "2.0",
6682  "method": "bdev_nvme_send_cmd",
6683  "id": 1,
6684  "params": {
6685    "name": "Nvme0",
6686    "cmd_type": "admin"
6687    "data_direction": "c2h",
6688    "cmdbuf": "BgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAsGUs9P5_AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
6689    "data_len": 60,
6690  }
6691}
6692~~~
6693
6694Example response:
6695
6696~~~
6697{
6698  "jsonrpc": "2.0",
6699  "id": 1,
6700  "result":  {
6701    "cpl": "AAAAAAAAAAARAAAAWrmwABAA==",
6702    "data": "sIjg6AAAAACwiODoAAAAALCI4OgAAAAAAAYAAREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
6703  }
6704
6705}
6706~~~
6707
6708## spdk_get_version {#rpc_spdk_get_version}
6709
6710Get the version info of the running SPDK application.
6711
6712### Parameters
6713
6714This method has no parameters.
6715
6716### Response
6717
6718The response is the version number including major version number, minor version number, patch level number and suffix string.
6719
6720### Example
6721
6722Example request:
6723~~
6724{
6725  "jsonrpc": "2.0",
6726  "id": 1,
6727  "method": "spdk_get_version"
6728}
6729~~
6730
6731Example response:
6732~~
6733{
6734  "jsonrpc": "2.0",
6735  "id": 1,
6736  "result":  {
6737    "version": "19.04-pre",
6738    "fields" : {
6739      "major": 19,
6740      "minor": 4,
6741      "patch": 0,
6742      "suffix": "-pre"
6743    }
6744  }
6745}
6746~~
6747