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