xref: /spdk/doc/jsonrpc.md (revision b94d358a498a9c4f2b3416aeb6a73200d9fdb514)
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
2174keep_alive_timeout_ms      | Optional | number      | Keep alive timeout period in milliseconds, default is 10s
2175retry_count                | Optional | number      | The number of attempts per I/O before an I/O fails
2176arbitration_burst          | Optional | number      | The value is expressed as a power of two, a value of 111b indicates no limit
2177low_priority_weight        | Optional | number      | The maximum number of commands that the controller may launch at one time from a low priority queue
2178medium_priority_weight     | Optional | number      | The maximum number of commands that the controller may launch at one time from a medium priority queue
2179high_priority_weight       | Optional | number      | The maximum number of commands that the controller may launch at one time from a high priority queue
2180nvme_adminq_poll_period_us | Optional | number      | How often the admin queue is polled for asynchronous events in microseconds
2181nvme_ioq_poll_period_us    | Optional | number      | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible).
2182io_queue_requests          | Optional | number      | The number of requests allocated for each NVMe I/O queue. Default: 512.
2183delay_cmd_submit           | Optional | boolean     | Enable delaying NVMe command submission to allow batching of multiple commands. Default: `true`.
2184
2185### Example
2186
2187Example request:
2188
2189~~~
2190request:
2191{
2192  "params": {
2193    "retry_count": 5,
2194    "arbitration_burst": 3,
2195    "low_priority_weight": 8,
2196    "medium_priority_weight":8,
2197    "high_priority_weight": 8,
2198    "nvme_adminq_poll_period_us": 2000,
2199    "timeout_us": 10000000,
2200    "keep_alive_timeout_ms": 600000,
2201    "action_on_timeout": "reset",
2202    "io_queue_requests" : 2048,
2203    "delay_cmd_submit": true
2204  },
2205  "jsonrpc": "2.0",
2206  "method": "bdev_nvme_set_options",
2207  "id": 1
2208}
2209~~~
2210
2211Example response:
2212
2213~~~
2214{
2215  "jsonrpc": "2.0",
2216  "id": 1,
2217  "result": true
2218}
2219~~~
2220
2221## bdev_nvme_set_hotplug {#rpc_bdev_nvme_set_hotplug}
2222
2223Change settings of the NVMe hotplug feature. If enabled, PCIe NVMe bdevs will be automatically discovered on insertion
2224and deleted on removal.
2225
2226### Parameters
2227
2228Name                    | Optional | Type        | Description
2229----------------------- | -------- | ----------- | -----------
2230enabled                 | Required | string      | True to enable, false to disable
2231period_us               | Optional | number      | How often to poll for hot-insert and hot-remove events. Values: 0 - reset/use default or 1 to 10000000.
2232
2233### Example
2234
2235Example request:
2236
2237~~~
2238request:
2239{
2240  "params": {
2241    "enabled": true,
2242    "period_us": 2000
2243  },
2244  "jsonrpc": "2.0",
2245  "method": "bdev_nvme_set_hotplug",
2246  "id": 1
2247}
2248~~~
2249
2250Example response:
2251
2252~~~
2253{
2254  "jsonrpc": "2.0",
2255  "id": 1,
2256  "result": true
2257}
2258~~~
2259
2260## bdev_nvme_attach_controller {#rpc_bdev_nvme_attach_controller}
2261
2262Construct @ref bdev_config_nvme. This RPC can also be used to add additional paths to an existing controller to enable
2263multipathing. This is done by specifying the `name` parameter as an existing controller. When adding an additional
2264path, the hostnqn, hostsvcid, hostaddr, prchk_reftag, and prchk_guard_arguments must not be specified and are assumed
2265to have the same value as the existing path.
2266
2267### Result
2268
2269Array of names of newly created bdevs.
2270
2271### Parameters
2272
2273Name                    | Optional | Type        | Description
2274----------------------- | -------- | ----------- | -----------
2275name                    | Required | string      | Name of the NVMe controller, prefix for each bdev name
2276trtype                  | Required | string      | NVMe-oF target trtype: rdma or pcie
2277traddr                  | Required | string      | NVMe-oF target address: ip or BDF
2278adrfam                  | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
2279trsvcid                 | Optional | string      | NVMe-oF target trsvcid: port number
2280subnqn                  | Optional | string      | NVMe-oF target subnqn
2281hostnqn                 | Optional | string      | NVMe-oF target hostnqn
2282hostaddr                | Optional | string      | NVMe-oF host address: ip address
2283hostsvcid               | Optional | string      | NVMe-oF host trsvcid: port number
2284prchk_reftag            | Optional | bool        | Enable checking of PI reference tag for I/O processing
2285prchk_guard             | Optional | bool        | Enable checking of PI guard for I/O processing
2286
2287### Example
2288
2289Example request:
2290
2291~~~
2292{
2293  "params": {
2294    "trtype": "pcie",
2295    "name": "Nvme0",
2296    "traddr": "0000:0a:00.0"
2297  },
2298  "jsonrpc": "2.0",
2299  "method": "bdev_nvme_attach_controller",
2300  "id": 1
2301}
2302~~~
2303
2304Example response:
2305
2306~~~
2307{
2308  "jsonrpc": "2.0",
2309  "id": 1,
2310  "result": [
2311    "Nvme0n1"
2312  ]
2313}
2314~~~
2315
2316## bdev_nvme_get_controllers {#rpc_bdev_nvme_get_controllers}
2317
2318Get information about NVMe controllers.
2319
2320### Parameters
2321
2322The user may specify no parameters in order to list all NVMe controllers, or one NVMe controller may be
2323specified by name.
2324
2325Name                    | Optional | Type        | Description
2326----------------------- | -------- | ----------- | -----------
2327name                    | Optional | string      | NVMe controller name
2328
2329### Response
2330
2331The response is an array of objects containing information about the requested NVMe controllers.
2332
2333### Example
2334
2335Example request:
2336
2337~~~
2338{
2339  "jsonrpc": "2.0",
2340  "id": 1,
2341  "method": "bdev_nvme_get_controllers",
2342  "params": {
2343    "name": "Nvme0"
2344  }
2345}
2346~~~
2347
2348Example response:
2349
2350~~~
2351{
2352  "jsonrpc": "2.0",
2353  "id": 1,
2354  "result": [
2355    {
2356      "name": "Nvme0",
2357      "trid": {
2358        "trtype": "PCIe",
2359        "traddr": "0000:05:00.0"
2360      }
2361    }
2362  ]
2363}
2364~~~
2365
2366## bdev_nvme_detach_controller {#rpc_bdev_nvme_detach_controller}
2367
2368Detach NVMe controller and delete any associated bdevs. Optionally,
2369If all of the transport ID options are specified, only remove that
2370transport path from the specified controller. If that is the only
2371available path for the controller, this will also result in the
2372controller being detached and the associated bdevs being deleted.
2373
2374returns true if the controller and bdevs were successfully destroyed
2375or the address was properly removed, false otherwise.
2376
2377### Parameters
2378
2379Name                    | Optional | Type        | Description
2380----------------------- | -------- | ----------- | -----------
2381name                    | Required | string      | Controller name
2382trtype                  | Optional | string      | NVMe-oF target trtype: rdma or tcp
2383traddr                  | Optional | string      | NVMe-oF target address: ip or BDF
2384adrfam                  | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
2385trsvcid                 | Optional | string      | NVMe-oF target trsvcid: port number
2386subnqn                  | Optional | string      | NVMe-oF target subnqn
2387
2388### Example
2389
2390Example requests:
2391
2392~~~
2393{
2394  "params": {
2395    "name": "Nvme0"
2396  },
2397  "jsonrpc": "2.0",
2398  "method": "bdev_nvme_detach_controller",
2399  "id": 1
2400}
2401~~~
2402
2403Example response:
2404
2405~~~
2406{
2407  "jsonrpc": "2.0",
2408  "id": 1,
2409  "result": true
2410}
2411~~~
2412
2413## bdev_nvme_cuse_register {#rpc_bdev_nvme_cuse_register}
2414
2415Register CUSE device on NVMe controller.
2416This feature is considered as experimental.
2417
2418### Parameters
2419
2420Name                    | Optional | Type        | Description
2421----------------------- | -------- | ----------- | -----------
2422name                    | Required | string      | Name of the NVMe controller
2423dev_path                | Required | string      | Path to the CUSE controller device, e.g. spdk/nvme0
2424
2425### Example
2426
2427Example request:
2428
2429~~~
2430{
2431  "params": {
2432    "dev_path": "spdk/nvme0",
2433    "name": "Nvme0"
2434  },
2435  "jsonrpc": "2.0",
2436  "method": "bdev_nvme_cuse_register",
2437  "id": 1
2438}
2439~~~
2440
2441Example response:
2442
2443~~~
2444{
2445  "jsonrpc": "2.0",
2446  "id": 1,
2447  "result": true
2448}
2449~~~
2450
2451## bdev_nvme_cuse_unregister {#rpc_bdev_nvme_cuse_unregister}
2452
2453Unregister CUSE device on NVMe controller.
2454This feature is considered as experimental.
2455
2456### Parameters
2457
2458Name                    | Optional | Type        | Description
2459----------------------- | -------- | ----------- | -----------
2460name                    | Required | string      | Name of the NVMe controller
2461
2462### Example
2463
2464Example request:
2465
2466~~~
2467{
2468  "params": {
2469    "name": "Nvme0"
2470  },
2471  "jsonrpc": "2.0",
2472  "method": "bdev_nvme_cuse_unregister",
2473  "id": 1
2474}
2475~~~
2476
2477Example response:
2478
2479~~~
2480{
2481  "jsonrpc": "2.0",
2482  "id": 1,
2483  "result": true
2484}
2485~~~
2486
2487## bdev_rbd_create {#rpc_bdev_rbd_create}
2488
2489Create @ref bdev_config_rbd bdev
2490
2491This method is available only if SPDK was build with Ceph RBD support.
2492
2493### Parameters
2494
2495Name                    | Optional | Type        | Description
2496----------------------- | -------- | ----------- | -----------
2497name                    | Optional | string      | Bdev name
2498user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
2499pool_name               | Required | string      | Pool name
2500rbd_name                | Required | string      | Image name
2501block_size              | Required | number      | Block size
2502config                  | Optional | string map  | Explicit librados configuration
2503
2504If no config is specified, Ceph configuration files must exist with
2505all relevant settings for accessing the pool. If a config map is
2506passed, the configuration files are ignored and instead all key/value
2507pairs are passed to rados_conf_set to configure cluster access. In
2508practice, "mon_host" (= list of monitor address+port) and "key" (= the
2509secret key stored in Ceph keyrings) are enough.
2510
2511When accessing the image as some user other than "admin" (the
2512default), the "user_id" has to be set.
2513
2514### Result
2515
2516Name of newly created bdev.
2517
2518### Example
2519
2520Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`:
2521
2522~~~
2523{
2524  "params": {
2525    "pool_name": "rbd",
2526    "rbd_name": "foo",
2527    "config": {
2528      "mon_host": "192.168.7.1:6789,192.168.7.2:6789",
2529      "key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ==",
2530    }
2531    "block_size": 4096
2532  },
2533  "jsonrpc": "2.0",
2534  "method": "bdev_rbd_create",
2535  "id": 1
2536}
2537~~~
2538
2539Example response:
2540
2541~~~
2542response:
2543{
2544  "jsonrpc": "2.0",
2545  "id": 1,
2546  "result": "Ceph0"
2547}
2548~~~
2549
2550## bdev_rbd_delete {#rpc_bdev_rbd_delete}
2551
2552Delete @ref bdev_config_rbd bdev
2553
2554This method is available only if SPDK was build with Ceph RBD support.
2555
2556### Result
2557
2558`true` if bdev with provided name was deleted or `false` otherwise.
2559
2560### Parameters
2561
2562Name                    | Optional | Type        | Description
2563----------------------- | -------- | ----------- | -----------
2564name                    | Required | string      | Bdev name
2565
2566### Example
2567
2568Example request:
2569
2570~~~
2571{
2572  "params": {
2573    "name": "Rbd0"
2574  },
2575  "jsonrpc": "2.0",
2576  "method": "bdev_rbd_delete",
2577  "id": 1
2578}
2579~~~
2580
2581Example response:
2582
2583~~~
2584{
2585  "jsonrpc": "2.0",
2586  "id": 1,
2587  "result": true
2588}
2589~~~
2590
2591## bdev_rbd_resize {#rpc_bdev_rbd_resize}
2592
2593Resize @ref bdev_config_rbd bdev
2594
2595This method is available only if SPDK was build with Ceph RBD support.
2596
2597### Result
2598
2599`true` if bdev with provided name was resized or `false` otherwise.
2600
2601### Parameters
2602
2603Name                    | Optional | Type        | Description
2604----------------------- | -------- | ----------- | -----------
2605name                    | Required | string      | Bdev name
2606new_size                | Required | int         | New bdev size for resize operation in MiB
2607
2608### Example
2609
2610Example request:
2611
2612~~~
2613{
2614  "params": {
2615    "name": "Rbd0"
2616    "new_size": "4096"
2617  },
2618  "jsonrpc": "2.0",
2619  "method": "bdev_rbd_resize",
2620  "id": 1
2621}
2622~~~
2623
2624Example response:
2625
2626~~~
2627{
2628  "jsonrpc": "2.0",
2629  "id": 1,
2630  "result": true
2631}
2632~~~
2633
2634## bdev_delay_create {#rpc_bdev_delay_create}
2635
2636Create delay bdev. This bdev type redirects all IO to it's base bdev and inserts a delay on the completion
2637path to create an artificial drive latency. All latency values supplied to this bdev should be in microseconds.
2638
2639### Parameters
2640
2641Name                    | Optional | Type        | Description
2642----------------------- | -------- | ----------- | -----------
2643name                    | Required | string      | Bdev name
2644base_bdev_name          | Required | string      | Base bdev name
2645avg_read_latency        | Required | number      | average read latency (us)
2646p99_read_latency        | Required | number      | p99 read latency (us)
2647avg_write_latency       | Required | number      | average write latency (us)
2648p99_write_latency       | Required | number      | p99 write latency (us)
2649
2650### Result
2651
2652Name of newly created bdev.
2653
2654### Example
2655
2656Example request:
2657
2658~~~
2659{
2660  "params": {
2661    "base_bdev_name": "Null0",
2662    "name": "Delay0",
2663    "avg_read_latency": "15",
2664    "p99_read_latency": "50",
2665    "avg_write_latency": "40",
2666    "p99_write_latency": "110",
2667  },
2668  "jsonrpc": "2.0",
2669  "method": "bdev_delay_create",
2670  "id": 1
2671}
2672~~~
2673
2674Example response:
2675
2676~~~
2677{
2678  "jsonrpc": "2.0",
2679  "id": 1,
2680  "result": "Delay0"
2681}
2682~~~
2683
2684## bdev_delay_delete {#rpc_bdev_delay_delete}
2685
2686Delete delay bdev.
2687
2688### Parameters
2689
2690Name                    | Optional | Type        | Description
2691----------------------- | -------- | ----------- | -----------
2692name                    | Required | string      | Bdev name
2693
2694### Example
2695
2696Example request:
2697
2698~~~
2699{
2700  "params": {
2701    "name": "Delay0"
2702  },
2703  "jsonrpc": "2.0",
2704  "method": "bdev_delay_delete",
2705  "id": 1
2706}
2707
2708~~~
2709
2710Example response:
2711
2712~~~
2713{
2714  "jsonrpc": "2.0",
2715  "id": 1,
2716  "result": true
2717}
2718~~~
2719
2720## bdev_delay_update_latency {#rpc_bdev_delay_update_latency}
2721
2722Update a target latency value associated with a given delay bdev. Any currently
2723outstanding I/O will be completed with the old latency.
2724
2725### Parameters
2726
2727Name                    | Optional | Type        | Description
2728----------------------- | -------- | ----------- | -----------
2729delay_bdev_name         | Required | string      | Name of the delay bdev
2730latency_type            | Required | string      | One of: avg_read, avg_write, p99_read, p99_write
2731latency_us              | Required | number      | The new latency value in microseconds
2732
2733### Result
2734
2735Name of newly created bdev.
2736
2737### Example
2738
2739Example request:
2740
2741~~~
2742{
2743  "params": {
2744    "delay_bdev_name": "Delay0",
2745    "latency_type": "avg_read",
2746    "latency_us": "100",
2747  },
2748  "jsonrpc": "2.0",
2749  "method": "bdev_delay_update_latency",
2750  "id": 1
2751}
2752~~~
2753
2754Example response:
2755
2756~~~
2757{
2758  "result": "true"
2759}
2760~~~
2761
2762## bdev_error_create {#rpc_bdev_error_create}
2763
2764Construct error bdev.
2765
2766### Parameters
2767
2768Name                    | Optional | Type        | Description
2769----------------------- | -------- | ----------- | -----------
2770base_name               | Required | string      | Base bdev name
2771
2772### Example
2773
2774Example request:
2775
2776~~~
2777{
2778  "params": {
2779    "base_name": "Malloc0"
2780  },
2781  "jsonrpc": "2.0",
2782  "method": "bdev_error_create",
2783  "id": 1
2784}
2785~~~
2786
2787Example response:
2788
2789~~~
2790{
2791  "jsonrpc": "2.0",
2792  "id": 1,
2793  "result": true
2794}
2795~~~
2796
2797## bdev_error_delete {#rpc_bdev_error_delete}
2798
2799Delete error bdev
2800
2801### Result
2802
2803`true` if bdev with provided name was deleted or `false` otherwise.
2804
2805### Parameters
2806
2807Name                    | Optional | Type        | Description
2808----------------------- | -------- | ----------- | -----------
2809name                    | Required | string      | Error bdev name
2810
2811### Example
2812
2813Example request:
2814
2815~~~
2816{
2817  "params": {
2818    "name": "EE_Malloc0"
2819  },
2820  "jsonrpc": "2.0",
2821  "method": "bdev_error_delete",
2822  "id": 1
2823}
2824~~~
2825
2826Example response:
2827
2828~~~
2829{
2830  "jsonrpc": "2.0",
2831  "id": 1,
2832  "result": true
2833}
2834~~~
2835
2836## bdev_iscsi_create {#rpc_bdev_iscsi_create}
2837
2838Connect to iSCSI target and create bdev backed by this connection.
2839
2840This method is available only if SPDK was build with iSCSI initiator support.
2841
2842### Parameters
2843
2844Name                    | Optional | Type        | Description
2845----------------------- | -------- | ----------- | -----------
2846name                    | Required | string      | Bdev name
2847initiator_iqn           | Required | string      | IQN name used during connection
2848url                     | Required | string      | iSCSI resource URI
2849
2850### Result
2851
2852Name of newly created bdev.
2853
2854### Example
2855
2856Example request:
2857
2858~~~
2859{
2860  "params": {
2861    "url": "iscsi://127.0.0.1/iqn.2016-06.io.spdk:disk1/0",
2862    "initiator_iqn": "iqn.2016-06.io.spdk:init",
2863    "name": "iSCSI0"
2864  },
2865  "jsonrpc": "2.0",
2866  "method": "bdev_iscsi_create",
2867  "id": 1
2868}
2869~~~
2870
2871Example response:
2872
2873~~~
2874{
2875  "jsonrpc": "2.0",
2876  "id": 1,
2877  "result": "iSCSI0"
2878}
2879~~~
2880
2881## bdev_iscsi_delete {#rpc_bdev_iscsi_delete}
2882
2883Delete iSCSI bdev and terminate connection to target.
2884
2885This method is available only if SPDK was built with iSCSI initiator support.
2886
2887### Parameters
2888
2889Name                    | Optional | Type        | Description
2890----------------------- | -------- | ----------- | -----------
2891name                    | Required | string      | Bdev name
2892
2893### Example
2894
2895Example request:
2896
2897~~~
2898{
2899  "params": {
2900    "name": "iSCSI0"
2901  },
2902  "jsonrpc": "2.0",
2903  "method": "bdev_iscsi_delete",
2904  "id": 1
2905}
2906~~~
2907
2908Example response:
2909
2910~~~
2911{
2912  "jsonrpc": "2.0",
2913  "id": 1,
2914  "result": true
2915}
2916~~~
2917
2918## bdev_ftl_create {#rpc_bdev_ftl_create}
2919
2920Create FTL bdev.
2921
2922This RPC is subject to change.
2923
2924### Parameters
2925
2926Name                    | Optional | Type        | Description
2927----------------------- | -------- | ----------- | -----------
2928name                    | Required | string      | Bdev name
2929trtype                  | Required | string      | Transport type
2930traddr                  | Required | string      | NVMe target address
2931punits                  | Required | string      | Parallel unit range in the form of start-end e.g 4-8
2932uuid                    | Optional | string      | UUID of restored bdev (not applicable when creating new instance)
2933cache                   | Optional | string      | Name of the bdev to be used as a write buffer cache
2934
2935### Result
2936
2937Name of newly created bdev.
2938
2939### Example
2940
2941Example request:
2942
2943~~~
2944{
2945  "params": {
2946    "name": "nvme0"
2947    "trtype" "pcie"
2948    "traddr": "0000:00:04.0"
2949    "punits": "0-3"
2950    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
2951  },
2952  "jsonrpc": "2.0",
2953  "method": "bdev_ftl_create",
2954  "id": 1
2955}
2956~~~
2957
2958Example response:
2959
2960~~~
2961{
2962  "jsonrpc": "2.0",
2963  "id": 1,
2964  "result": {
2965      "name" : "nvme0"
2966      "uuid" : "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
2967  }
2968}
2969~~~
2970
2971## bdev_ftl_delete {#rpc_bdev_ftl_delete}
2972
2973Delete FTL bdev.
2974
2975This RPC is subject to change.
2976
2977### Parameters
2978
2979Name                    | Optional | Type        | Description
2980----------------------- | -------- | ----------- | -----------
2981name                    | Required | string      | Bdev name
2982
2983### Example
2984
2985Example request:
2986
2987~~~
2988{
2989  "params": {
2990    "name": "nvme0"
2991  },
2992  "jsonrpc": "2.0",
2993  "method": "bdev_ftl_delete",
2994  "id": 1
2995}
2996~~~
2997
2998Example response:
2999
3000~~~
3001{
3002  "jsonrpc": "2.0",
3003  "id": 1,
3004  "result": true
3005}
3006~~~
3007
3008## bdev_pmem_create_pool {#rpc_bdev_pmem_create_pool}
3009
3010Create a @ref bdev_config_pmem blk pool file. It is equivalent of following `pmempool create` command:
3011
3012~~~
3013pmempool create -s $((num_blocks * block_size)) blk $block_size $pmem_file
3014~~~
3015
3016This method is available only if SPDK was built with PMDK support.
3017
3018### Parameters
3019
3020Name                    | Optional | Type        | Description
3021----------------------- | -------- | ----------- | -----------
3022pmem_file               | Required | string      | Path to new pmem file
3023num_blocks              | Required | number      | Number of blocks
3024block_size              | Required | number      | Size of each block in bytes
3025
3026### Example
3027
3028Example request:
3029
3030~~~
3031{
3032  "params": {
3033    "block_size": 512,
3034    "num_blocks": 131072,
3035    "pmem_file": "/tmp/pmem_file"
3036  },
3037  "jsonrpc": "2.0",
3038  "method": "bdev_pmem_create_pool",
3039  "id": 1
3040}
3041~~~
3042
3043Example response:
3044
3045~~~
3046{
3047  "jsonrpc": "2.0",
3048  "id": 1,
3049  "result": true
3050}
3051~~~
3052
3053## bdev_pmem_get_pool_info {#rpc_bdev_pmem_get_pool_info}
3054
3055Retrieve basic information about PMDK memory pool.
3056
3057This method is available only if SPDK was built with PMDK support.
3058
3059### Parameters
3060
3061Name                    | Optional | Type        | Description
3062----------------------- | -------- | ----------- | -----------
3063pmem_file               | Required | string      | Path to existing pmem file
3064
3065### Result
3066
3067Array of objects describing memory pool:
3068
3069Name                    | Type        | Description
3070----------------------- | ----------- | -----------
3071num_blocks              | number      | Number of blocks
3072block_size              | number      | Size of each block in bytes
3073
3074### Example
3075
3076Example request:
3077
3078~~~
3079request:
3080{
3081  "params": {
3082    "pmem_file": "/tmp/pmem_file"
3083  },
3084  "jsonrpc": "2.0",
3085  "method": "bdev_pmem_get_pool_info",
3086  "id": 1
3087}
3088~~~
3089
3090Example response:
3091
3092~~~
3093{
3094  "jsonrpc": "2.0",
3095  "id": 1,
3096  "result": [
3097    {
3098      "block_size": 512,
3099      "num_blocks": 129728
3100    }
3101  ]
3102}
3103~~~
3104
3105## bdev_pmem_delete_pool {#rpc_bdev_pmem_delete_pool}
3106
3107Delete pmem pool by removing file `pmem_file`. This method will fail if `pmem_file` is not a
3108valid pmem pool file.
3109
3110This method is available only if SPDK was built with PMDK support.
3111
3112### Parameters
3113
3114Name                    | Optional | Type        | Description
3115----------------------- | -------- | ----------- | -----------
3116pmem_file               | Required | string      | Path to new pmem file
3117
3118### Example
3119
3120Example request:
3121
3122~~~
3123{
3124  "params": {
3125    "pmem_file": "/tmp/pmem_file"
3126  },
3127  "jsonrpc": "2.0",
3128  "method": "bdev_pmem_delete_pool",
3129  "id": 1
3130}
3131~~~
3132
3133Example response:
3134
3135~~~
3136{
3137  "jsonrpc": "2.0",
3138  "id": 1,
3139  "result": true
3140}
3141~~~
3142
3143## bdev_pmem_create {#rpc_bdev_pmem_create}
3144
3145Construct @ref bdev_config_pmem bdev.
3146
3147This method is available only if SPDK was built with PMDK support.
3148
3149### Parameters
3150
3151Name                    | Optional | Type        | Description
3152----------------------- | -------- | ----------- | -----------
3153name                    | Required | string      | Bdev name
3154pmem_file               | Required | string      | Path to existing pmem blk pool file
3155
3156### Result
3157
3158Name of newly created bdev.
3159
3160### Example
3161
3162Example request:
3163
3164~~~
3165{
3166  "params": {
3167    "pmem_file": "/tmp/pmem_file",
3168    "name": "Pmem0"
3169  },
3170  "jsonrpc": "2.0",
3171  "method": "bdev_pmem_create",
3172  "id": 1
3173}
3174~~~
3175
3176Example response:
3177
3178~~~
3179{
3180  "jsonrpc": "2.0",
3181  "id": 1,
3182  "result": "Pmem0"
3183}
3184~~~
3185
3186## bdev_pmem_delete {#rpc_bdev_pmem_delete}
3187
3188Delete @ref bdev_config_pmem bdev. This call will not remove backing pool files.
3189
3190This method is available only if SPDK was built with PMDK support.
3191
3192### Result
3193
3194`true` if bdev with provided name was deleted or `false` otherwise.
3195
3196### Parameters
3197
3198Name                    | Optional | Type        | Description
3199----------------------- | -------- | ----------- | -----------
3200name                    | Required | string      | Bdev name
3201
3202### Example
3203
3204Example request:
3205
3206~~~
3207{
3208  "params": {
3209    "name": "Pmem0"
3210  },
3211  "jsonrpc": "2.0",
3212  "method": "bdev_pmem_delete",
3213  "id": 1
3214}
3215~~~
3216
3217Example response:
3218
3219~~~
3220{
3221  "jsonrpc": "2.0",
3222  "id": 1,
3223  "result": true
3224}
3225~~~
3226
3227## bdev_passthru_create {#rpc_bdev_passthru_create}
3228
3229Create passthru bdev. This bdev type redirects all IO to it's base bdev. It has no other purpose than being an example
3230and a starting point in development of new bdev type.
3231
3232### Parameters
3233
3234Name                    | Optional | Type        | Description
3235----------------------- | -------- | ----------- | -----------
3236name                    | Required | string      | Bdev name
3237base_bdev_name          | Required | string      | Base bdev name
3238
3239### Result
3240
3241Name of newly created bdev.
3242
3243### Example
3244
3245Example request:
3246
3247~~~
3248{
3249  "params": {
3250    "base_bdev_name": "Malloc0",
3251    "name": "Passsthru0"
3252  },
3253  "jsonrpc": "2.0",
3254  "method": "bdev_passthru_create",
3255  "id": 1
3256}
3257~~~
3258
3259Example response:
3260
3261~~~
3262{
3263  "jsonrpc": "2.0",
3264  "id": 1,
3265  "result": "Passsthru0"
3266}
3267~~~
3268
3269## bdev_passthru_delete {#rpc_bdev_passthru_delete}
3270
3271Delete passthru bdev.
3272
3273### Parameters
3274
3275Name                    | Optional | Type        | Description
3276----------------------- | -------- | ----------- | -----------
3277name                    | Required | string      | Bdev name
3278
3279### Example
3280
3281Example request:
3282
3283~~~
3284{
3285  "params": {
3286    "name": "Passsthru0"
3287  },
3288  "jsonrpc": "2.0",
3289  "method": "bdev_passthru_delete",
3290  "id": 1
3291}
3292
3293~~~
3294
3295Example response:
3296
3297~~~
3298{
3299  "jsonrpc": "2.0",
3300  "id": 1,
3301  "result": true
3302}
3303~~~
3304
3305## bdev_virtio_attach_controller {#rpc_bdev_virtio_attach_controller}
3306
3307Create new initiator @ref bdev_config_virtio_scsi or @ref bdev_config_virtio_blk and expose all found bdevs.
3308
3309### Parameters
3310
3311Name                    | Optional | Type        | Description
3312----------------------- | -------- | ----------- | -----------
3313name                    | Required | string      | Virtio SCSI base bdev name or Virtio Blk bdev name
3314trtype                  | Required | string      | Virtio target trtype: pci or user
3315traddr                  | Required | string      | target address: BDF or UNIX socket file path
3316dev_type                | Required | string      | Virtio device type: blk or scsi
3317vq_count                | Optional | number      | Number of queues this controller will utilize (default: 1)
3318vq_size                 | Optional | number      | Size of each queue. Must be power of 2. (default: 512)
3319
3320In case of Virtio SCSI the `name` parameter will be base name for new created bdevs. For Virtio Blk `name` will be the
3321name of created bdev.
3322
3323`vq_count` and `vq_size` parameters are valid only if `trtype` is `user`.
3324
3325### Result
3326
3327Array of names of newly created bdevs.
3328
3329### Example
3330
3331Example request:
3332
3333~~~
3334{
3335  "params": {
3336    "name": "VirtioScsi0",
3337    "trtype": "user",
3338    "vq_size": 128,
3339    "dev_type": "scsi",
3340    "traddr": "/tmp/VhostScsi0",
3341    "vq_count": 4
3342  },
3343  "jsonrpc": "2.0",
3344  "method": "bdev_virtio_attach_controller",
3345  "id": 1
3346}
3347~~~
3348
3349Example response:
3350
3351~~~
3352{
3353  "jsonrpc": "2.0",
3354  "id": 1,
3355  "result": ["VirtioScsi0t2", "VirtioScsi0t4"]
3356}
3357~~~
3358
3359## bdev_virtio_scsi_get_devices {#rpc_bdev_virtio_scsi_get_devices}
3360
3361Show information about all available Virtio SCSI devices.
3362
3363### Parameters
3364
3365This method has no parameters.
3366
3367### Result
3368
3369Array of Virtio SCSI information objects.
3370
3371### Example
3372
3373Example request:
3374
3375~~~
3376{
3377  "jsonrpc": "2.0",
3378  "method": "bdev_virtio_scsi_get_devices",
3379  "id": 1
3380}
3381~~~
3382
3383Example response:
3384
3385~~~
3386{
3387  "jsonrpc": "2.0",
3388  "id": 1,
3389  "result": [
3390    {
3391      "name": "VirtioScsi0",
3392      "virtio": {
3393          "vq_size": 128,
3394          "vq_count": 4,
3395          "type": "user",
3396          "socket": "/tmp/VhostScsi0"
3397      }
3398    }
3399  ]
3400}
3401~~~
3402
3403## bdev_virtio_detach_controller {#rpc_bdev_virtio_detach_controller}
3404
3405Remove a Virtio device. This command can be used to remove any type of virtio device.
3406
3407### Parameters
3408
3409Name                    | Optional | Type        | Description
3410----------------------- | -------- | ----------- | -----------
3411name                    | Required | string      | Virtio name
3412
3413### Example
3414
3415Example request:
3416
3417~~~
3418{
3419  "params": {
3420    "name": "VirtioUser0"
3421  },
3422  "jsonrpc": "2.0",
3423  "method": "bdev_virtio_detach_controller",
3424  "id": 1
3425}
3426
3427~~~
3428
3429Example response:
3430
3431~~~
3432{
3433  "jsonrpc": "2.0",
3434  "id": 1,
3435  "result": true
3436}
3437~~~
3438
3439# iSCSI Target {#jsonrpc_components_iscsi_tgt}
3440
3441## iscsi_set_options method {#rpc_iscsi_set_options}
3442
3443Set global parameters for iSCSI targets.
3444
3445This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once.
3446
3447### Parameters
3448
3449Name                            | Optional | Type    | Description
3450------------------------------- | -------- | ------- | -----------
3451auth_file                       | Optional | string  | Path to CHAP shared secret file (default: "")
3452node_base                       | Optional | string  | Prefix of the name of iSCSI target node (default: "iqn.2016-06.io.spdk")
3453nop_timeout                     | Optional | number  | Timeout in seconds to nop-in request to the initiator (default: 60)
3454nop_in_interval                 | Optional | number  | Time interval in secs between nop-in requests by the target (default: 30)
3455disable_chap                    | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
3456require_chap                    | Optional | boolean | CHAP for discovery session should be required (default: `false`)
3457mutual_chap                     | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
3458chap_group                      | Optional | number  | CHAP group ID for discovery session (default: 0)
3459max_sessions                    | Optional | number  | Maximum number of sessions in the host (default: 128)
3460max_queue_depth                 | Optional | number  | Maximum number of outstanding I/Os per queue (default: 64)
3461max_connections_per_session     | Optional | number  | Session specific parameter, MaxConnections (default: 2)
3462default_time2wait               | Optional | number  | Session specific parameter, DefaultTime2Wait (default: 2)
3463default_time2retain             | Optional | number  | Session specific parameter, DefaultTime2Retain (default: 20)
3464first_burst_length              | Optional | number  | Session specific parameter, FirstBurstLength (default: 8192)
3465immediate_data                  | Optional | boolean | Session specific parameter, ImmediateData (default: `true`)
3466error_recovery_level            | Optional | number  | Session specific parameter, ErrorRecoveryLevel (default: 0)
3467allow_duplicated_isid           | Optional | boolean | Allow duplicated initiator session ID (default: `false`)
3468max_large_datain_per_connection | Optional | number  | Max number of outstanding split read I/Os per connection (default: 64)
3469max_r2t_per_connection          | Optional | number  | Max number of outstanding R2Ts per connection (default: 4)
3470
3471To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.
3472
3473Parameters `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.
3474
3475### Example
3476
3477Example request:
3478
3479~~~
3480{
3481  "params": {
3482    "allow_duplicated_isid": true,
3483    "default_time2retain": 60,
3484    "first_burst_length": 8192,
3485    "immediate_data": true,
3486    "node_base": "iqn.2016-06.io.spdk",
3487    "max_sessions": 128,
3488    "nop_timeout": 30,
3489    "nop_in_interval": 30,
3490    "auth_file": "/usr/local/etc/spdk/auth.conf",
3491    "disable_chap": true,
3492    "default_time2wait": 2
3493  },
3494  "jsonrpc": "2.0",
3495  "method": "iscsi_set_options",
3496  "id": 1
3497}
3498~~~
3499
3500Example response:
3501
3502~~~
3503{
3504  "jsonrpc": "2.0",
3505  "id": 1,
3506  "result": true
3507}
3508~~~
3509
3510## iscsi_get_options method {#rpc_iscsi_get_options}
3511
3512Show global parameters of iSCSI targets.
3513
3514### Parameters
3515
3516This method has no parameters.
3517
3518### Example
3519
3520Example request:
3521
3522~~~
3523request:
3524{
3525  "jsonrpc": "2.0",
3526  "method": "iscsi_get_options",
3527  "id": 1
3528}
3529~~~
3530
3531Example response:
3532
3533~~~
3534{
3535  "jsonrpc": "2.0",
3536  "id": 1,
3537  "result": {
3538    "allow_duplicated_isid": true,
3539    "default_time2retain": 60,
3540    "first_burst_length": 8192,
3541    "immediate_data": true,
3542    "node_base": "iqn.2016-06.io.spdk",
3543    "mutual_chap": false,
3544    "nop_in_interval": 30,
3545    "chap_group": 0,
3546    "max_connections_per_session": 2,
3547    "max_queue_depth": 64,
3548    "nop_timeout": 30,
3549    "max_sessions": 128,
3550    "error_recovery_level": 0,
3551    "auth_file": "/usr/local/etc/spdk/auth.conf",
3552    "disable_chap": true,
3553    "default_time2wait": 2,
3554    "require_chap": false,
3555    "max_large_datain_per_connection": 64,
3556    "max_r2t_per_connection": 4
3557  }
3558}
3559~~~
3560## iscsi_set_discovery_auth method {#rpc_iscsi_set_discovery_auth}
3561
3562Set CHAP authentication for sessions dynamically.
3563
3564### Parameters
3565
3566Name                        | Optional | Type    | Description
3567--------------------------- | -------- | --------| -----------
3568disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
3569require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
3570mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
3571chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
3572
3573Parameters `disable_chap` and `require_chap` are mutually exclusive.
3574
3575### Example
3576
3577Example request:
3578
3579~~~
3580request:
3581{
3582  "params": {
3583    "chap_group": 1,
3584    "require_chap": true,
3585    "mutual_chap": true
3586  },
3587  "jsonrpc": "2.0",
3588  "method": "iscsi_set_discovery_auth",
3589  "id": 1
3590}
3591~~~
3592
3593Example response:
3594
3595~~~
3596{
3597  "jsonrpc": "2.0",
3598  "id": 1,
3599  "result": true
3600}
3601~~~
3602
3603## iscsi_create_auth_group method {#rpc_iscsi_create_auth_group}
3604
3605Create an authentication group for CHAP authentication.
3606
3607### Parameters
3608
3609Name                        | Optional | Type    | Description
3610--------------------------- | -------- | --------| -----------
3611tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3612secrets                     | Optional | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
3613
3614### secret {#rpc_iscsi_create_auth_group_secret}
3615
3616Name                        | Optional | Type    | Description
3617--------------------------- | ---------| --------| -----------
3618user                        | Required | string  | Unidirectional CHAP name
3619secret                      | Required | string  | Unidirectional CHAP secret
3620muser                       | Optional | string  | Bidirectional CHAP name
3621msecret                     | Optional | string  | Bidirectional CHAP secret
3622
3623### Example
3624
3625Example request:
3626
3627~~~
3628{
3629  "params": {
3630    "secrets": [
3631      {
3632        "muser": "mu1",
3633        "secret": "s1",
3634        "user": "u1",
3635        "msecret": "ms1"
3636      }
3637    ],
3638    "tag": 2
3639  },
3640  "jsonrpc": "2.0",
3641  "method": "iscsi_create_auth_group",
3642  "id": 1
3643}
3644~~~
3645
3646Example response:
3647
3648~~~
3649{
3650  "jsonrpc": "2.0",
3651  "id": 1,
3652  "result": true
3653}
3654~~~
3655
3656## iscsi_delete_auth_group method {#rpc_iscsi_delete_auth_group}
3657
3658Delete an existing authentication group for CHAP authentication.
3659
3660### Parameters
3661
3662Name                        | Optional | Type    | Description
3663--------------------------- | -------- | --------| -----------
3664tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3665
3666### Example
3667
3668Example request:
3669
3670~~~
3671{
3672  "params": {
3673    "tag": 2
3674  },
3675  "jsonrpc": "2.0",
3676  "method": "iscsi_delete_auth_group",
3677  "id": 1
3678}
3679~~~
3680
3681Example response:
3682
3683~~~
3684{
3685  "jsonrpc": "2.0",
3686  "id": 1,
3687  "result": true
3688}
3689~~~
3690
3691## iscsi_get_auth_groups {#rpc_iscsi_get_auth_groups}
3692
3693Show information about all existing authentication group for CHAP authentication.
3694
3695### Parameters
3696
3697This method has no parameters.
3698
3699### Result
3700
3701Array of objects describing authentication group.
3702
3703Name                        | Type    | Description
3704--------------------------- | --------| -----------
3705tag                         | number  | Authentication group tag
3706secrets                     | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
3707
3708### Example
3709
3710Example request:
3711
3712~~~
3713{
3714  "jsonrpc": "2.0",
3715  "method": "iscsi_get_auth_groups",
3716  "id": 1
3717}
3718~~~
3719Example response:
3720
3721~~~
3722{
3723  "jsonrpc": "2.0",
3724  "id": 1,
3725  "result": [
3726    {
3727      "secrets": [
3728        {
3729          "muser": "mu1",
3730          "secret": "s1",
3731          "user": "u1",
3732          "msecret": "ms1"
3733        }
3734      ],
3735      "tag": 1
3736    },
3737    {
3738      "secrets": [
3739        {
3740          "secret": "s2",
3741          "user": "u2"
3742        }
3743      ],
3744      "tag": 2
3745    }
3746  ]
3747}
3748~~~
3749
3750## iscsi_auth_group_add_secret {#rpc_iscsi_auth_group_add_secret}
3751
3752Add a secret to an existing authentication group for CHAP authentication.
3753
3754### Parameters
3755
3756Name                        | Optional | Type    | Description
3757--------------------------- | -------- | --------| -----------
3758tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3759user                        | Required | string  | Unidirectional CHAP name
3760secret                      | Required | string  | Unidirectional CHAP secret
3761muser                       | Optional | string  | Bidirectional CHAP name
3762msecret                     | Optional | string  | Bidirectional CHAP secret
3763
3764### Example
3765
3766Example request:
3767
3768~~~
3769{
3770  "params": {
3771    "muser": "mu3",
3772    "secret": "s3",
3773    "tag": 2,
3774    "user": "u3",
3775    "msecret": "ms3"
3776  },
3777  "jsonrpc": "2.0",
3778  "method": "iscsi_auth_group_add_secret",
3779  "id": 1
3780}
3781~~~
3782
3783Example response:
3784
3785~~~
3786{
3787  "jsonrpc": "2.0",
3788  "id": 1,
3789  "result": true
3790}
3791~~~
3792
3793## iscsi_auth_group_remove_secret {#rpc_iscsi_auth_group_remove_secret}
3794
3795Remove a secret from an existing authentication group for CHAP authentication.
3796
3797### Parameters
3798
3799Name                        | Optional | Type    | Description
3800--------------------------- | -------- | --------| -----------
3801tag                         | Required | number  | Authentication group tag (unique, integer > 0)
3802user                        | Required | string  | Unidirectional CHAP name
3803
3804### Example
3805
3806Example request:
3807
3808~~~
3809{
3810  "params": {
3811    "tag": 2,
3812    "user": "u3"
3813  },
3814  "jsonrpc": "2.0",
3815  "method": "iscsi_auth_group_remove_secret",
3816  "id": 1
3817}
3818~~~
3819
3820Example response:
3821
3822~~~
3823{
3824  "jsonrpc": "2.0",
3825  "id": 1,
3826  "result": true
3827}
3828~~~
3829
3830## iscsi_get_initiator_groups method {#rpc_iscsi_get_initiator_groups}
3831
3832Show information about all available initiator groups.
3833
3834### Parameters
3835
3836This method has no parameters.
3837
3838### Result
3839
3840Array of objects describing initiator groups.
3841
3842Name                        | Type    | Description
3843--------------------------- | --------| -----------
3844tag                         | number  | Initiator group tag
3845initiators                  | array   | Array of initiator hostnames or IP addresses
3846netmasks                    | array   | Array of initiator netmasks
3847
3848### Example
3849
3850Example request:
3851
3852~~~
3853{
3854  "jsonrpc": "2.0",
3855  "method": "iscsi_get_initiator_groups",
3856  "id": 1
3857}
3858~~~
3859
3860Example response:
3861
3862~~~
3863{
3864  "jsonrpc": "2.0",
3865  "id": 1,
3866  "result": [
3867    {
3868      "initiators": [
3869        "iqn.2016-06.io.spdk:host1",
3870        "iqn.2016-06.io.spdk:host2"
3871      ],
3872      "tag": 1,
3873      "netmasks": [
3874        "192.168.1.0/24"
3875      ]
3876    }
3877  ]
3878}
3879~~~
3880
3881## iscsi_create_initiator_group method {#rpc_iscsi_create_initiator_group}
3882
3883Add an initiator group.
3884
3885### Parameters
3886
3887Name                        | Optional | Type    | Description
3888--------------------------- | -------- | --------| -----------
3889tag                         | Required | number  | Initiator group tag (unique, integer > 0)
3890initiators                  | Required | array   | Not empty array of initiator hostnames or IP addresses
3891netmasks                    | Required | array   | Not empty array of initiator netmasks
3892
3893### Example
3894
3895Example request:
3896
3897~~~
3898{
3899  "params": {
3900    "initiators": [
3901      "iqn.2016-06.io.spdk:host1",
3902      "iqn.2016-06.io.spdk:host2"
3903    ],
3904    "tag": 1,
3905    "netmasks": [
3906      "192.168.1.0/24"
3907    ]
3908  },
3909  "jsonrpc": "2.0",
3910  "method": "iscsi_create_initiator_group",
3911  "id": 1
3912}
3913~~~
3914
3915Example response:
3916
3917~~~
3918response:
3919{
3920  "jsonrpc": "2.0",
3921  "id": 1,
3922  "result": true
3923}
3924~~~
3925
3926## iscsi_delete_initiator_group method {#rpc_iscsi_delete_initiator_group}
3927
3928Delete an existing initiator group.
3929
3930### Parameters
3931
3932Name                        | Optional | Type    | Description
3933--------------------------- | -------- | --------| -----------
3934tag                         | Required | number  | Initiator group tag (unique, integer > 0)
3935
3936### Example
3937
3938Example request:
3939
3940~~~
3941{
3942  "params": {
3943    "tag": 1
3944  },
3945  "jsonrpc": "2.0",
3946  "method": "iscsi_delete_initiator_group",
3947  "id": 1
3948}
3949~~~
3950
3951Example response:
3952
3953~~~
3954{
3955  "jsonrpc": "2.0",
3956  "id": 1,
3957  "result": true
3958}
3959~~~
3960
3961## iscsi_initiator_group_add_initiators method {#rpc_iscsi_initiator_group_add_initiators}
3962
3963Add initiators to an existing initiator group.
3964
3965### Parameters
3966
3967Name                        | Optional | Type    | Description
3968--------------------------- | -------- | --------| -----------
3969tag                         | Required | number  | Existing initiator group tag.
3970initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
3971netmasks                    | Optional | array   | Array of initiator netmasks
3972
3973### Example
3974
3975Example request:
3976
3977~~~
3978request:
3979{
3980  "params": {
3981    "initiators": [
3982      "iqn.2016-06.io.spdk:host3"
3983    ],
3984    "tag": 1,
3985    "netmasks": [
3986      "255.255.255.1"
3987    ]
3988  },
3989  "jsonrpc": "2.0",
3990  "method": "iscsi_initiator_group_add_initiators",
3991  "id": 1
3992}
3993~~~
3994
3995Example response:
3996
3997~~~
3998response:
3999{
4000  "jsonrpc": "2.0",
4001  "id": 1,
4002  "result": true
4003}
4004~~~
4005
4006## iscsi_initiator_group_remove_initiators method {#rpc_iscsi_initiator_group_remove_initiators}
4007
4008Remove initiators from an initiator group.
4009
4010### Parameters
4011
4012Name                        | Optional | Type    | Description
4013--------------------------- | -------- | --------| -----------
4014tag                         | Required | number  | Existing initiator group tag.
4015initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
4016netmasks                    | Optional | array   | Array of initiator netmasks
4017
4018### Example
4019
4020Example request:
4021
4022~~~
4023request:
4024{
4025  "params": {
4026    "initiators": [
4027      "iqn.2016-06.io.spdk:host3"
4028    ],
4029    "tag": 1,
4030    "netmasks": [
4031      "255.255.255.1"
4032    ]
4033  },
4034  "jsonrpc": "2.0",
4035  "method": "iscsi_initiator_group_remove_initiators",
4036  "id": 1
4037}
4038~~~
4039
4040Example response:
4041
4042~~~
4043response:
4044{
4045  "jsonrpc": "2.0",
4046  "id": 1,
4047  "result": true
4048}
4049~~~
4050
4051## iscsi_get_target_nodes method {#rpc_iscsi_get_target_nodes}
4052
4053Show information about all available iSCSI target nodes.
4054
4055### Parameters
4056
4057This method has no parameters.
4058
4059### Result
4060
4061Array of objects describing target node.
4062
4063Name                        | Type    | Description
4064--------------------------- | --------| -----------
4065name                        | string  | Target node name (ASCII)
4066alias_name                  | string  | Target node alias name (ASCII)
4067pg_ig_maps                  | array   | Array of Portal_Group_Tag:Initiator_Group_Tag mappings
4068luns                        | array   | Array of Bdev names to LUN ID mappings
4069queue_depth                 | number  | Target queue depth
4070disable_chap                | boolean | CHAP authentication should be disabled for this target
4071require_chap                | boolean | CHAP authentication should be required for this target
4072mutual_chap                 | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
4073chap_group                  | number  | Authentication group ID for this target node
4074header_digest               | boolean | Header Digest should be required for this target node
4075data_digest                 | boolean | Data Digest should be required for this target node
4076
4077### Example
4078
4079Example request:
4080
4081~~~
4082{
4083  "jsonrpc": "2.0",
4084  "method": "iscsi_get_target_nodes",
4085  "id": 1
4086}
4087~~~
4088
4089Example response:
4090
4091~~~
4092{
4093  "jsonrpc": "2.0",
4094  "id": 1,
4095  "result": [
4096    {
4097      "luns": [
4098        {
4099          "lun_id": 0,
4100          "bdev_name": "Nvme0n1"
4101        }
4102      ],
4103      "mutual_chap": false,
4104      "name": "iqn.2016-06.io.spdk:target1",
4105      "alias_name": "iscsi-target1-alias",
4106      "require_chap": false,
4107      "chap_group": 0,
4108      "pg_ig_maps": [
4109        {
4110          "ig_tag": 1,
4111          "pg_tag": 1
4112        }
4113      ],
4114      "data_digest": false,
4115      "disable_chap": false,
4116      "header_digest": false,
4117      "queue_depth": 64
4118    }
4119  ]
4120}
4121~~~
4122
4123## iscsi_create_target_node method {#rpc_iscsi_create_target_node}
4124
4125Add an iSCSI target node.
4126
4127### Parameters
4128
4129Name                        | Optional | Type    | Description
4130--------------------------- | -------- | --------| -----------
4131name                        | Required | string  | Target node name (ASCII)
4132alias_name                  | Required | string  | Target node alias name (ASCII)
4133pg_ig_maps                  | Required | array   | Array of (Portal_Group_Tag:Initiator_Group_Tag) mappings
4134luns                        | Required | array   | Array of Bdev names to LUN ID mappings
4135queue_depth                 | Required | number  | Target queue depth
4136disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
4137require_chap                | Optional | boolean | CHAP authentication should be required for this target
4138mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
4139chap_group                  | Optional | number  | Authentication group ID for this target node
4140header_digest               | Optional | boolean | Header Digest should be required for this target node
4141data_digest                 | Optional | boolean | Data Digest should be required for this target node
4142
4143Parameters `disable_chap` and `require_chap` are mutually exclusive.
4144
4145### Example
4146
4147Example request:
4148
4149~~~
4150{
4151  "params": {
4152    "luns": [
4153      {
4154        "lun_id": 0,
4155        "bdev_name": "Nvme0n1"
4156      }
4157    ],
4158    "mutual_chap": true,
4159    "name": "target2",
4160    "alias_name": "iscsi-target2-alias",
4161    "pg_ig_maps": [
4162      {
4163        "ig_tag": 1,
4164        "pg_tag": 1
4165      },
4166      {
4167        "ig_tag": 2,
4168        "pg_tag": 2
4169      }
4170    ],
4171    "data_digest": true,
4172    "disable_chap": true,
4173    "header_digest": true,
4174    "queue_depth": 24
4175  },
4176  "jsonrpc": "2.0",
4177  "method": "iscsi_create_target_node",
4178  "id": 1
4179}
4180~~~
4181
4182Example response:
4183
4184~~~
4185{
4186  "jsonrpc": "2.0",
4187  "id": 1,
4188  "result": true
4189}
4190~~~
4191
4192## iscsi_target_node_set_auth method {#rpc_iscsi_target_node_set_auth}
4193
4194Set CHAP authentication to an existing iSCSI target node.
4195
4196### Parameters
4197
4198Name                        | Optional | Type    | Description
4199--------------------------- | -------- | --------| -----------
4200name                        | Required | string  | Target node name (ASCII)
4201disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
4202require_chap                | Optional | boolean | CHAP authentication should be required for this target
4203mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
4204chap_group                  | Optional | number  | Authentication group ID for this target node
4205
4206Parameters `disable_chap` and `require_chap` are mutually exclusive.
4207
4208### Example
4209
4210Example request:
4211
4212~~~
4213{
4214  "params": {
4215    "chap_group": 1,
4216    "require_chap": true,
4217    "name": "iqn.2016-06.io.spdk:target1",
4218    "mutual_chap": true
4219  },
4220  "jsonrpc": "2.0",
4221  "method": "iscsi_target_node_set_auth",
4222  "id": 1
4223}
4224~~~
4225
4226Example response:
4227
4228~~~
4229{
4230  "jsonrpc": "2.0",
4231  "id": 1,
4232  "result": true
4233}
4234~~~
4235
4236## iscsi_target_node_add_pg_ig_maps method {#rpc_iscsi_target_node_add_pg_ig_maps}
4237
4238Add initiator group to portal group mappings to an existing iSCSI target node.
4239
4240### Parameters
4241
4242Name                        | Optional | Type    | Description
4243--------------------------- | -------- | --------| -----------
4244name                        | Required | string  | Target node name (ASCII)
4245pg_ig_maps                  | Required | array   | Not empty array of initiator to portal group mappings objects
4246
4247Portal to Initiator group mappings object:
4248
4249Name                        | Optional | Type    | Description
4250--------------------------- | -------- | --------| -----------
4251ig_tag                      | Required | number  | Existing initiator group tag
4252pg_tag                      | Required | number  | Existing portal group tag
4253
4254### Example
4255
4256Example request:
4257
4258~~~
4259{
4260  "params": {
4261    "pg_ig_maps": [
4262      {
4263        "ig_tag": 1,
4264        "pg_tag": 1
4265      },
4266      {
4267        "ig_tag": 2,
4268        "pg_tag": 2
4269      },
4270      {
4271        "ig_tag": 3,
4272        "pg_tag": 3
4273      }
4274    ],
4275    "name": "iqn.2016-06.io.spdk:target3"
4276  },
4277  "jsonrpc": "2.0",
4278  "method": "iscsi_target_node_add_pg_ig_maps",
4279  "id": 1
4280}
4281~~~
4282
4283Example response:
4284
4285~~~
4286{
4287  "jsonrpc": "2.0",
4288  "id": 1,
4289  "result": true
4290}
4291~~~
4292
4293## iscsi_target_node_remove_pg_ig_maps method {#rpc_iscsi_target_node_remove_pg_ig_maps}
4294
4295Delete initiator group to portal group mappings from an existing iSCSI target node.
4296
4297### Parameters
4298
4299Name                        | Optional | Type    | Description
4300--------------------------- | -------- | --------| -----------
4301name                        | Required | string  | Target node name (ASCII)
4302pg_ig_maps                  | Required | array   | Not empty array of Portal to Initiator group mappings objects
4303
4304Portal to Initiator group mappings object:
4305
4306Name                        | Optional | Type    | Description
4307--------------------------- | -------- | --------| -----------
4308ig_tag                      | Required | number  | Existing initiator group tag
4309pg_tag                      | Required | number  | Existing portal group tag
4310
4311### Example
4312
4313Example request:
4314
4315~~~
4316{
4317  "params": {
4318    "pg_ig_maps": [
4319      {
4320        "ig_tag": 1,
4321        "pg_tag": 1
4322      },
4323      {
4324        "ig_tag": 2,
4325        "pg_tag": 2
4326      },
4327      {
4328        "ig_tag": 3,
4329        "pg_tag": 3
4330      }
4331    ],
4332    "name": "iqn.2016-06.io.spdk:target3"
4333  },
4334  "jsonrpc": "2.0",
4335  "method": "iscsi_target_node_remove_pg_ig_maps",
4336  "id": 1
4337}
4338~~~
4339
4340Example response:
4341
4342~~~
4343{
4344  "jsonrpc": "2.0",
4345  "id": 1,
4346  "result": true
4347}
4348~~~
4349
4350## iscsi_delete_target_node method {#rpc_iscsi_delete_target_node}
4351
4352Delete an iSCSI target node.
4353
4354### Parameters
4355
4356Name                        | Optional | Type    | Description
4357--------------------------- | -------- | --------| -----------
4358name                        | Required | string  | Target node name (ASCII)
4359
4360### Example
4361
4362Example request:
4363
4364~~~
4365{
4366  "params": {
4367    "name": "iqn.2016-06.io.spdk:target1"
4368  },
4369  "jsonrpc": "2.0",
4370  "method": "iscsi_delete_target_node",
4371  "id": 1
4372}
4373~~~
4374
4375Example response:
4376
4377~~~
4378{
4379  "jsonrpc": "2.0",
4380  "id": 1,
4381  "result": true
4382}
4383~~~
4384
4385## iscsi_get_portal_groups method {#rpc_iscsi_get_portal_groups}
4386
4387Show information about all available portal groups.
4388
4389### Parameters
4390
4391This method has no parameters.
4392
4393### Example
4394
4395Example request:
4396
4397~~~
4398request:
4399{
4400  "jsonrpc": "2.0",
4401  "method": "iscsi_get_portal_groups",
4402  "id": 1
4403}
4404~~~
4405
4406Example response:
4407
4408~~~
4409{
4410  "jsonrpc": "2.0",
4411  "id": 1,
4412  "result": [
4413    {
4414      "portals": [
4415        {
4416          "host": "127.0.0.1",
4417          "port": "3260"
4418        }
4419      ],
4420      "tag": 1,
4421      "private": false
4422    }
4423  ]
4424}
4425~~~
4426
4427## iscsi_create_portal_group method {#rpc_iscsi_create_portal_group}
4428
4429Add a portal group.
4430
4431### Parameters
4432
4433Name                        | Optional | Type    | Description
4434--------------------------- | -------- | --------| -----------
4435tag                         | Required | number  | Portal group tag
4436portals                     | Required | array   | Not empty array of portals
4437private                     | Optional | boolean | When true, portals in this group are not returned by a discovery session. Used for login redirection. (default: `false`)
4438wait                        | Optional | boolean | When true, do not listen on portals until it is started explicitly. (default: `false`)
4439
4440Portal object
4441
4442Name                        | Optional | Type    | Description
4443--------------------------- | -------- | --------| -----------
4444host                        | Required | string  | Hostname or IP address
4445port                        | Required | string  | Port number
4446
4447### Example
4448
4449Example request:
4450
4451~~~
4452{
4453  "params": {
4454    "portals": [
4455      {
4456        "host": "127.0.0.1",
4457        "port": "3260"
4458      }
4459    ],
4460    "tag": 1
4461  },
4462  "jsonrpc": "2.0",
4463  "method": "iscsi_create_portal_group",
4464  "id": 1
4465}
4466~~~
4467
4468Example response:
4469
4470~~~
4471{
4472  "jsonrpc": "2.0",
4473  "id": 1,
4474  "result": true
4475}
4476~~~
4477
4478## iscsi_start_portal_group method {#rpc_iscsi_start_portal_group}
4479
4480Start listening on portals if the portal group is not started yet, or do nothing
4481if the portal group already started. Return a success response for both cases.
4482
4483### Parameters
4484
4485Name                        | Optional | Type    | Description
4486--------------------------- | -------- | --------| -----------
4487tag                         | Required | number  | Existing portal group tag
4488
4489### Example
4490
4491Example request:
4492
4493~~~
4494{
4495  "params": {
4496    "tag": 1
4497  },
4498  "jsonrpc": "2.0",
4499  "method": "iscsi_start_portal_group",
4500  "id": 1
4501}
4502~~~
4503
4504Example response:
4505
4506~~~
4507{
4508  "jsonrpc": "2.0",
4509  "id": 1,
4510  "result": true
4511}
4512~~~
4513
4514## iscsi_delete_portal_group method {#rpc_iscsi_delete_portal_group}
4515
4516Delete an existing portal group.
4517
4518### Parameters
4519
4520Name                        | Optional | Type    | Description
4521--------------------------- | -------- | --------| -----------
4522tag                         | Required | number  | Existing portal group tag
4523
4524### Example
4525
4526Example request:
4527
4528~~~
4529{
4530  "params": {
4531    "tag": 1
4532  },
4533  "jsonrpc": "2.0",
4534  "method": "iscsi_delete_portal_group",
4535  "id": 1
4536}
4537~~~
4538
4539Example response:
4540
4541~~~
4542{
4543  "jsonrpc": "2.0",
4544  "id": 1,
4545  "result": true
4546}
4547~~~
4548
4549## iscsi_portal_group_set_auth method {#rpc_iscsi_portal_group_set_auth}
4550
4551Set CHAP authentication for discovery sessions specific for the existing iSCSI portal group.
4552This RPC overwrites the setting by the global parameters for the iSCSI portal group.
4553
4554### Parameters
4555
4556Name                        | Optional | Type    | Description
4557--------------------------- | -------- | --------| -----------
4558disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
4559require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
4560mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
4561chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
4562
4563Parameters `disable_chap` and `require_chap` are mutually exclusive.
4564
4565### Example
4566
4567Example request:
4568
4569~~~
4570request:
4571{
4572  "params": {
4573    "tag": 1,
4574    "chap_group": 1,
4575    "require_chap": true,
4576    "mutual_chap": true
4577  },
4578  "jsonrpc": "2.0",
4579  "method": "iscsi_portal_group_set_auth",
4580  "id": 1
4581}
4582~~~
4583
4584Example response:
4585
4586~~~
4587{
4588  "jsonrpc": "2.0",
4589  "id": 1,
4590  "result": true
4591}
4592~~~
4593
4594## iscsi_get_connections method {#rpc_iscsi_get_connections}
4595
4596Show information about all active connections.
4597
4598### Parameters
4599
4600This method has no parameters.
4601
4602### Results
4603
4604Array of objects describing iSCSI connection.
4605
4606Name                        | Type    | Description
4607--------------------------- | --------| -----------
4608id                          | number  | Index (used for TTT - Target Transfer Tag)
4609cid                         | number  | CID (Connection ID)
4610tsih                        | number  | TSIH (Target Session Identifying Handle)
4611lcore_id                    | number  | Core number on which the iSCSI connection runs
4612initiator_addr              | string  | Initiator address
4613target_addr                 | string  | Target address
4614target_node_name            | string  | Target node name (ASCII) without prefix
4615
4616### Example
4617
4618Example request:
4619
4620~~~
4621{
4622  "jsonrpc": "2.0",
4623  "method": "iscsi_get_connections",
4624  "id": 1
4625}
4626~~~
4627
4628Example response:
4629
4630~~~
4631{
4632  "jsonrpc": "2.0",
4633  "id": 1,
4634  "result": [
4635    {
4636      "tsih": 4,
4637      "cid": 0,
4638      "target_node_name": "target1",
4639      "lcore_id": 0,
4640      "initiator_addr": "10.0.0.2",
4641      "target_addr": "10.0.0.1",
4642      "id": 0
4643    }
4644  ]
4645}
4646~~~
4647
4648## iscsi_target_node_add_lun method {#rpc_iscsi_target_node_add_lun}
4649
4650Add an LUN to an existing iSCSI target node.
4651
4652### Parameters
4653
4654Name                        | Optional | Type    | Description
4655--------------------------- | -------- | --------| -----------
4656name                        | Required | string  | Target node name (ASCII)
4657bdev_name                   | Required | string  | bdev name to be added as a LUN
4658lun_id                      | Optional | number  | LUN ID (default: first free ID)
4659
4660### Example
4661
4662Example request:
4663
4664~~~
4665{
4666  "params": {
4667    "lun_id": 2,
4668    "name": "iqn.2016-06.io.spdk:target1",
4669    "bdev_name": "Malloc0"
4670  },
4671  "jsonrpc": "2.0",
4672  "method": "iscsi_target_node_add_lun",
4673  "id": 1
4674}
4675~~~
4676
4677Example response:
4678
4679~~~
4680{
4681  "jsonrpc": "2.0",
4682  "id": 1,
4683  "result": true
4684}
4685~~~
4686
4687## iscsi_target_node_set_redirect method {#rpc_iscsi_target_node_set_redirect}
4688
4689Update redirect portal of the primary portal group for the target node,
4690
4691### Parameters
4692
4693Name                        | Optional | Type    | Description
4694--------------------------- | -------- | --------| -----------
4695name                        | Required | string  | Target node name (ASCII)
4696pg_tag                      | Required | number  | Existing portal group tag
4697redirect_host               | Optional | string  | Numeric IP address to which the target node is redirected
4698redirect_port               | Optional | string  | Numeric TCP port to which the target node is redirected
4699
4700If both redirect_host and redirect_port are omitted, clear the redirect portal.
4701
4702### Example
4703
4704Example request:
4705
4706~~~
4707{
4708  "params": {
4709    "name": "iqn.2016-06.io.spdk:target1",
4710    "pg_tag": 1,
4711    "redirect_host": "10.0.0.3",
4712    "redirect_port": "3260"
4713  },
4714  "jsonrpc": "2.0",
4715  "method": "iscsi_target_node_set_redirect",
4716  "id": 1
4717}
4718~~~
4719
4720Example response:
4721
4722~~~
4723{
4724  "jsonrpc": "2.0",
4725  "id": 1,
4726  "result": true
4727}
4728~~~
4729
4730## iscsi_target_node_request_logout method {#rpc_iscsi_target_node_request_logout}
4731
4732For the target node, request connections whose portal group tag match to logout,
4733or request all connections to logout if portal group tag is omitted.
4734
4735### Parameters
4736
4737Name                        | Optional | Type    | Description
4738--------------------------- | -------- | --------| -----------
4739name                        | Required | string  | Target node name (ASCII)
4740pg_tag                      | Optional | number  | Existing portal group tag
4741
4742### Example
4743
4744Example request:
4745
4746~~~
4747{
4748  "params": {
4749    "name": "iqn.2016-06.io.spdk:target1",
4750    "pg_tag": 1
4751  },
4752  "jsonrpc": "2.0",
4753  "method": "iscsi_target_node_request_logout",
4754  "id": 1
4755}
4756~~~
4757
4758Example response:
4759
4760~~~
4761{
4762  "jsonrpc": "2.0",
4763  "id": 1,
4764  "result": true
4765}
4766~~~
4767
4768# NVMe-oF Target {#jsonrpc_components_nvmf_tgt}
4769
4770## nvmf_create_transport method {#rpc_nvmf_create_transport}
4771
4772Initialize an NVMe-oF transport with the given options.
4773
4774### Parameters
4775
4776Name                        | Optional | Type    | Description
4777--------------------------- | -------- | --------| -----------
4778trtype                      | Required | string  | Transport type (ex. RDMA)
4779tgt_name                    | Optional | string  | Parent NVMe-oF target name.
4780max_queue_depth             | Optional | number  | Max number of outstanding I/O per queue
4781max_qpairs_per_ctrlr        | Optional | number  | Max number of SQ and CQ per controller (deprecated, use max_io_qpairs_per_ctrlr)
4782max_io_qpairs_per_ctrlr     | Optional | number  | Max number of IO qpairs per controller
4783in_capsule_data_size        | Optional | number  | Max number of in-capsule data size
4784max_io_size                 | Optional | number  | Max I/O size (bytes)
4785io_unit_size                | Optional | number  | I/O unit size (bytes)
4786max_aq_depth                | Optional | number  | Max number of admin cmds per AQ
4787num_shared_buffers          | Optional | number  | The number of pooled data buffers available to the transport
4788buf_cache_size              | Optional | number  | The number of shared buffers to reserve for each poll group
4789max_srq_depth               | Optional | number  | The number of elements in a per-thread shared receive queue (RDMA only)
4790no_srq                      | Optional | boolean | Disable shared receive queue even for devices that support it. (RDMA only)
4791c2h_success                 | Optional | boolean | Disable C2H success optimization (TCP only)
4792dif_insert_or_strip         | Optional | boolean | Enable DIF insert for write I/O and DIF strip for read I/O DIF
4793sock_priority               | Optional | number  | The socket priority of the connection owned by this transport (TCP only)
4794acceptor_backlog            | Optional | number  | The number of pending connections allowed in backlog before failing new connection attempts (RDMA only)
4795abort_timeout_sec           | Optional | number  | Abort execution timeout value, in seconds
4796no_wr_batching              | Optional | boolean | Disable work requests batching (RDMA only)
4797
4798### Example
4799
4800Example request:
4801
4802~~~
4803{
4804  "jsonrpc": "2.0",
4805  "method": "nvmf_create_transport",
4806  "id": 1,
4807  "params": {
4808    "trtype": "RDMA",
4809    "max_queue_depth": 32
4810  }
4811}
4812~~~
4813
4814Example response:
4815
4816~~~
4817{
4818  "jsonrpc": "2.0",
4819  "id": 1,
4820  "result": true
4821}
4822~~~
4823
4824## nvmf_get_subsystems method {#rpc_nvmf_get_subsystems}
4825
4826### Parameters
4827
4828Name                        | Optional | Type        | Description
4829--------------------------- | -------- | ------------| -----------
4830tgt_name                    | Optional | string      | Parent NVMe-oF target name.
4831
4832### Example
4833
4834Example request:
4835
4836~~~
4837{
4838  "jsonrpc": "2.0",
4839  "id": 1,
4840  "method": "nvmf_get_subsystems"
4841}
4842~~~
4843
4844Example response:
4845
4846~~~
4847{
4848  "jsonrpc": "2.0",
4849  "id": 1,
4850  "result": [
4851    {
4852      "nqn": "nqn.2014-08.org.nvmexpress.discovery",
4853      "subtype": "Discovery"
4854      "listen_addresses": [],
4855      "hosts": [],
4856      "allow_any_host": true
4857    },
4858    {
4859      "nqn": "nqn.2016-06.io.spdk:cnode1",
4860      "subtype": "NVMe",
4861      "listen_addresses": [
4862        {
4863          "trtype": "RDMA",
4864          "adrfam": "IPv4",
4865          "traddr": "192.168.0.123",
4866          "trsvcid": "4420"
4867        }
4868      ],
4869      "hosts": [
4870        {"nqn": "nqn.2016-06.io.spdk:host1"}
4871      ],
4872      "allow_any_host": false,
4873      "serial_number": "abcdef",
4874      "model_number": "ghijklmnop",
4875      "namespaces": [
4876        {"nsid": 1, "name": "Malloc2"},
4877        {"nsid": 2, "name": "Nvme0n1"}
4878      ]
4879    }
4880  ]
4881}
4882~~~
4883
4884## nvmf_create_subsystem method {#rpc_nvmf_create_subsystem}
4885
4886Construct an NVMe over Fabrics target subsystem.
4887
4888### Parameters
4889
4890Name                    | Optional | Type        | Description
4891----------------------- | -------- | ----------- | -----------
4892nqn                     | Required | string      | Subsystem NQN
4893tgt_name                | Optional | string      | Parent NVMe-oF target name.
4894serial_number           | Optional | string      | Serial number of virtual controller
4895model_number            | Optional | string      | Model number of virtual controller
4896max_namespaces          | Optional | number      | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
4897allow_any_host          | Optional | boolean     | Allow any host (`true`) or enforce allowed host list (`false`). Default: `false`.
4898ana_reporting           | Optional | boolean     | Enable ANA reporting feature (default: `false`).
4899
4900### Example
4901
4902Example request:
4903
4904~~~
4905{
4906  "jsonrpc": "2.0",
4907  "id": 1,
4908  "method": "nvmf_create_subsystem",
4909  "params": {
4910    "nqn": "nqn.2016-06.io.spdk:cnode1",
4911    "allow_any_host": false,
4912    "serial_number": "abcdef",
4913    "model_number": "ghijklmnop"
4914  }
4915}
4916~~~
4917
4918Example response:
4919
4920~~~
4921{
4922  "jsonrpc": "2.0",
4923  "id": 1,
4924  "result": true
4925}
4926~~~
4927
4928## nvmf_delete_subsystem method {#rpc_nvmf_delete_subsystem}
4929
4930Delete an existing NVMe-oF subsystem.
4931
4932### Parameters
4933
4934Parameter              | Optional | Type        | Description
4935---------------------- | -------- | ----------- | -----------
4936nqn                    | Required | string      | Subsystem NQN to delete.
4937tgt_name               | Optional | string      | Parent NVMe-oF target name.
4938
4939### Example
4940
4941Example request:
4942
4943~~~
4944{
4945  "jsonrpc": "2.0",
4946  "id": 1,
4947  "method": "nvmf_delete_subsystem",
4948  "params": {
4949    "nqn": "nqn.2016-06.io.spdk:cnode1"
4950  }
4951}
4952~~~
4953
4954Example response:
4955
4956~~~
4957{
4958  "jsonrpc": "2.0",
4959  "id": 1,
4960  "result": true
4961}
4962~~~
4963
4964## nvmf_subsystem_add_listener  method {#rpc_nvmf_subsystem_add_listener}
4965
4966Add a new listen address to an NVMe-oF subsystem.
4967
4968### Parameters
4969
4970Name                    | Optional | Type        | Description
4971----------------------- | -------- | ----------- | -----------
4972nqn                     | Required | string      | Subsystem NQN
4973tgt_name                | Optional | string      | Parent NVMe-oF target name.
4974listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
4975
4976### listen_address {#rpc_nvmf_listen_address}
4977
4978Name                    | Optional | Type        | Description
4979----------------------- | -------- | ----------- | -----------
4980trtype                  | Required | string      | Transport type ("RDMA")
4981adrfam                  | Required | string      | Address family ("IPv4", "IPv6", "IB", or "FC")
4982traddr                  | Required | string      | Transport address
4983trsvcid                 | Required | string      | Transport service ID
4984
4985### Example
4986
4987Example request:
4988
4989~~~
4990{
4991  "jsonrpc": "2.0",
4992  "id": 1,
4993  "method": "nvmf_subsystem_add_listener",
4994  "params": {
4995    "nqn": "nqn.2016-06.io.spdk:cnode1",
4996    "listen_address": {
4997      "trtype": "RDMA",
4998      "adrfam": "IPv4",
4999      "traddr": "192.168.0.123",
5000      "trsvcid": "4420"
5001    }
5002  }
5003}
5004~~~
5005
5006Example response:
5007
5008~~~
5009{
5010  "jsonrpc": "2.0",
5011  "id": 1,
5012  "result": true
5013}
5014~~~
5015
5016## nvmf_subsystem_remove_listener  method {#rpc_nvmf_subsystem_remove_listener}
5017
5018Remove a listen address from an NVMe-oF subsystem.
5019
5020### Parameters
5021
5022Name                    | Optional | Type        | Description
5023----------------------- | -------- | ----------- | -----------
5024nqn                     | Required | string      | Subsystem NQN
5025tgt_name                | Optional | string      | Parent NVMe-oF target name.
5026listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
5027
5028### Example
5029
5030Example request:
5031
5032~~~
5033{
5034  "jsonrpc": "2.0",
5035  "id": 1,
5036  "method": "nvmf_subsystem_remove_listener",
5037  "params": {
5038    "nqn": "nqn.2016-06.io.spdk:cnode1",
5039    "listen_address": {
5040      "trtype": "RDMA",
5041      "adrfam": "IPv4",
5042      "traddr": "192.168.0.123",
5043      "trsvcid": "4420"
5044    }
5045  }
5046}
5047~~~
5048
5049Example response:
5050
5051~~~
5052{
5053  "jsonrpc": "2.0",
5054  "id": 1,
5055  "result": true
5056}
5057~~~
5058
5059## nvmf_subsystem_listener_set_ana_state  method {#rpc_nvmf_subsystem_listener_set_ana_state}
5060
5061Set ANA state of a listener for an NVMe-oF subsystem.
5062
5063### Parameters
5064
5065Name                    | Optional | Type        | Description
5066----------------------- | -------- | ----------- | -----------
5067nqn                     | Required | string      | Subsystem NQN
5068tgt_name                | Optional | string      | Parent NVMe-oF target name.
5069listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
5070ana_state               | Required | string      | ANA state to set ("optimized", "non_optimized", or "inaccessible")
5071
5072### Example
5073
5074Example request:
5075
5076~~~
5077{
5078  "jsonrpc": "2.0",
5079  "id": 1,
5080  "method": "nvmf_subsystem_listener_set_ana_state",
5081  "params": {
5082    "nqn": "nqn.2016-06.io.spdk:cnode1",
5083    "listen_address": {
5084      "trtype": "RDMA",
5085      "adrfam": "IPv4",
5086      "traddr": "192.168.0.123",
5087      "trsvcid": "4420"
5088    },
5089    "ana_state", "inaccessible"
5090  }
5091}
5092~~~
5093
5094Example response:
5095
5096~~~
5097{
5098  "jsonrpc": "2.0",
5099  "id": 1,
5100  "result": true
5101}
5102~~~
5103
5104## nvmf_subsystem_add_ns method {#rpc_nvmf_subsystem_add_ns}
5105
5106Add a namespace to a subsystem. The namespace ID is returned as the result.
5107
5108### Parameters
5109
5110Name                    | Optional | Type        | Description
5111----------------------- | -------- | ----------- | -----------
5112nqn                     | Required | string      | Subsystem NQN
5113namespace               | Required | object      | @ref rpc_nvmf_namespace object
5114tgt_name                | Optional | string      | Parent NVMe-oF target name.
5115
5116### namespace {#rpc_nvmf_namespace}
5117
5118Name                    | Optional | Type        | Description
5119----------------------- | -------- | ----------- | -----------
5120nsid                    | Optional | number      | Namespace ID between 1 and 4294967294, inclusive. Default: Automatically assign NSID.
5121bdev_name               | Required | string      | Name of bdev to expose as a namespace.
5122nguid                   | Optional | string      | 16-byte namespace globally unique identifier in hexadecimal (e.g. "ABCDEF0123456789ABCDEF0123456789")
5123eui64                   | Optional | string      | 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789")
5124uuid                    | Optional | string      | RFC 4122 UUID (e.g. "ceccf520-691e-4b46-9546-34af789907c5")
5125ptpl_file               | Optional | string      | File path to save/restore persistent reservation information
5126
5127### Example
5128
5129Example request:
5130
5131~~~
5132{
5133  "jsonrpc": "2.0",
5134  "id": 1,
5135  "method": "nvmf_subsystem_add_ns",
5136  "params": {
5137    "nqn": "nqn.2016-06.io.spdk:cnode1",
5138    "namespace": {
5139      "nsid": 3,
5140      "bdev_name": "Nvme0n1",
5141      "ptpl_file": "/opt/Nvme0n1PR.json"
5142    }
5143  }
5144}
5145~~~
5146
5147Example response:
5148
5149~~~
5150{
5151  "jsonrpc": "2.0",
5152  "id": 1,
5153  "result": 3
5154}
5155~~~
5156
5157## nvmf_subsystem_remove_ns method {#rpc_nvmf_subsystem_remove_ns}
5158
5159Remove a namespace from a subsystem.
5160
5161### Parameters
5162
5163Name                    | Optional | Type        | Description
5164----------------------- | -------- | ----------- | -----------
5165nqn                     | Required | string      | Subsystem NQN
5166nsid                    | Required | number      | Namespace ID
5167tgt_name                | Optional | string      | Parent NVMe-oF target name.
5168
5169### Example
5170
5171Example request:
5172
5173~~~
5174{
5175  "jsonrpc": "2.0",
5176  "id": 1,
5177  "method": "nvmf_subsystem_remove_ns",
5178  "params": {
5179    "nqn": "nqn.2016-06.io.spdk:cnode1",
5180    "nsid": 1
5181  }
5182}
5183~~~
5184
5185Example response:
5186
5187~~~
5188{
5189  "jsonrpc": "2.0",
5190  "id": 1,
5191  "result": true
5192}
5193~~~
5194
5195## nvmf_subsystem_add_host method {#rpc_nvmf_subsystem_add_host}
5196
5197Add a host NQN to the list of allowed hosts.
5198
5199### Parameters
5200
5201Name                    | Optional | Type        | Description
5202----------------------- | -------- | ----------- | -----------
5203nqn                     | Required | string      | Subsystem NQN
5204host                    | Required | string      | Host NQN to add to the list of allowed host NQNs
5205tgt_name                | Optional | string      | Parent NVMe-oF target name.
5206
5207### Example
5208
5209Example request:
5210
5211~~~
5212{
5213  "jsonrpc": "2.0",
5214  "id": 1,
5215  "method": "nvmf_subsystem_add_host",
5216  "params": {
5217    "nqn": "nqn.2016-06.io.spdk:cnode1",
5218    "host": "nqn.2016-06.io.spdk:host1"
5219  }
5220}
5221~~~
5222
5223Example response:
5224
5225~~~
5226{
5227  "jsonrpc": "2.0",
5228  "id": 1,
5229  "result": true
5230}
5231~~~
5232
5233## nvmf_subsystem_remove_host method {#rpc_nvmf_subsystem_remove_host}
5234
5235Remove a host NQN from the list of allowed hosts.
5236
5237### Parameters
5238
5239Name                    | Optional | Type        | Description
5240----------------------- | -------- | ----------- | -----------
5241nqn                     | Required | string      | Subsystem NQN
5242host                    | Required | string      | Host NQN to remove from the list of allowed host NQNs
5243tgt_name                | Optional | string      | Parent NVMe-oF target name.
5244
5245### Example
5246
5247Example request:
5248
5249~~~
5250{
5251  "jsonrpc": "2.0",
5252  "id": 1,
5253  "method": "nvmf_subsystem_remove_host",
5254  "params": {
5255    "nqn": "nqn.2016-06.io.spdk:cnode1",
5256    "host": "nqn.2016-06.io.spdk:host1"
5257  }
5258}
5259~~~
5260
5261Example response:
5262
5263~~~
5264{
5265  "jsonrpc": "2.0",
5266  "id": 1,
5267  "result": true
5268}
5269~~~
5270
5271## nvmf_subsystem_allow_any_host method {#rpc_nvmf_subsystem_allow_any_host}
5272
5273Configure a subsystem to allow any host to connect or to enforce the host NQN list.
5274
5275### Parameters
5276
5277Name                    | Optional | Type        | Description
5278----------------------- | -------- | ----------- | -----------
5279nqn                     | Required | string      | Subsystem NQN
5280allow_any_host          | Required | boolean     | Allow any host (`true`) or enforce allowed host list (`false`).
5281tgt_name                | Optional | string      | Parent NVMe-oF target name.
5282
5283### Example
5284
5285Example request:
5286
5287~~~
5288{
5289  "jsonrpc": "2.0",
5290  "id": 1,
5291  "method": "nvmf_subsystem_allow_any_host",
5292  "params": {
5293    "nqn": "nqn.2016-06.io.spdk:cnode1",
5294    "allow_any_host": true
5295  }
5296}
5297~~~
5298
5299Example response:
5300
5301~~~
5302{
5303  "jsonrpc": "2.0",
5304  "id": 1,
5305  "result": true
5306}
5307~~~
5308
5309## nvmf_subsystem_get_controllers {#rpc_nvmf_subsystem_get_controllers}
5310
5311### Parameters
5312
5313Name                    | Optional | Type        | Description
5314----------------------- | -------- | ----------- | -----------
5315nqn                     | Required | string      | Subsystem NQN
5316tgt_name                | Optional | string      | Parent NVMe-oF target name.
5317
5318### Example
5319
5320Example request:
5321
5322~~~
5323{
5324  "jsonrpc": "2.0",
5325  "id": 1,
5326  "method": "nvmf_subsystem_get_controllers",
5327  "params": {
5328    "nqn": "nqn.2016-06.io.spdk:cnode1"
5329  }
5330}
5331~~~
5332
5333Example response:
5334
5335~~~
5336{
5337  "jsonrpc": "2.0",
5338  "id": 1,
5339  "result": [
5340    {
5341      "cntlid": 1,
5342      "hostnqn": "nqn.2016-06.io.spdk:host1",
5343      "hostid": "27dad528-6368-41c3-82d3-0b956b49025d",
5344      "num_io_qpairs": 5
5345    }
5346  ]
5347}
5348~~~
5349
5350## nvmf_subsystem_get_qpairs {#rpc_nvmf_subsystem_get_qpairs}
5351
5352### Parameters
5353
5354Name                    | Optional | Type        | Description
5355----------------------- | -------- | ----------- | -----------
5356nqn                     | Required | string      | Subsystem NQN
5357tgt_name                | Optional | string      | Parent NVMe-oF target name.
5358
5359### Example
5360
5361Example request:
5362
5363~~~
5364{
5365  "jsonrpc": "2.0",
5366  "id": 1,
5367  "method": "nvmf_subsystem_get_qpairs",
5368  "params": {
5369    "nqn": "nqn.2016-06.io.spdk:cnode1"
5370  }
5371}
5372~~~
5373
5374Example response:
5375
5376~~~
5377{
5378  "jsonrpc": "2.0",
5379  "id": 1,
5380  "result": [
5381    {
5382      "cntlid": 1,
5383      "qid": 0,
5384      "state": "active",
5385      "listen_address": {
5386        "trtype": "RDMA",
5387        "adrfam": "IPv4",
5388        "traddr": "192.168.0.123",
5389        "trsvcid": "4420"
5390      }
5391    },
5392    {
5393      "cntlid": 1,
5394      "qid": 1,
5395      "state": "active",
5396      "listen_address": {
5397        "trtype": "RDMA",
5398        "adrfam": "IPv4",
5399        "traddr": "192.168.0.123",
5400        "trsvcid": "4420"
5401      }
5402    }
5403  ]
5404}
5405~~~
5406
5407## nvmf_subsystem_get_listeners {#rpc_nvmf_subsystem_get_listeners}
5408
5409### Parameters
5410
5411Name                    | Optional | Type        | Description
5412----------------------- | -------- | ----------- | -----------
5413nqn                     | Required | string      | Subsystem NQN
5414tgt_name                | Optional | string      | Parent NVMe-oF target name.
5415
5416### Example
5417
5418Example request:
5419
5420~~~
5421{
5422  "jsonrpc": "2.0",
5423  "id": 1,
5424  "method": "nvmf_subsystem_get_listeners",
5425  "params": {
5426    "nqn": "nqn.2016-06.io.spdk:cnode1"
5427  }
5428}
5429~~~
5430
5431Example response:
5432
5433~~~
5434{
5435  "jsonrpc": "2.0",
5436  "id": 1,
5437  "result": [
5438    {
5439      "address": {
5440        "trtype": "RDMA",
5441        "adrfam": "IPv4",
5442        "traddr": "192.168.0.123",
5443        "trsvcid": "4420"
5444      },
5445      "ana_state": "optimized"
5446    }
5447  ]
5448}
5449~~~
5450
5451## nvmf_set_max_subsystems {#rpc_nvmf_set_max_subsystems}
5452
5453Set the maximum allowed subsystems for the NVMe-oF target.  This RPC may only be called
5454before SPDK subsystems have been initialized.
5455
5456### Parameters
5457
5458Name                    | Optional | Type        | Description
5459----------------------- | -------- | ----------- | -----------
5460max_subsystems          | Required | number      | Maximum number of NVMe-oF subsystems
5461
5462### Example
5463
5464Example request:
5465
5466~~~
5467{
5468  "jsonrpc": "2.0",
5469  "id": 1,
5470  "method": "nvmf_set_max_subsystems",
5471  "params": {
5472    "max_subsystems": 1024
5473  }
5474}
5475~~~
5476
5477Example response:
5478
5479~~~
5480{
5481  "jsonrpc": "2.0",
5482  "id": 1,
5483  "result": true
5484}
5485~~~
5486
5487## nvmf_set_config {#rpc_nvmf_set_config}
5488
5489Set global configuration of NVMe-oF target.  This RPC may only be called before SPDK subsystems
5490have been initialized.
5491
5492### Parameters
5493
5494Name                    | Optional | Type        | Description
5495----------------------- | -------- | ----------- | -----------
5496acceptor_poll_rate      | Optional | number      | Polling interval of the acceptor for incoming connections (microseconds)
5497admin_cmd_passthru      | Optional | object      | Admin command passthru configuration
5498
5499### admin_cmd_passthru {#spdk_nvmf_admin_passthru_conf}
5500
5501Name                    | Optional | Type        | Description
5502----------------------- | -------- | ----------- | -----------
5503identify_ctrlr          | Required | bool        | If true, enables custom identify handler that reports some identify attributes from the underlying NVMe drive
5504
5505### Example
5506
5507Example request:
5508
5509~~~
5510{
5511  "jsonrpc": "2.0",
5512  "id": 1,
5513  "method": "nvmf_set_config",
5514  "params": {
5515    "acceptor_poll_rate": 10000
5516  }
5517}
5518~~~
5519
5520Example response:
5521
5522~~~
5523{
5524  "jsonrpc": "2.0",
5525  "id": 1,
5526  "result": true
5527}
5528~~~
5529
5530## nvmf_get_transports method {#rpc_nvmf_get_transports}
5531
5532### Parameters
5533
5534Name                        | Optional | Type        | Description
5535--------------------------- | -------- | ------------| -----------
5536tgt_name                    | Optional | string      | Parent NVMe-oF target name.
5537
5538### Example
5539
5540Example request:
5541
5542~~~
5543{
5544  "jsonrpc": "2.0",
5545  "id": 1,
5546  "method": "nvmf_get_transports"
5547}
5548~~~
5549
5550Example response:
5551
5552~~~
5553{
5554  "jsonrpc": "2.0",
5555  "id": 1,
5556  "result": [
5557    {
5558      "type": "RDMA".
5559      "max_queue_depth": 128,
5560      "max_io_qpairs_per_ctrlr": 64,
5561      "in_capsule_data_size": 4096,
5562      "max_io_size": 131072,
5563      "io_unit_size": 131072,
5564      "abort_timeout_sec": 1
5565    }
5566  ]
5567}
5568~~~
5569
5570## nvmf_get_stats method {#rpc_nvmf_get_stats}
5571
5572Retrieve current statistics of the NVMf subsystem.
5573
5574### Parameters
5575
5576Name                        | Optional | Type        | Description
5577--------------------------- | -------- | ------------| -----------
5578tgt_name                    | Optional | string      | Parent NVMe-oF target name.
5579
5580### Response
5581
5582The response is an object containing NVMf subsystem statistics.
5583
5584### Example
5585
5586Example request:
5587~~~
5588{
5589  "jsonrpc": "2.0",
5590  "method": "nvmf_get_stats",
5591  "id": 1
5592}
5593~~~
5594
5595Example response:
5596~~~
5597{
5598  "jsonrpc": "2.0",
5599  "id": 1,
5600  "result": {
5601    "tick_rate": 2400000000,
5602    "poll_groups": [
5603      {
5604        "name": "app_thread",
5605        "admin_qpairs": 1,
5606        "io_qpairs": 4,
5607        "pending_bdev_io": 1721,
5608        "transports": [
5609          {
5610            "trtype": "RDMA",
5611            "pending_data_buffer": 12131888,
5612            "devices": [
5613              {
5614                "name": "mlx5_1",
5615                "polls": 72284105,
5616                "completions": 0,
5617                "requests": 0,
5618                "request_latency": 0,
5619                "pending_free_request": 0,
5620                "pending_rdma_read": 0,
5621                "pending_rdma_write": 0
5622              },
5623              {
5624                "name": "mlx5_0",
5625                "polls": 72284105,
5626                "completions": 15165875,
5627                "requests": 7582935,
5628                "request_latency": 1249323766184,
5629                "pending_free_request": 0,
5630                "pending_rdma_read": 337602,
5631                "pending_rdma_write": 0
5632              }
5633            ]
5634          }
5635        ]
5636      }
5637    ]
5638  }
5639}
5640~~~
5641
5642# Vhost Target {#jsonrpc_components_vhost_tgt}
5643
5644The following common preconditions need to be met in all target types.
5645
5646Controller name will be used to create UNIX domain socket. This implies that name concatenated with vhost socket
5647directory path needs to be valid UNIX socket name.
5648
5649@ref cpu_mask parameter is used to choose CPU on which pollers will be launched when new initiator is connecting.
5650It must be a subset of application CPU mask. Default value is CPU mask of the application.
5651
5652## vhost_controller_set_coalescing {#rpc_vhost_controller_set_coalescing}
5653
5654Controls interrupt coalescing for specific target. Because `delay_base_us` is used to calculate delay in CPU ticks
5655there is no hardcoded limit for this parameter. Only limitation is that final delay in CPU ticks might not overflow
565632 bit unsigned integer (which is more than 1s @ 4GHz CPU). In real scenarios `delay_base_us` should be much lower
5657than 150us. To disable coalescing set `delay_base_us` to 0.
5658
5659### Parameters
5660
5661Name                    | Optional | Type        | Description
5662----------------------- | -------- | ----------- | -----------
5663ctrlr                   | Required | string      | Controller name
5664delay_base_us           | Required | number      | Base (minimum) coalescing time in microseconds
5665iops_threshold          | Required | number      | Coalescing activation level greater than 0 in IO per second
5666
5667### Example
5668
5669Example request:
5670
5671~~~
5672{
5673  "params": {
5674    "iops_threshold": 100000,
5675    "ctrlr": "VhostScsi0",
5676    "delay_base_us": 80
5677  },
5678  "jsonrpc": "2.0",
5679  "method": "vhost_controller_set_coalescing",
5680  "id": 1
5681}
5682~~~
5683
5684Example response:
5685
5686~~~
5687{
5688  "jsonrpc": "2.0",
5689  "id": 1,
5690  "result": true
5691}
5692~~~
5693
5694## vhost_create_scsi_controller {#rpc_vhost_create_scsi_controller}
5695
5696Construct vhost SCSI target.
5697
5698### Parameters
5699
5700Name                    | Optional | Type        | Description
5701----------------------- | -------- | ----------- | -----------
5702ctrlr                   | Required | string      | Controller name
5703cpumask                 | Optional | string      | @ref cpu_mask for this controller
5704
5705### Example
5706
5707Example request:
5708
5709~~~
5710{
5711  "params": {
5712    "cpumask": "0x2",
5713    "ctrlr": "VhostScsi0"
5714  },
5715  "jsonrpc": "2.0",
5716  "method": "vhost_create_scsi_controller",
5717  "id": 1
5718}
5719~~~
5720
5721Example response:
5722
5723~~~
5724{
5725  "jsonrpc": "2.0",
5726  "id": 1,
5727  "result": true
5728}
5729~~~
5730
5731## vhost_scsi_controller_add_target {#rpc_vhost_scsi_controller_add_target}
5732
5733In vhost target `ctrlr` create SCSI target with ID `scsi_target_num` and add `bdev_name` as LUN 0.
5734
5735### Parameters
5736
5737Name                    | Optional | Type        | Description
5738----------------------- | -------- | ----------- | -----------
5739ctrlr                   | Required | string      | Controller name
5740scsi_target_num         | Required | number      | SCSI target ID between 0 and 7 or -1 to use first free ID.
5741bdev_name               | Required | string      | Name of bdev to expose as a LUN 0
5742
5743### Response
5744
5745SCSI target ID.
5746
5747### Example
5748
5749Example request:
5750
5751~~~
5752{
5753  "params": {
5754    "scsi_target_num": 1,
5755    "bdev_name": "Malloc0",
5756    "ctrlr": "VhostScsi0"
5757  },
5758  "jsonrpc": "2.0",
5759  "method": "vhost_scsi_controller_add_target",
5760  "id": 1
5761}
5762~~~
5763
5764Example response:
5765
5766~~~
5767response:
5768{
5769  "jsonrpc": "2.0",
5770  "id": 1,
5771  "result": 1
5772}
5773~~~
5774
5775## vhost_scsi_controller_remove_target {#rpc_vhost_scsi_controller_remove_target}
5776
5777Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`.
5778
5779This method will fail if initiator is connected, but doesn't support hot-remove (the `VIRTIO_SCSI_F_HOTPLUG` is not negotiated).
5780
5781### Parameters
5782
5783Name                    | Optional | Type        | Description
5784----------------------- | -------- | ----------- | -----------
5785ctrlr                   | Required | string      | Controller name
5786scsi_target_num         | Required | number      | SCSI target ID between 0 and 7
5787
5788### Example
5789
5790Example request:
5791
5792~~~
5793request:
5794{
5795  "params": {
5796    "scsi_target_num": 1,
5797    "ctrlr": "VhostScsi0"
5798  },
5799  "jsonrpc": "2.0",
5800  "method": "vhost_scsi_controller_remove_target",
5801  "id": 1
5802}
5803~~~
5804
5805Example response:
5806
5807~~~
5808{
5809  "jsonrpc": "2.0",
5810  "id": 1,
5811  "result": true
5812}
5813~~~
5814
5815## vhost_create_blk_controller {#rpc_vhost_create_blk_controller}
5816
5817Create vhost block controller
5818
5819If `readonly` is `true` then vhost block target will be created as read only and fail any write requests.
5820The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator.
5821
5822### Parameters
5823
5824Name                    | Optional | Type        | Description
5825----------------------- | -------- | ----------- | -----------
5826ctrlr                   | Required | string      | Controller name
5827bdev_name               | Required | string      | Name of bdev to expose block device
5828readonly                | Optional | boolean     | If true, this target will be read only (default: false)
5829cpumask                 | Optional | string      | @ref cpu_mask for this controller
5830
5831### Example
5832
5833Example request:
5834
5835~~~
5836{
5837  "params": {
5838    "dev_name": "Malloc0",
5839    "ctrlr": "VhostBlk0"
5840  },
5841  "jsonrpc": "2.0",
5842  "method": "vhost_create_blk_controller",
5843  "id": 1
5844}
5845~~~
5846
5847Example response:
5848
5849~~~
5850{
5851  "jsonrpc": "2.0",
5852  "id": 1,
5853  "result": true
5854}
5855~~~
5856
5857## vhost_get_controllers {#rpc_vhost_get_controllers}
5858
5859Display information about all or specific vhost controller(s).
5860
5861### Parameters
5862
5863The user may specify no parameters in order to list all controllers, or a controller may be
5864specified by name.
5865
5866Name                    | Optional | Type        | Description
5867----------------------- | -------- | ----------- | -----------
5868name                    | Optional | string      | Vhost controller name
5869
5870### Response {#rpc_vhost_get_controllers_response}
5871
5872Response is an array of objects describing requested controller(s). Common fields are:
5873
5874Name                    | Type        | Description
5875----------------------- | ----------- | -----------
5876ctrlr                   | string      | Controller name
5877cpumask                 | string      | @ref cpu_mask of this controller
5878delay_base_us           | number      | Base (minimum) coalescing time in microseconds (0 if disabled)
5879iops_threshold          | number      | Coalescing activation level
5880backend_specific        | object      | Backend specific informations
5881
5882### Vhost block {#rpc_vhost_get_controllers_blk}
5883
5884`backend_specific` contains one `block` object  of type:
5885
5886Name                    | Type        | Description
5887----------------------- | ----------- | -----------
5888bdev                    | string      | Backing bdev name or Null if bdev is hot-removed
5889readonly                | boolean     | True if controllers is readonly, false otherwise
5890
5891### Vhost SCSI {#rpc_vhost_get_controllers_scsi}
5892
5893`backend_specific` contains `scsi` array of following objects:
5894
5895Name                    | Type        | Description
5896----------------------- | ----------- | -----------
5897target_name             | string      | Name of this SCSI target
5898id                      | number      | Unique SPDK global SCSI target ID
5899scsi_dev_num            | number      | SCSI target ID initiator will see when scanning this controller
5900luns                    | array       | array of objects describing @ref rpc_vhost_get_controllers_scsi_luns
5901
5902### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns}
5903
5904Object of type:
5905
5906Name                    | Type        | Description
5907----------------------- | ----------- | -----------
5908id                      | number      | SCSI LUN ID
5909bdev_name               | string      | Backing bdev name
5910
5911### Vhost NVMe {#rpc_vhost_get_controllers_nvme}
5912
5913`backend_specific` contains `namespaces` array of following objects:
5914
5915Name                    | Type        | Description
5916----------------------- | ----------- | -----------
5917nsid                    | number      | Namespace ID
5918bdev                    | string      | Backing bdev name
5919
5920### Example
5921
5922Example request:
5923
5924~~~
5925{
5926  "jsonrpc": "2.0",
5927  "method": "vhost_get_controllers",
5928  "id": 1
5929}
5930~~~
5931
5932Example response:
5933
5934~~~
5935{
5936  "jsonrpc": "2.0",
5937  "id": 1,
5938  "result": [
5939    {
5940      "cpumask": "0x2",
5941      "backend_specific": {
5942        "block": {
5943          "readonly": false,
5944          "bdev": "Malloc0"
5945        }
5946      },
5947      "iops_threshold": 60000,
5948      "ctrlr": "VhostBlk0",
5949      "delay_base_us": 100
5950    },
5951    {
5952      "cpumask": "0x2",
5953      "backend_specific": {
5954        "scsi": [
5955          {
5956            "target_name": "Target 2",
5957            "luns": [
5958              {
5959                "id": 0,
5960                "bdev_name": "Malloc1"
5961              }
5962            ],
5963            "id": 0,
5964            "scsi_dev_num": 2
5965          },
5966          {
5967            "target_name": "Target 5",
5968            "luns": [
5969              {
5970                "id": 0,
5971                "bdev_name": "Malloc2"
5972              }
5973            ],
5974            "id": 1,
5975            "scsi_dev_num": 5
5976          }
5977        ]
5978      },
5979      "iops_threshold": 60000,
5980      "ctrlr": "VhostScsi0",
5981      "delay_base_us": 0
5982    },
5983    {
5984      "cpumask": "0x2",
5985      "backend_specific": {
5986        "namespaces": [
5987          {
5988            "bdev": "Malloc3",
5989            "nsid": 1
5990          },
5991          {
5992            "bdev": "Malloc4",
5993            "nsid": 2
5994          }
5995        ]
5996      },
5997      "iops_threshold": 60000,
5998      "ctrlr": "VhostNvme0",
5999      "delay_base_us": 0
6000    }
6001  ]
6002}
6003~~~
6004
6005## vhost_delete_controller {#rpc_vhost_delete_controller}
6006
6007Remove vhost target.
6008
6009This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of
6010vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_vhost_scsi_controller_remove_target.
6011
6012### Parameters
6013
6014Name                    | Optional | Type        | Description
6015----------------------- | -------- | ----------- | -----------
6016ctrlr                   | Required | string      | Controller name
6017
6018### Example
6019
6020Example request:
6021
6022~~~
6023{
6024  "params": {
6025    "ctrlr": "VhostNvme0"
6026  },
6027  "jsonrpc": "2.0",
6028  "method": "vhost_delete_controller",
6029  "id": 1
6030}
6031~~~
6032
6033Example response:
6034
6035~~~
6036{
6037  "jsonrpc": "2.0",
6038  "id": 1,
6039  "result": true
6040}
6041~~~
6042
6043# Logical Volume {#jsonrpc_components_lvol}
6044
6045Identification of logical volume store and logical volume is explained first.
6046
6047A logical volume store has a UUID and a name for its identification.
6048The UUID is generated on creation and it can be used as a unique identifier.
6049The name is specified on creation and can be renamed.
6050Either UUID or name is used to access logical volume store in RPCs.
6051
6052A logical volume has a UUID and a name for its identification.
6053The UUID of the logical volume is generated on creation and it can be unique identifier.
6054The alias of the logical volume takes the format _lvs_name/lvol_name_ where:
6055
6056* _lvs_name_ is the name of the logical volume store.
6057* _lvol_name_ is specified on creation and can be renamed.
6058
6059## bdev_lvol_create_lvstore {#rpc_bdev_lvol_create_lvstore}
6060
6061Construct a logical volume store.
6062
6063### Parameters
6064
6065Name                    | Optional | Type        | Description
6066----------------------- | -------- | ----------- | -----------
6067bdev_name               | Required | string      | Bdev on which to construct logical volume store
6068lvs_name                | Required | string      | Name of the logical volume store to create
6069cluster_sz              | Optional | number      | Cluster size of the logical volume store in bytes
6070clear_method            | Optional | string      | Change clear method for data region. Available: none, unmap (default), write_zeroes
6071
6072### Response
6073
6074UUID of the created logical volume store is returned.
6075
6076### Example
6077
6078Example request:
6079
6080~~~
6081{
6082  "jsonrpc": "2.0",
6083  "id": 1,
6084  "method": "bdev_lvol_create_lvstore",
6085  "params": {
6086    "lvs_name": "LVS0",
6087    "bdev_name": "Malloc0"
6088    "clear_method": "write_zeroes"
6089  }
6090}
6091~~~
6092
6093Example response:
6094
6095~~~
6096{
6097  "jsonrpc": "2.0",
6098  "id": 1,
6099  "result": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
6100}
6101~~~
6102
6103## bdev_lvol_delete_lvstore {#rpc_bdev_lvol_delete_lvstore}
6104
6105Destroy a logical volume store.
6106
6107### Parameters
6108
6109Name                    | Optional | Type        | Description
6110----------------------- | -------- | ----------- | -----------
6111uuid                    | Optional | string      | UUID of the logical volume store to destroy
6112lvs_name                | Optional | string      | Name of the logical volume store to destroy
6113
6114Either uuid or lvs_name must be specified, but not both.
6115
6116### Example
6117
6118Example request:
6119
6120~~~
6121{
6122  "jsonrpc": "2.0",
6123  "method": "bdev_lvol_delete_lvstore",
6124  "id": 1
6125  "params": {
6126    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
6127  }
6128}
6129~~~
6130
6131Example response:
6132
6133~~~
6134{
6135  "jsonrpc": "2.0",
6136  "id": 1,
6137  "result": true
6138}
6139~~~
6140
6141## bdev_lvol_get_lvstores {#rpc_bdev_lvol_get_lvstores}
6142
6143Get a list of logical volume stores.
6144
6145### Parameters
6146
6147Name                    | Optional | Type        | Description
6148----------------------- | -------- | ----------- | -----------
6149uuid                    | Optional | string      | UUID of the logical volume store to retrieve information about
6150lvs_name                | Optional | string      | Name of the logical volume store to retrieve information about
6151
6152Either uuid or lvs_name may be specified, but not both.
6153If both uuid and lvs_name are omitted, information about all logical volume stores is returned.
6154
6155### Example
6156
6157Example request:
6158
6159~~~
6160{
6161  "jsonrpc": "2.0",
6162  "method": "bdev_lvol_get_lvstores",
6163  "id": 1,
6164  "params": {
6165    "lvs_name": "LVS0"
6166  }
6167}
6168~~~
6169
6170Example response:
6171
6172~~~
6173{
6174  "jsonrpc": "2.0",
6175  "id": 1,
6176  "result": [
6177    {
6178      "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5",
6179      "base_bdev": "Malloc0",
6180      "free_clusters": 31,
6181      "cluster_size": 4194304,
6182      "total_data_clusters": 31,
6183      "block_size": 4096,
6184      "name": "LVS0"
6185    }
6186  ]
6187}
6188~~~
6189
6190## bdev_lvol_rename_lvstore {#rpc_bdev_lvol_rename_lvstore}
6191
6192Rename a logical volume store.
6193
6194### Parameters
6195
6196Name                    | Optional | Type        | Description
6197----------------------- | -------- | ----------- | -----------
6198old_name                | Required | string      | Existing logical volume store name
6199new_name                | Required | string      | New logical volume store name
6200
6201### Example
6202
6203Example request:
6204
6205~~~
6206{
6207  "jsonrpc": "2.0",
6208  "method": "bdev_lvol_rename_lvstore",
6209  "id": 1,
6210  "params": {
6211    "old_name": "LVS0",
6212    "new_name": "LVS2"
6213  }
6214}
6215~~~
6216
6217Example response:
6218
6219~~~
6220{
6221  "jsonrpc": "2.0",
6222  "id": 1,
6223  "result": true
6224}
6225~~~
6226
6227## bdev_lvol_create {#rpc_bdev_lvol_create}
6228
6229Create a logical volume on a logical volume store.
6230
6231### Parameters
6232
6233Name                    | Optional | Type        | Description
6234----------------------- | -------- | ----------- | -----------
6235lvol_name               | Required | string      | Name of logical volume to create
6236size                    | Required | number      | Desired size of logical volume in bytes
6237thin_provision          | Optional | boolean     | True to enable thin provisioning
6238uuid                    | Optional | string      | UUID of logical volume store to create logical volume on
6239lvs_name                | Optional | string      | Name of logical volume store to create logical volume on
6240clear_method            | Optional | string      | Change default data clusters clear method. Available: none, unmap, write_zeroes
6241
6242Size will be rounded up to a multiple of cluster size. Either uuid or lvs_name must be specified, but not both.
6243lvol_name will be used in the alias of the created logical volume.
6244
6245### Response
6246
6247UUID of the created logical volume is returned.
6248
6249### Example
6250
6251Example request:
6252
6253~~~
6254{
6255  "jsonrpc": "2.0",
6256  "method": "bdev_lvol_create",
6257  "id": 1,
6258  "params": {
6259    "lvol_name": "LVOL0",
6260    "size": 1048576,
6261    "lvs_name": "LVS0",
6262    "clear_method": "unmap",
6263    "thin_provision": true
6264  }
6265}
6266~~~
6267
6268Example response:
6269
6270~~~
6271{
6272  "jsonrpc": "2.0",
6273  "id": 1,
6274  "result": "1b38702c-7f0c-411e-a962-92c6a5a8a602"
6275}
6276~~~
6277
6278## bdev_lvol_snapshot {#rpc_bdev_lvol_snapshot}
6279
6280Capture a snapshot of the current state of a logical volume.
6281
6282### Parameters
6283
6284Name                    | Optional | Type        | Description
6285----------------------- | -------- | ----------- | -----------
6286lvol_name               | Required | string      | UUID or alias of the logical volume to create a snapshot from
6287snapshot_name           | Required | string      | Name for the newly created snapshot
6288
6289### Response
6290
6291UUID of the created logical volume snapshot is returned.
6292
6293### Example
6294
6295Example request:
6296
6297~~~
6298{
6299  "jsonrpc": "2.0",
6300  "method": "bdev_lvol_snapshot",
6301  "id": 1,
6302  "params": {
6303    "lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602",
6304    "snapshot_name": "SNAP1"
6305  }
6306}
6307~~~
6308
6309Example response:
6310
6311~~~
6312{
6313  "jsonrpc": "2.0",
6314  "id": 1,
6315  "result": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670"
6316}
6317~~~
6318
6319## bdev_lvol_clone {#rpc_bdev_lvol_clone}
6320
6321Create a logical volume based on a snapshot.
6322
6323### Parameters
6324
6325Name                    | Optional | Type        | Description
6326----------------------- | -------- | ----------- | -----------
6327snapshot_name           | Required | string      | UUID or alias of the snapshot to clone
6328clone_name              | Required | string      | Name for the logical volume to create
6329
6330### Response
6331
6332UUID of the created logical volume clone is returned.
6333
6334### Example
6335
6336Example request:
6337
6338~~~
6339{
6340  "jsonrpc": "2.0"
6341  "method": "bdev_lvol_clone",
6342  "id": 1,
6343  "params": {
6344    "snapshot_name": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670",
6345    "clone_name": "CLONE1"
6346  }
6347}
6348~~~
6349
6350Example response:
6351
6352~~~
6353{
6354  "jsonrpc": "2.0",
6355  "id": 1,
6356  "result": "8d87fccc-c278-49f0-9d4c-6237951aca09"
6357}
6358~~~
6359
6360## bdev_lvol_rename {#rpc_bdev_lvol_rename}
6361
6362Rename a logical volume. New name will rename only the alias of the logical volume.
6363
6364### Parameters
6365
6366Name                    | Optional | Type        | Description
6367----------------------- | -------- | ----------- | -----------
6368old_name                | Required | string      | UUID or alias of the existing logical volume
6369new_name                | Required | string      | New logical volume name
6370
6371### Example
6372
6373Example request:
6374
6375~~~
6376{
6377  "jsonrpc": "2.0",
6378  "method": "bdev_lvol_rename",
6379  "id": 1,
6380  "params": {
6381    "old_name": "067df606-6dbc-4143-a499-0d05855cb3b8",
6382    "new_name": "LVOL2"
6383  }
6384}
6385~~~
6386
6387Example response:
6388
6389~~~
6390{
6391  "jsonrpc": "2.0",
6392  "id": 1,
6393  "result": true
6394}
6395~~~
6396
6397## bdev_lvol_resize {#rpc_bdev_lvol_resize}
6398
6399Resize a logical volume.
6400
6401### Parameters
6402
6403Name                    | Optional | Type        | Description
6404----------------------- | -------- | ----------- | -----------
6405name                    | Required | string      | UUID or alias of the logical volume to resize
6406size                    | Required | number      | Desired size of the logical volume in bytes
6407
6408### Example
6409
6410Example request:
6411
6412~~~
6413{
6414  "jsonrpc": "2.0",
6415  "method": "bdev_lvol_resize",
6416  "id": 1,
6417  "params": {
6418    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
6419    "size": 2097152
6420  }
6421}
6422~~~
6423
6424Example response:
6425
6426~~~
6427{
6428  "jsonrpc": "2.0",
6429  "id": 1,
6430  "result": true
6431}
6432~~~
6433
6434## bdev_lvol_set_read_only{#rpc_bdev_lvol_set_read_only}
6435
6436Mark logical volume as read only.
6437
6438### Parameters
6439
6440Name                    | Optional | Type        | Description
6441----------------------- | -------- | ----------- | -----------
6442name                    | Required | string      | UUID or alias of the logical volume to set as read only
6443
6444### Example
6445
6446Example request:
6447
6448~~~
6449{
6450  "jsonrpc": "2.0",
6451  "method": "bdev_lvol_set_read_only",
6452  "id": 1,
6453  "params": {
6454    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
6455  }
6456}
6457~~~
6458
6459Example response:
6460
6461~~~
6462{
6463  "jsonrpc": "2.0",
6464  "id": 1,
6465  "result": true
6466}
6467~~~
6468
6469## bdev_lvol_delete {#rpc_bdev_lvol_delete}
6470
6471Destroy a logical volume.
6472
6473### Parameters
6474
6475Name                    | Optional | Type        | Description
6476----------------------- | -------- | ----------- | -----------
6477name                    | Required | string      | UUID or alias of the logical volume to destroy
6478
6479### Example
6480
6481Example request:
6482
6483~~~
6484{
6485  "jsonrpc": "2.0",
6486  "method": "bdev_lvol_delete",
6487  "id": 1,
6488  "params": {
6489    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a"
6490  }
6491}
6492~~~
6493
6494Example response:
6495
6496~~~
6497{
6498  "jsonrpc": "2.0",
6499  "id": 1,
6500  "result": true
6501}
6502~~~
6503
6504## bdev_lvol_inflate {#rpc_bdev_lvol_inflate}
6505
6506Inflate 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.
6507
6508### Parameters
6509
6510Name                    | Optional | Type        | Description
6511----------------------- | -------- | ----------- | -----------
6512name                    | Required | string      | UUID or alias of the logical volume to inflate
6513
6514### Example
6515
6516Example request:
6517
6518~~~
6519{
6520  "jsonrpc": "2.0",
6521  "method": "bdev_lvol_inflate",
6522  "id": 1,
6523  "params": {
6524    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
6525  }
6526}
6527~~~
6528
6529Example response:
6530
6531~~~
6532{
6533  "jsonrpc": "2.0",
6534  "id": 1,
6535  "result": true
6536}
6537~~~
6538
6539## bdev_lvol_decouple_parent {#rpc_bdev_lvol_decouple_parent}
6540
6541Decouple 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.
6542
6543### Parameters
6544
6545Name                    | Optional | Type        | Description
6546----------------------- | -------- | ----------- | -----------
6547name                    | Required | string      | UUID or alias of the logical volume to decouple the parent of it
6548
6549### Example
6550
6551Example request:
6552
6553~~~
6554{
6555  "jsonrpc": "2.0",
6556  "method": "bdev_lvol_decouple_parent",
6557  "id": 1.
6558  "params": {
6559    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
6560  }
6561}
6562~~~
6563
6564Example response:
6565
6566~~~
6567{
6568  "jsonrpc": "2.0",
6569  "id": 1,
6570  "result": true
6571}
6572~~~
6573
6574# RAID
6575
6576## bdev_raid_get_bdevs {#rpc_bdev_raid_get_bdevs}
6577
6578This is used to list all the raid bdev names based on the input category requested. Category should be one
6579of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether they are online or
6580configuring or offline. 'online' is the raid bdev which is registered with bdev layer. 'configuring' is
6581the raid bdev which does not have full configuration discovered yet. 'offline' is the raid bdev which is
6582not registered with bdev as of now and it has encountered any error or user has requested to offline
6583the raid bdev.
6584
6585### Parameters
6586
6587Name                    | Optional | Type        | Description
6588----------------------- | -------- | ----------- | -----------
6589category                | Required | string      | all or online or configuring or offline
6590
6591### Example
6592
6593Example request:
6594
6595~~~
6596{
6597  "jsonrpc": "2.0",
6598  "method": "bdev_raid_get_bdevs",
6599  "id": 1,
6600  "params": {
6601    "category": "all"
6602  }
6603}
6604~~~
6605
6606Example response:
6607
6608~~~
6609{
6610  "jsonrpc": "2.0",
6611  "id": 1,
6612  "result": [
6613    "Raid0"
6614  ]
6615}
6616~~~
6617
6618## bdev_raid_create {#rpc_bdev_raid_create}
6619
6620Constructs new RAID bdev.
6621
6622### Parameters
6623
6624Name                    | Optional | Type        | Description
6625----------------------- | -------- | ----------- | -----------
6626name                    | Required | string      | RAID bdev name
6627strip_size_kb           | Required | number      | Strip size in KB
6628raid_level              | Required | string      | RAID level
6629base_bdevs              | Required | string      | Base bdevs name, whitespace separated list in quotes
6630
6631### Example
6632
6633Example request:
6634
6635~~~
6636{
6637  "jsonrpc": "2.0",
6638  "method": "bdev_raid_create",
6639  "id": 1,
6640  "params": {
6641    "name": "Raid0",
6642    "raid_level": "0",
6643    "base_bdevs": [
6644      "Malloc0",
6645      "Malloc1",
6646      "Malloc2",
6647      "Malloc3"
6648    ],
6649    "strip_size": 4096
6650  }
6651}
6652~~~
6653
6654Example response:
6655
6656~~~
6657{
6658  "jsonrpc": "2.0",
6659  "id": 1,
6660  "result": true
6661}
6662~~~
6663
6664## bdev_raid_delete {#rpc_bdev_raid_delete}
6665
6666Removes RAID bdev.
6667
6668### Parameters
6669
6670Name                    | Optional | Type        | Description
6671----------------------- | -------- | ----------- | -----------
6672name                    | Required | string      | RAID bdev name
6673
6674### Example
6675
6676Example request:
6677
6678~~~
6679{
6680  "jsonrpc": "2.0",
6681  "method": "bdev_raid_delete",
6682  "id": 1,
6683  "params": {
6684    "name": "Raid0"
6685  }
6686}
6687~~~
6688
6689Example response:
6690
6691~~~
6692{
6693  "jsonrpc": "2.0",
6694  "id": 1,
6695  "result": true
6696}
6697~~~
6698
6699# OPAL
6700
6701## bdev_nvme_opal_init {#rpc_bdev_nvme_opal_init}
6702
6703This is used to initialize OPAL of a given NVMe ctrlr, including taking ownership and activating.
6704
6705### Parameters
6706
6707Name                    | Optional | Type        | Description
6708----------------------- | -------- | ----------- | -----------
6709nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
6710password                | Required | string      | admin password of OPAL
6711
6712### Example
6713
6714Example request:
6715
6716~~~
6717{
6718  "jsonrpc": "2.0",
6719  "method": "bdev_nvme_opal_init",
6720  "id": 1,
6721  "params": {
6722    "nvme_ctrlr_name": "nvme0",
6723    "password": "*****"
6724  }
6725}
6726~~~
6727
6728Example response:
6729
6730~~~
6731{
6732  "jsonrpc": "2.0",
6733  "id": 1,
6734  "result": true
6735}
6736~~~
6737
6738## bdev_nvme_opal_revert {#rpc_bdev_nvme_opal_revert}
6739
6740This is used to revert OPAL to its factory settings. Erase all user configuration and data.
6741
6742### Parameters
6743
6744Name                    | Optional | Type        | Description
6745----------------------- | -------- | ----------- | -----------
6746nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
6747password                | Required | string      | admin password of OPAL
6748
6749### Example
6750
6751Example request:
6752
6753~~~
6754{
6755  "jsonrpc": "2.0",
6756  "method": "bdev_nvme_opal_revert",
6757  "id": 1,
6758  "params": {
6759    "nvme_ctrlr_name": "nvme0",
6760    "password": "*****"
6761  }
6762}
6763~~~
6764
6765Example response:
6766
6767~~~
6768{
6769  "jsonrpc": "2.0",
6770  "id": 1,
6771  "result": true
6772}
6773~~~
6774
6775## bdev_opal_create {#rpc_bdev_opal_create}
6776
6777This is used to create an OPAL virtual bdev.
6778
6779### Parameters
6780
6781Name                    | Optional | Type        | Description
6782----------------------- | -------- | ----------- | -----------
6783nvme_ctrlr_name         | Required | string      | name of nvme ctrlr that supports OPAL
6784nsid                    | Required | number      | namespace ID
6785locking_range_id        | Required | number      | OPAL locking range ID
6786range_start             | Required | number      | locking range start LBA
6787range_length            | Required | number      | locking range length
6788password                | Required | string      | admin password of OPAL
6789
6790### Response
6791
6792The response is the name of created OPAL virtual bdev.
6793
6794### Example
6795
6796Example request:
6797
6798~~~
6799{
6800  "jsonrpc": "2.0",
6801  "method": "bdev_opal_create",
6802  "id": 1,
6803  "params": {
6804    "nvme_ctrlr_name": "nvme0",
6805    "nsid": 1,
6806    "locking_range_id": 1,
6807    "range_start": 0,
6808    "range_length": 4096,
6809    "password": "*****"
6810  }
6811}
6812~~~
6813
6814Example response:
6815
6816~~~
6817{
6818  "jsonrpc": "2.0",
6819  "id": 1,
6820  "result": "nvme0n1r1"
6821}
6822~~~
6823
6824## bdev_opal_get_info {#rpc_bdev_opal_get_info}
6825
6826This is used to get information of a given OPAL bdev.
6827
6828### Parameters
6829
6830Name                    | Optional | Type        | Description
6831----------------------- | -------- | ----------- | -----------
6832bdev_name               | Required | string      | name of OPAL vbdev
6833password                | Required | string      | admin password
6834
6835### Response
6836
6837The response is the locking info of OPAL virtual bdev.
6838
6839### Example
6840
6841Example request:
6842
6843~~~
6844{
6845  "jsonrpc": "2.0",
6846  "method": "bdev_opal_get_info",
6847  "id": 1,
6848  "params": {
6849    "bdev_name": "nvme0n1r1",
6850    "password": "*****"
6851  }
6852}
6853~~~
6854
6855Example response:
6856
6857~~~
6858{
6859  "jsonrpc": "2.0",
6860  "id": 1,
6861  "result": {
6862      "name": "nvme0n1r1",
6863      "range_start": 0,
6864      "range_length": 4096,
6865      "read_lock_enabled": true,
6866      "write_lock_enabled": true,
6867      "read_locked": false,
6868      "write_locked": false
6869    }
6870}
6871~~~
6872
6873## bdev_opal_delete {#rpc_bdev_opal_delete}
6874
6875This is used to delete OPAL vbdev.
6876
6877### Parameters
6878
6879Name                    | Optional | Type        | Description
6880----------------------- | -------- | ----------- | -----------
6881bdev_name               | Required | string      | name of OPAL vbdev
6882password                | Required | string      | admin password
6883
6884### Example
6885
6886Example request:
6887
6888~~~
6889{
6890  "jsonrpc": "2.0",
6891  "method": "bdev_opal_delete",
6892  "id": 1,
6893  "params": {
6894    "bdev_name": "nvme0n1r1",
6895    "password": "*****"
6896  }
6897}
6898~~~
6899
6900Example response:
6901
6902~~~
6903{
6904  "jsonrpc": "2.0",
6905  "id": 1,
6906  "result": true
6907}
6908~~~
6909
6910## bdev_opal_new_user {#rpc_bdev_opal_new_user}
6911
6912This enables a new user to the specified opal bdev so that the user can lock/unlock the bdev.
6913Recalling this for the same opal bdev, only the newest user will have the privilege.
6914
6915### Parameters
6916
6917Name                    | Optional | Type        | Description
6918----------------------- | -------- | ----------- | -----------
6919bdev_name               | Required | string      | name of OPAL vbdev
6920admin_password          | Required | string      | admin password
6921user_id                 | Required | number      | user ID
6922user_password           | Required | string      | user password
6923
6924### Example
6925
6926Example request:
6927
6928~~~
6929{
6930  "jsonrpc": "2.0",
6931  "method": "bdev_opal_new_user",
6932  "id": 1,
6933  "params": {
6934    "bdev_name": "nvme0n1r1",
6935    "admin_password": "*****",
6936    "user_id": "1",
6937    "user_password": "********"
6938  }
6939}
6940~~~
6941
6942Example response:
6943
6944~~~
6945{
6946  "jsonrpc": "2.0",
6947  "id": 1,
6948  "result": true
6949}
6950~~~
6951
6952## bdev_opal_set_lock_state {#rpc_bdev_opal_set_lock_state}
6953
6954This is used to lock/unlock specific opal bdev providing user ID and password.
6955
6956### Parameters
6957
6958Name                    | Optional | Type        | Description
6959----------------------- | -------- | ----------- | -----------
6960bdev_name               | Required | string      | name of OPAL vbdev
6961user_id                 | Required | number      | user ID
6962password                | Required | string      | user password
6963lock_state              | Required | string      | lock state
6964
6965### Example
6966
6967Example request:
6968
6969~~~
6970{
6971  "jsonrpc": "2.0",
6972  "method": "bdev_opal_set_lock_state",
6973  "id": 1,
6974  "params": {
6975    "bdev_name": "nvme0n1r1",
6976    "user_id": "1",
6977    "user_password": "********",
6978    "lock_state": "rwlock"
6979  }
6980}
6981~~~
6982
6983Example response:
6984
6985~~~
6986{
6987  "jsonrpc": "2.0",
6988  "id": 1,
6989  "result": true
6990}
6991~~~
6992
6993# Notifications
6994
6995## notify_get_types {#rpc_notify_get_types}
6996
6997Return list of all supported notification types.
6998
6999### Parameters
7000
7001None
7002
7003### Response
7004
7005The response is an array of strings - supported RPC notification types.
7006
7007### Example
7008
7009Example request:
7010
7011~~~
7012{
7013  "jsonrpc": "2.0",
7014  "method": "notify_get_types",
7015  "id": 1
7016}
7017~~~
7018
7019Example response:
7020
7021~~~
7022{
7023  "id": 1,
7024  "result": [
7025    "bdev_register",
7026    "bdev_unregister"
7027  ],
7028  "jsonrpc": "2.0"
7029}
7030~~~
7031
7032## notify_get_notifications {#notify_get_notifications}
7033
7034Request notifications. Returns array of notifications that happend since the specified id (or first that is available).
7035
7036Notice: Notifications are kept in circular buffer with limited size. Older notifications might be inaccesible due to being overwritten by new ones.
7037
7038### Parameters
7039
7040Name                    | Optional | Type        | Description
7041----------------------- | -------- | ----------- | -----------
7042id                      | Optional | number      | First Event ID to fetch (default: first available).
7043max                     | Optional | number      | Maximum number of event to return (default: no limit).
7044
7045### Response
7046
7047Response is an array of event objects.
7048
7049Name                    | Optional | Type        | Description
7050----------------------- | -------- | ----------- | -----------
7051id                      | Optional | number      | Event ID.
7052type                    | Optional | number      | Type of the event.
7053ctx                     | Optional | string      | Event context.
7054
7055### Example
7056
7057Example request:
7058
7059~~~
7060{
7061  "id": 1,
7062  "jsonrpc": "2.0",
7063  "method": "notify_get_notifications",
7064  "params": {
7065    "id": 1,
7066    "max": 10
7067  }
7068}
7069
7070~~~
7071
7072Example response:
7073
7074~~~
7075{
7076  "jsonrpc": "2.0",
7077  "id": 1,
7078  "result": [
7079    {
7080      "ctx": "Malloc0",
7081      "type": "bdev_register",
7082      "id": 1
7083    },
7084    {
7085      "ctx": "Malloc2",
7086      "type": "bdev_register",
7087      "id": 2
7088    }
7089  ]
7090}
7091~~~
7092
7093# Linux Network Block Device (NBD) {#jsonrpc_components_nbd}
7094
7095SPDK 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.
7096
7097In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.
7098
7099## nbd_start_disk {#rpc_nbd_start_disk}
7100
7101Start to export one SPDK bdev as NBD disk
7102
7103### Parameters
7104
7105Name                    | Optional | Type        | Description
7106----------------------- | -------- | ----------- | -----------
7107bdev_name               | Required | string      | Bdev name to export
7108nbd_device              | Optional | string      | NBD device name to assign
7109
7110### Response
7111
7112Path of exported NBD disk
7113
7114### Example
7115
7116Example request:
7117
7118~~~
7119{
7120 "params": {
7121    "nbd_device": "/dev/nbd1",
7122    "bdev_name": "Malloc1"
7123  },
7124  "jsonrpc": "2.0",
7125  "method": "nbd_start_disk",
7126  "id": 1
7127}
7128~~~
7129
7130Example response:
7131
7132~~~
7133{
7134  "jsonrpc": "2.0",
7135  "id": 1,
7136  "result": "/dev/nbd1"
7137}
7138~~~
7139
7140## nbd_stop_disk {#rpc_nbd_stop_disk}
7141
7142Stop one NBD disk which is based on SPDK bdev.
7143
7144### Parameters
7145
7146Name                    | Optional | Type        | Description
7147----------------------- | -------- | ----------- | -----------
7148nbd_device              | Required | string      | NBD device name to stop
7149
7150### Example
7151
7152Example request:
7153
7154~~~
7155{
7156 "params": {
7157    "nbd_device": "/dev/nbd1",
7158  },
7159  "jsonrpc": "2.0",
7160  "method": "nbd_stop_disk",
7161  "id": 1
7162}
7163~~~
7164
7165Example response:
7166
7167~~~
7168{
7169  "jsonrpc": "2.0",
7170  "id": 1,
7171  "result": "true"
7172}
7173~~~
7174
7175## nbd_get_disks {#rpc_nbd_get_disks}
7176
7177Display all or specified NBD device list
7178
7179### Parameters
7180
7181Name                    | Optional | Type        | Description
7182----------------------- | -------- | ----------- | -----------
7183nbd_device              | Optional | string      | NBD device name to display
7184
7185### Response
7186
7187The response is an array of exported NBD devices and their corresponding SPDK bdev.
7188
7189### Example
7190
7191Example request:
7192
7193~~~
7194{
7195  "jsonrpc": "2.0",
7196  "method": "nbd_get_disks",
7197  "id": 1
7198}
7199~~~
7200
7201Example response:
7202
7203~~~
7204{
7205  "jsonrpc": "2.0",
7206  "id": 1,
7207  "result":  [
7208    {
7209      "bdev_name": "Malloc0",
7210      "nbd_device": "/dev/nbd0"
7211    },
7212    {
7213      "bdev_name": "Malloc1",
7214      "nbd_device": "/dev/nbd1"
7215    }
7216  ]
7217}
7218~~~
7219
7220# Blobfs {#jsonrpc_components_blobfs}
7221
7222## blobfs_detect {#rpc_blobfs_detect}
7223
7224Detect whether a blobfs exists on bdev.
7225
7226### Parameters
7227
7228Name                    | Optional | Type        | Description
7229----------------------- | -------- | ----------- | -----------
7230bdev_name               | Required | string      | Block device name to detect blobfs
7231
7232### Response
7233
7234True if a blobfs exists on the bdev; False otherwise.
7235
7236### Example
7237
7238Example request:
7239
7240~~~
7241{
7242  "jsonrpc": "2.0",
7243  "id": 1,
7244  "method": "blobfs_detect",
7245  "params": {
7246    "bdev_name": "Malloc0"
7247  }
7248}
7249~~~
7250
7251Example response:
7252
7253~~~
7254{
7255  "jsonrpc": "2.0",
7256  "id": 1,
7257  "result": "true"
7258}
7259~~~
7260
7261## blobfs_create {#rpc_blobfs_create}
7262
7263Build blobfs on bdev.
7264
7265### Parameters
7266
7267Name                    | Optional | Type        | Description
7268----------------------- | -------- | ----------- | -----------
7269bdev_name               | Required | string      | Block device name to create blobfs
7270cluster_sz              | Optional | number      | Size of cluster in bytes. Must be multiple of 4KiB page size, default and minimal value is 1M.
7271
7272### Example
7273
7274Example request:
7275
7276~~~
7277{
7278  "jsonrpc": "2.0",
7279  "id": 1,
7280  "method": "blobfs_create",
7281  "params": {
7282    "bdev_name": "Malloc0",
7283    "cluster_sz": 1M
7284  }
7285}
7286~~~
7287
7288Example response:
7289
7290~~~
7291{
7292  "jsonrpc": "2.0",
7293  "id": 1,
7294  "result": "true"
7295}
7296~~~
7297
7298## blobfs_mount {#rpc_blobfs_mount}
7299
7300Mount a blobfs on bdev to one host path through FUSE
7301
7302### Parameters
7303
7304Name                    | Optional | Type        | Description
7305----------------------- | -------- | ----------- | -----------
7306bdev_name               | Required | string      | Block device name where the blobfs is
7307mountpoint              | Required | string      | Mountpoint path in host to mount blobfs
7308
7309### Example
7310
7311Example request:
7312
7313~~~
7314{
7315  "jsonrpc": "2.0",
7316  "id": 1,
7317  "method": ""blobfs_mount"",
7318  "params": {
7319    "bdev_name": "Malloc0",
7320    "mountpoint": "/mnt/"
7321  }
7322}
7323~~~
7324
7325Example response:
7326
7327~~~
7328{
7329  "jsonrpc": "2.0",
7330  "id": 1,
7331  "result": "true"
7332}
7333~~~
7334
7335## blobfs_set_cache_size {#rpc_blobfs_set_cache_size}
7336
7337Set cache pool size for blobfs filesystems.  This RPC is only permitted when the cache pool is not already initialized.
7338
7339The 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.
7340
7341### Parameters
7342
7343Name                    | Optional | Type        | Description
7344----------------------- | -------- | ----------- | -----------
7345size_in_mb              | Required | number      | Cache size in megabytes
7346
7347### Response
7348
7349True if cache size is set successfully; False if failed to set.
7350
7351### Example
7352
7353Example request:
7354
7355~~~
7356{
7357  "jsonrpc": "2.0",
7358  "id": 1,
7359  "method": "blobfs_set_cache_size",
7360  "params": {
7361    "size_in_mb": 512,
7362  }
7363}
7364~~~
7365
7366Example response:
7367
7368~~~
7369{
7370  "jsonrpc": "2.0",
7371  "id": 1,
7372  "result": true
7373}
7374~~~
7375
7376# Socket layer {#jsonrpc_components_sock}
7377
7378## sock_impl_get_options {#rpc_sock_impl_get_options}
7379
7380Get parameters for the socket layer implementation.
7381
7382### Parameters
7383
7384Name                    | Optional | Type        | Description
7385----------------------- | -------- | ----------- | -----------
7386impl_name               | Required | string      | Name of socket implementation, e.g. posix
7387
7388### Response
7389
7390Response is an object with current socket layer options for requested implementation.
7391
7392### Example
7393
7394Example request:
7395
7396~~~
7397{
7398  "jsonrpc": "2.0",
7399  "method": "sock_impl_get_options",
7400  "id": 1,
7401  "params": {
7402    "impl_name": "posix"
7403  }
7404}
7405~~~
7406
7407Example response:
7408
7409~~~
7410{
7411  "jsonrpc": "2.0",
7412  "id": 1,
7413  "result": {
7414    "recv_buf_size": 2097152,
7415    "send_buf_size": 2097152,
7416    "enable_recv_pipe": true
7417    "enable_zerocopy_send": true
7418  }
7419}
7420~~~
7421
7422## sock_impl_set_options {#rpc_sock_impl_set_options}
7423
7424Set parameters for the socket layer implementation.
7425
7426### Parameters
7427
7428Name                    | Optional | Type        | Description
7429----------------------- | -------- | ----------- | -----------
7430impl_name               | Required | string      | Name of socket implementation, e.g. posix
7431recv_buf_size           | Optional | number      | Size of socket receive buffer in bytes
7432send_buf_size           | Optional | number      | Size of socket send buffer in bytes
7433enable_recv_pipe        | Optional | boolean     | Enable or disable receive pipe
7434enable_zerocopy_send    | Optional | boolean     | Enable or disable zero copy on send
7435enable_quick_ack        | Optional | boolean     | Enable or disable quick ACK
7436enable_placement_id     | Optional | boolean     | Enable or disable placement_id
7437
7438### Response
7439
7440True if socket layer options were set successfully.
7441
7442### Example
7443
7444Example request:
7445
7446~~~
7447{
7448  "jsonrpc": "2.0",
7449  "method": "sock_impl_set_options",
7450  "id": 1,
7451  "params": {
7452    "impl_name": "posix",
7453    "recv_buf_size": 2097152,
7454    "send_buf_size": 2097152,
7455    "enable_recv_pipe": false,
7456    "enable_zerocopy_send": true,
7457    "enable_quick_ack": false,
7458    "enable_placement_id": false
7459  }
7460}
7461~~~
7462
7463Example response:
7464
7465~~~
7466{
7467  "jsonrpc": "2.0",
7468  "id": 1,
7469  "result": true
7470}
7471~~~
7472
7473## sock_set_default_impl {#rpc_sock_set_default_impl}
7474
7475Set the default sock implementation.
7476
7477### Parameters
7478
7479Name                    | Optional | Type        | Description
7480----------------------- | -------- | ----------- | -----------
7481impl_name               | Required | string      | Name of socket implementation, e.g. posix
7482
7483### Response
7484
7485True if the default socket layer configuration was set successfully.
7486
7487### Example
7488
7489Example request:
7490
7491~~~
7492{
7493  "jsonrpc": "2.0",
7494  "method": "sock_set_default_impl",
7495  "id": 1,
7496  "params": {
7497    "impl_name": "posix"
7498  }
7499}
7500~~~
7501
7502Example response:
7503
7504~~~
7505{
7506  "jsonrpc": "2.0",
7507  "id": 1,
7508  "result": true
7509}
7510~~~
7511
7512# Miscellaneous RPC commands
7513
7514## bdev_nvme_send_cmd {#rpc_bdev_nvme_send_cmd}
7515
7516Send NVMe command directly to NVMe controller or namespace. Parameters and responses encoded by base64 urlsafe need further processing.
7517
7518Notice: 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.
7519
7520### Parameters
7521
7522Name                    | Optional | Type        | Description
7523----------------------- | -------- | ----------- | -----------
7524name                    | Required | string      | Name of the operating NVMe controller
7525cmd_type                | Required | string      | Type of nvme cmd. Valid values are: admin, io
7526data_direction          | Required | string      | Direction of data transfer. Valid values are: c2h, h2c
7527cmdbuf                  | Required | string      | NVMe command encoded by base64 urlsafe
7528data                    | Optional | string      | Data transferring to controller from host, encoded by base64 urlsafe
7529metadata                | Optional | string      | Metadata transferring to controller from host, encoded by base64 urlsafe
7530data_len                | Optional | number      | Data length required to transfer from controller to host
7531metadata_len            | Optional | number      | Metadata length required to transfer from controller to host
7532timeout_ms              | Optional | number      | Command execution timeout value, in milliseconds
7533
7534### Response
7535
7536Name                    | Type        | Description
7537----------------------- | ----------- | -----------
7538cpl                     | string      | NVMe completion queue entry, encoded by base64 urlsafe
7539data                    | string      | Data transferred from controller to host, encoded by base64 urlsafe
7540metadata                | string      | Metadata transferred from controller to host, encoded by base64 urlsafe
7541
7542### Example
7543
7544Example request:
7545
7546~~~
7547{
7548  "jsonrpc": "2.0",
7549  "method": "bdev_nvme_send_cmd",
7550  "id": 1,
7551  "params": {
7552    "name": "Nvme0",
7553    "cmd_type": "admin"
7554    "data_direction": "c2h",
7555    "cmdbuf": "BgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAsGUs9P5_AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
7556    "data_len": 60,
7557  }
7558}
7559~~~
7560
7561Example response:
7562
7563~~~
7564{
7565  "jsonrpc": "2.0",
7566  "id": 1,
7567  "result":  {
7568    "cpl": "AAAAAAAAAAARAAAAWrmwABAA==",
7569    "data": "sIjg6AAAAACwiODoAAAAALCI4OgAAAAAAAYAAREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
7570  }
7571
7572}
7573~~~
7574
7575## spdk_get_version {#rpc_spdk_get_version}
7576
7577Get the version info of the running SPDK application.
7578
7579### Parameters
7580
7581This method has no parameters.
7582
7583### Response
7584
7585The response is the version number including major version number, minor version number, patch level number and suffix string.
7586
7587### Example
7588
7589Example request:
7590~~
7591{
7592  "jsonrpc": "2.0",
7593  "id": 1,
7594  "method": "spdk_get_version"
7595}
7596~~
7597
7598Example response:
7599~~
7600{
7601  "jsonrpc": "2.0",
7602  "id": 1,
7603  "result":  {
7604    "version": "19.04-pre",
7605    "fields" : {
7606      "major": 19,
7607      "minor": 4,
7608      "patch": 0,
7609      "suffix": "-pre"
7610    }
7611  }
7612}
7613~~
7614