xref: /spdk/doc/jsonrpc.md (revision 1a00f5c09488e7466a331b8c75cde4969740357f)
1# JSON-RPC {#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## rpc.py {#rpc_py}
58
59SPDK provides a set of Python scripts which can invoke the JSON-RPC methods described in this document.  'rpc.py' in the scripts
60directory is the main script that users will invoke to execute a JSON-RPC method. The scripts/rpc directory contains modules
61that 'rpc.py' imports for definitions of each SPDK library's or module's methods.
62
63Example:
64
65~~~bash
66scripts/rpc.py bdev_nvme_attach_controller -b nvme0 -a 00:02.0 -t pcie
67~~~
68
69A brief description of each of the RPC methods and optional 'rpc.py' arguments can be viewed with:
70
71~~~bash
72scripts/rpc.py --help
73~~~
74
75A detailed description of each RPC method and its parameters is also available.  For example:
76
77~~~bash
78scripts/rpc.py bdev_nvme_attach_controller --help
79~~~
80
81### Generate JSON-RPC methods for current configuration {#jsonrpc_generate}
82
83An initial configuration can be specified for an SPDK application via the '-c' command line parameter.
84The configuration file is a JSON file containing all of the JSON-RPC method invocations necessary
85for the desired configuration. Writing these files by hand is extremely tedious however, so 'rpc.py'
86provides a mechanism to generate a JSON-RPC file based on the current configuration.
87
88~~~bash
89scripts/rpc.py save_config > config.json
90~~~
91
92'config.json' can then be passed to a new SPDK application using the '-c' command line parameter
93to reproduce the same configuration.
94
95### JSON-RPC batching
96
97'rpc.py' also supports batching of multiple JSON-RPC methods with one invocation.  So instead of
98calling 'rpc.py' once for each JSON-RPC method, such as:
99
100~~~bash
101scripts/rpc.py bdev_malloc_create -b malloc0 64 512
102scripts/rpc.py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a
103scripts/rpc.py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 malloc0
104scripts/rpc.py nvmf_create_transport -t tcp
105scripts/rpc.py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t tcp -a 127.0.0.1 -s 4420
106~~~
107
108you can put the following into a text file:
109
110~~~bash
111bdev_malloc_create -b malloc0 64 512
112nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a
113nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 malloc0
114nvmf_create_transport -t tcp
115nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t tcp -a 127.0.0.1 -s 4420
116~~~
117
118and then just do:
119
120~~~bash
121scripts/rpc.py < rpc.txt
122~~~
123
124### Adding external RPC methods
125
126SPDK includes both in-tree modules as well as the ability to use external modules.  The in-tree modules include some python
127scripts to ease the process of sending RPCs to in-tree modules.  External modules can utilize this same framework to add new RPC
128methods as follows:
129
130If PYTHONPATH doesn't include the location of the external RPC python script, it should be updated:
131
132~~~bash
133export PYTHONPATH=/home/user/plugin_example/
134~~~
135
136In provided location, create python module file (e.g. rpc_plugin.py) with new RPC methods.  The file should contain
137spdk_rpc_plugin_initialize() method that will be called when the plugin is loaded to define new parsers for provided subparsers
138argument that adds new RPC calls (subparsers.add_parser()).  The new parsers should use the client.call() method to call RPC
139functions registered within the external module using the SPDK_RPC_REGISTER() macro.  Example:
140
141~~~python
142from rpc.client import print_json
143
144
145def example_create(client, num_blocks, block_size, name=None, uuid=None):
146    """Construct an example block device.
147
148    Args:
149        num_blocks: size of block device in blocks
150        block_size: block size of device; must be a power of 2 and at least 512
151        name: name of block device (optional)
152        uuid: UUID of block device (optional)
153
154    Returns:
155        Name of created block device.
156    """
157    params = {'num_blocks': num_blocks, 'block_size': block_size}
158    if name:
159        params['name'] = name
160    if uuid:
161        params['uuid'] = uuid
162    return client.call('bdev_example_create', params)
163
164
165def example_delete(client, name):
166    """Delete example block device.
167
168    Args:
169        bdev_name: name of bdev to delete
170    """
171    params = {'name': name}
172    return client.call('bdev_example_delete', params)
173
174
175def spdk_rpc_plugin_initialize(subparsers):
176    def bdev_example_create(args):
177        num_blocks = (args.total_size * 1024 * 1024) // args.block_size
178        print_json(example_create(args.client,
179                                  num_blocks=int(num_blocks),
180                                  block_size=args.block_size,
181                                  name=args.name,
182                                  uuid=args.uuid))
183
184    p = subparsers.add_parser('bdev_example_create',
185                              help='Create an example bdev')
186    p.add_argument('-b', '--name', help="Name of the bdev")
187    p.add_argument('-u', '--uuid', help="UUID of the bdev")
188    p.add_argument(
189        'total_size', help='Size of bdev in MB (float > 0)', type=float)
190    p.add_argument('block_size', help='Block size for this bdev', type=int)
191    p.set_defaults(func=bdev_example_create)
192
193    def bdev_example_delete(args):
194        example_delete(args.client,
195                      name=args.name)
196
197    p = subparsers.add_parser('bdev_example_delete',
198                              help='Delete an example disk')
199    p.add_argument('name', help='example bdev name')
200    p.set_defaults(func=bdev_example_delete)
201~~~
202
203Finally, call the rpc.py script with '--plugin' parameter to provide above python module name:
204
205~~~bash
206./scripts/rpc.py --plugin rpc_plugin bdev_example_create 10 4096
207~~~
208
209### Converting from legacy configuration {#jsonrpc_convert}
210
211Starting with SPDK 20.10, legacy configuration file support has been removed.
212Users with extensive configuration files already running in SPDK application,
213can [generate JSON-RPC for current configuration](@ref jsonrpc_generate).
214
215If binary for deploying the application is unavailable, the legacy configuration
216file can be converted to JSON-RPC using python tool:
217
218~~~bash
219./scripts/config_converter.py < config.ini > config.json
220~~~
221
222## App Framework {#jsonrpc_components_app}
223
224### spdk_kill_instance {#rpc_spdk_kill_instance}
225
226Send a signal to the application.
227
228#### Parameters
229
230Name                    | Optional | Type        | Description
231----------------------- | -------- | ----------- | -----------
232sig_name                | Required | string      | Signal to send (SIGINT, SIGTERM, SIGQUIT, SIGHUP, or SIGKILL)
233
234#### Example
235
236Example request:
237
238~~~json
239{
240  "jsonrpc": "2.0",
241  "id": 1,
242  "method": "spdk_kill_instance",
243  "params": {
244    "sig_name": "SIGINT"
245  }
246}
247~~~
248
249Example response:
250
251~~~json
252{
253  "jsonrpc": "2.0",
254  "id": 1,
255  "result": true
256}
257~~~
258
259### framework_monitor_context_switch {#rpc_framework_monitor_context_switch}
260
261Query, enable, or disable the context switch monitoring functionality.
262
263#### Parameters
264
265Name                    | Optional | Type        | Description
266----------------------- | -------- | ----------- | -----------
267enabled                 | Optional | boolean     | Enable (`true`) or disable (`false`) monitoring (omit this parameter to query the current state)
268
269#### Response
270
271Name                    | Type        | Description
272----------------------- | ----------- | -----------
273enabled                 | boolean     | The current state of context switch monitoring
274
275#### Example
276
277Example request:
278
279~~~json
280{
281  "jsonrpc": "2.0",
282  "id": 1,
283  "method": "framework_monitor_context_switch",
284  "params": {
285    "enabled": false
286  }
287}
288~~~
289
290Example response:
291
292~~~json
293{
294  "jsonrpc": "2.0",
295  "id": 1,
296  "result": {
297    "enabled": false
298  }
299}
300~~~
301
302### framework_start_init {#rpc_framework_start_init}
303
304Start initialization of SPDK subsystems when it is deferred by starting SPDK application with option -w.
305During its deferral some RPCs can be used to set global parameters for SPDK subsystems.
306This RPC can be called only once.
307
308#### Parameters
309
310This method has no parameters.
311
312#### Response
313
314Completion status of SPDK subsystem initialization is returned as a boolean.
315
316#### Example
317
318Example request:
319
320~~~json
321{
322  "jsonrpc": "2.0",
323  "id": 1,
324  "method": "framework_start_init"
325}
326~~~
327
328Example response:
329
330~~~json
331{
332  "jsonrpc": "2.0",
333  "id": 1,
334  "result": true
335}
336~~~
337
338### framework_wait_init {#rpc_framework_wait_init}
339
340Do not return until all subsystems have been initialized and the RPC system state is running.
341If the application is already running, this call will return immediately. This RPC can be called at any time.
342
343#### Parameters
344
345This method has no parameters.
346
347#### Response
348
349Returns True when subsystems have been initialized.
350
351#### Example
352
353Example request:
354
355~~~json
356{
357  "jsonrpc": "2.0",
358  "id": 1,
359  "method": "framework_wait_init"
360}
361~~~
362
363Example response:
364
365~~~json
366{
367  "jsonrpc": "2.0",
368  "id": 1,
369  "result": true
370}
371~~~
372
373### rpc_get_methods {#rpc_rpc_get_methods}
374
375Get an array of supported RPC methods.
376
377#### Parameters
378
379Name                    | Optional | Type        | Description
380----------------------- | -------- | ----------- | -----------
381current                 | Optional | boolean     | Get an array of RPC methods only callable in the current state.
382
383#### Response
384
385The response is an array of supported RPC methods.
386
387#### Example
388
389Example request:
390
391~~~json
392{
393  "jsonrpc": "2.0",
394  "id": 1,
395  "method": "rpc_get_methods"
396}
397~~~
398
399Example response:
400
401~~~json
402{
403  "jsonrpc": "2.0",
404  "id": 1,
405  "result": [
406    "framework_start_init",
407    "rpc_get_methods",
408    "scsi_get_devices",
409    "nbd_get_disks",
410    "nbd_stop_disk",
411    "nbd_start_disk",
412    "log_get_flags",
413    "log_clear_flag",
414    "log_set_flag",
415    "log_get_level",
416    "log_set_level",
417    "log_get_print_level",
418    "log_set_print_level",
419    "iscsi_get_options",
420    "iscsi_target_node_add_lun",
421    "iscsi_get_connections",
422    "iscsi_delete_portal_group",
423    "iscsi_create_portal_group",
424    "iscsi_get_portal_groups",
425    "iscsi_delete_target_node",
426    "iscsi_target_node_remove_pg_ig_maps",
427    "iscsi_target_node_add_pg_ig_maps",
428    "iscsi_create_target_node",
429    "iscsi_get_target_nodes",
430    "iscsi_delete_initiator_group",
431    "iscsi_initiator_group_remove_initiators",
432    "iscsi_initiator_group_add_initiators",
433    "iscsi_create_initiator_group",
434    "iscsi_get_initiator_groups",
435    "iscsi_set_options",
436    "bdev_set_options",
437    "bdev_set_qos_limit",
438    "bdev_get_bdevs",
439    "bdev_get_iostat",
440    "framework_get_config",
441    "framework_get_subsystems",
442    "framework_monitor_context_switch",
443    "spdk_kill_instance",
444    "ioat_scan_accel_engine",
445    "idxd_scan_accel_engine",
446    "bdev_virtio_attach_controller",
447    "bdev_virtio_scsi_get_devices",
448    "bdev_virtio_detach_controller",
449    "bdev_virtio_blk_set_hotplug",
450    "bdev_aio_delete",
451    "bdev_aio_create",
452    "bdev_split_delete",
453    "bdev_split_create",
454    "bdev_error_inject_error",
455    "bdev_error_delete",
456    "bdev_error_create",
457    "bdev_passthru_create",
458    "bdev_passthru_delete"
459    "bdev_nvme_apply_firmware",
460    "bdev_nvme_get_transport_statistics",
461    "bdev_nvme_get_controller_health_info",
462    "bdev_nvme_detach_controller",
463    "bdev_nvme_attach_controller",
464    "bdev_null_create",
465    "bdev_malloc_delete",
466    "bdev_malloc_create",
467    "bdev_ftl_delete",
468    "bdev_ftl_create",
469    "bdev_lvol_get_lvstores",
470    "bdev_lvol_delete",
471    "bdev_lvol_resize",
472    "bdev_lvol_set_read_only",
473    "bdev_lvol_decouple_parent",
474    "bdev_lvol_inflate",
475    "bdev_lvol_rename",
476    "bdev_lvol_clone",
477    "bdev_lvol_snapshot",
478    "bdev_lvol_create",
479    "bdev_lvol_delete_lvstore",
480    "bdev_lvol_rename_lvstore",
481    "bdev_lvol_create_lvstore"
482  ]
483}
484~~~
485
486### framework_get_subsystems {#rpc_framework_get_subsystems}
487
488Get an array of name and dependency relationship of SPDK subsystems in initialization order.
489
490#### Parameters
491
492None
493
494#### Response
495
496The response is an array of name and dependency relationship of SPDK subsystems in initialization order.
497
498#### Example
499
500Example request:
501
502~~~json
503{
504  "jsonrpc": "2.0",
505  "id": 1,
506  "method": "framework_get_subsystems"
507}
508~~~
509
510Example response:
511
512~~~json
513{
514  "jsonrpc": "2.0",
515  "id": 1,
516  "result": [
517    {
518      "subsystem": "accel",
519      "depends_on": []
520    },
521    {
522      "subsystem": "interface",
523      "depends_on": []
524    },
525    {
526      "subsystem": "net_framework",
527      "depends_on": [
528        "interface"
529      ]
530    },
531    {
532      "subsystem": "bdev",
533      "depends_on": [
534        "accel"
535      ]
536    },
537    {
538      "subsystem": "nbd",
539      "depends_on": [
540        "bdev"
541      ]
542    },
543    {
544      "subsystem": "nvmf",
545      "depends_on": [
546        "bdev"
547      ]
548    },
549    {
550      "subsystem": "scsi",
551      "depends_on": [
552        "bdev"
553      ]
554    },
555    {
556      "subsystem": "vhost",
557      "depends_on": [
558        "scsi"
559      ]
560    },
561    {
562      "subsystem": "iscsi",
563      "depends_on": [
564        "scsi"
565      ]
566    }
567  ]
568}
569~~~
570
571### framework_get_config {#rpc_framework_get_config}
572
573Get current configuration of the specified SPDK framework
574
575#### Parameters
576
577Name                    | Optional | Type        | Description
578----------------------- | -------- | ----------- | -----------
579name                    | Required | string      | SPDK subsystem name
580
581#### Response
582
583The response is current configuration of the specified SPDK subsystem.
584Null is returned if it is not retrievable by the framework_get_config method and empty array is returned if it is empty.
585
586#### Example
587
588Example request:
589
590~~~json
591{
592  "jsonrpc": "2.0",
593  "id": 1,
594  "method": "framework_get_config",
595  "params": {
596    "name": "bdev"
597  }
598}
599~~~
600
601Example response:
602
603~~~json
604{
605  "jsonrpc": "2.0",
606  "id": 1,
607  "result": [
608    {
609      "params": {
610        "base_bdev": "Malloc2",
611        "split_size_mb": 0,
612        "split_count": 2
613      },
614      "method": "bdev_split_create"
615    },
616    {
617      "params": {
618        "trtype": "PCIe",
619        "name": "Nvme1",
620        "traddr": "0000:01:00.0"
621      },
622      "method": "bdev_nvme_attach_controller"
623    },
624    {
625      "params": {
626        "trtype": "PCIe",
627        "name": "Nvme2",
628        "traddr": "0000:03:00.0"
629      },
630      "method": "bdev_nvme_attach_controller"
631    },
632    {
633      "params": {
634        "block_size": 512,
635        "num_blocks": 131072,
636        "name": "Malloc0",
637        "uuid": "913fc008-79a7-447f-b2c4-c73543638c31"
638      },
639      "method": "bdev_malloc_create"
640    },
641    {
642      "params": {
643        "block_size": 512,
644        "num_blocks": 131072,
645        "name": "Malloc1",
646        "uuid": "dd5b8f6e-b67a-4506-b606-7fff5a859920"
647      },
648      "method": "bdev_malloc_create"
649    }
650  ]
651}
652~~~
653
654### framework_get_reactors {#rpc_framework_get_reactors}
655
656Retrieve an array of all reactors.
657
658#### Parameters
659
660This method has no parameters.
661
662#### Response
663
664The response is an array of all reactors.
665
666#### Example
667
668Example request:
669
670~~~json
671{
672  "jsonrpc": "2.0",
673  "method": "framework_get_reactors",
674  "id": 1
675}
676~~~
677
678Example response:
679
680~~~json
681{
682  "jsonrpc": "2.0",
683  "id": 1,
684  "result": {
685    "tick_rate": 2400000000,
686    "reactors": [
687      {
688        "lcore": 0,
689        "busy": 41289723495,
690        "idle": 3624832946,
691        "lw_threads": [
692          {
693            "name": "app_thread",
694            "id", 1,
695            "cpumask": "1",
696            "elapsed": 44910853363
697          }
698        ]
699      }
700    ]
701  }
702}
703~~~
704
705### framework_set_scheduler {#rpc_framework_set_scheduler}
706
707Select thread scheduler that will be activated.
708This feature is considered as experimental.
709
710#### Parameters
711
712Name                    | Optional | Type        | Description
713----------------------- | -------- | ----------- | -----------
714name                    | Required | string      | Name of a scheduler
715period                  | Optional | number      | Scheduler period
716
717#### Response
718
719Completion status of the operation is returned as a boolean.
720
721#### Example
722
723Example request:
724
725~~~json
726{
727  "jsonrpc": "2.0",
728  "method": "framework_set_scheduler",
729  "id": 1,
730  "params": {
731    "name": "static",
732    "period": "1000000"
733  }
734}
735~~~
736
737Example response:
738
739~~~json
740{
741  "jsonrpc": "2.0",
742  "id": 1,
743  "result": true
744}
745~~~
746
747### framework_get_scheduler {#rpc_framework_get_scheduler}
748
749Retrieve currently set scheduler name and period, along with current governor name.
750
751#### Parameters
752
753This method has no parameters.
754
755#### Response
756
757Name                    | Description
758------------------------| -----------
759scheduler_name          | Current scheduler name
760scheduler_period        | Currently set scheduler period in microseconds
761governor_name           | Governor name
762
763#### Example
764
765Example request:
766
767~~~json
768{
769  "jsonrpc": "2.0",
770  "method": "framework_set_scheduler",
771  "id": 1,
772}
773~~~
774
775Example response:
776
777~~~json
778{
779  "jsonrpc": "2.0",
780  "id": 1,
781  "result": {
782    "scheduler_name": "static",
783    "scheduler_period": 2800000000,
784    "governor_name": "default"
785  }
786}
787~~~
788
789### thread_get_stats {#rpc_thread_get_stats}
790
791Retrieve current statistics of all the threads.
792
793#### Parameters
794
795This method has no parameters.
796
797#### Response
798
799The response is an array of objects containing threads statistics.
800
801#### Example
802
803Example request:
804
805~~~json
806{
807  "jsonrpc": "2.0",
808  "method": "thread_get_stats",
809  "id": 1
810}
811~~~
812
813Example response:
814
815~~~json
816{
817  "jsonrpc": "2.0",
818  "id": 1,
819  "result": {
820    "tick_rate": 2400000000,
821    "threads": [
822      {
823        "name": "app_thread",
824        "id": 1,
825	"cpumask": "1",
826        "busy": 139223208,
827        "idle": 8641080608,
828        "in_interrupt": false,
829        "active_pollers_count": 1,
830        "timed_pollers_count": 2,
831        "paused_pollers_count": 0
832      }
833    ]
834  }
835}
836~~~
837
838### thread_set_cpumask {#rpc_thread_set_cpumask}
839
840Set the cpumask of the thread to the specified value. The thread may be migrated
841to one of the specified CPUs.
842
843#### Parameters
844
845Name                    | Optional | Type        | Description
846----------------------- | -------- | ----------- | -----------
847id                      | Required | string      | Thread ID
848cpumask                 | Required | string      | Cpumask for this thread
849
850#### Response
851
852Completion status of the operation is returned as a boolean.
853
854#### Example
855
856Example request:
857
858~~~json
859{
860  "jsonrpc": "2.0",
861  "method": "thread_set_cpumask",
862  "id": 1,
863  "params": {
864    "id": "1",
865    "cpumask": "1"
866  }
867}
868~~~
869
870Example response:
871
872~~~json
873{
874  "jsonrpc": "2.0",
875  "id": 1,
876  "result": true
877}
878~~~
879
880### trace_enable_tpoint_group {#rpc_trace_enable_tpoint_group}
881
882Enable trace on a specific tpoint group. For example "bdev" for bdev trace group,
883"all" for all trace groups.
884
885#### Parameters
886
887Name                    | Optional | Type        | Description
888----------------------- | -------- | ----------- | -----------
889name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, scsi, iscsi_conn, ftl, all
890
891#### Example
892
893Example request:
894
895~~~json
896{
897  "jsonrpc": "2.0",
898  "method": "trace_enable_tpoint_group",
899  "id": 1,
900  "params": {
901    "name": "bdev"
902  }
903}
904~~~
905
906Example response:
907
908~~~json
909{
910  "jsonrpc": "2.0",
911  "id": 1,
912  "result": true
913}
914~~~
915
916### trace_disable_tpoint_group {#rpc_trace_disable_tpoint_group}
917
918Disable trace on a specific tpoint group. For example "bdev" for bdev trace group,
919"all" for all trace groups.
920
921#### Parameters
922
923Name                    | Optional | Type        | Description
924----------------------- | -------- | ----------- | -----------
925name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, all
926
927#### Example
928
929Example request:
930
931~~~json
932{
933  "jsonrpc": "2.0",
934  "method": "trace_disable_tpoint_group",
935  "id": 1,
936  "params": {
937    "name": "bdev"
938  }
939}
940~~~
941
942Example response:
943
944~~~json
945{
946  "jsonrpc": "2.0",
947  "id": 1,
948  "result": true
949}
950~~~
951
952### trace_set_tpoint_mask {#rpc_trace_set_tpoint_mask}
953
954Enable tracepoint mask on a specific tpoint group. For example "bdev" for bdev trace group,
955and 0x1 to enable the first tracepoint inside the group (BDEV_IO_START). This command will not
956disable already active tracepoints or those not specified in the mask. For a full description
957of all available trace groups, see
958[tracepoint documentation](https://spdk.io/doc/nvmf_tgt_tracepoints.html).
959
960#### Parameters
961
962Name                    | Optional | Type        | Description
963----------------------- | -------- | ----------- | -----------
964name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, scsi, iscsi_conn, ftl
965tpoint_mask             | Required | number      | mask to enable tracepoints inside a group
966
967#### Example
968
969Example request:
970
971~~~json
972{
973  "jsonrpc": "2.0",
974  "method": "trace_set_tpoint_mask",
975  "id": 1,
976  "params": {
977    "name": "bdev",
978    "tpoint_mask": 0x1
979  }
980}
981~~~
982
983Example response:
984
985~~~json
986{
987  "jsonrpc": "2.0",
988  "id": 1,
989  "result": true
990}
991~~~
992
993### trace_clear_tpoint_mask {#rpc_trace_clear_tpoint_mask}
994
995Disable tracepoint mask on a specific tpoint group. For example "bdev" for bdev trace group,
996and 0x1 to disable the first tracepoint inside the group (BDEV_IO_START). For a full description
997of all available trace groups, see
998[tracepoint documentation](https://spdk.io/doc/nvmf_tgt_tracepoints.html).
999
1000#### Parameters
1001
1002Name                    | Optional | Type        | Description
1003----------------------- | -------- | ----------- | -----------
1004name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, scsi, iscsi_conn, ftl
1005tpoint_mask             | Required | number      | mask to diesable tracepoints inside a group
1006
1007#### Example
1008
1009Example request:
1010
1011~~~json
1012{
1013  "jsonrpc": "2.0",
1014  "method": "trace_clear_tpoint_mask",
1015  "id": 1,
1016  "params": {
1017    "name": "bdev",
1018    "tpoint_mask": 0x1
1019  }
1020}
1021~~~
1022
1023Example response:
1024
1025~~~json
1026{
1027  "jsonrpc": "2.0",
1028  "id": 1,
1029  "result": true
1030}
1031~~~
1032
1033### trace_get_tpoint_group_mask {#rpc_trace_get_tpoint_group_mask}
1034
1035Display mask info for every group.
1036
1037#### Parameters
1038
1039No parameters required
1040
1041#### Example
1042
1043Example request:
1044
1045~~~json
1046{
1047  "jsonrpc": "2.0",
1048  "method": "trace_get_tpoint_group_mask",
1049  "id": 1
1050}
1051~~~
1052
1053Example response:
1054
1055~~~json
1056{
1057  "jsonrpc": "2.0",
1058  "id": 1,
1059  "result": {
1060    "tpoint_group_mask": "0x0",
1061  "iscsi_conn": {
1062    "enabled": false,
1063    "mask": "0x2"
1064  },
1065  "scsi": {
1066    "enabled": false,
1067    "mask": "0x4"
1068  },
1069  "bdev": {
1070    "enabled": false,
1071    "mask": "0x8"
1072  },
1073  "nvmf_tcp": {
1074    "enabled": false,
1075    "mask": "0x20"
1076  },
1077  "ftl": {
1078    "enabled": false,
1079    "mask": "0x40"
1080  },
1081  "blobfs": {
1082    "enabled": false,
1083    "mask": "0x80"
1084    }
1085  }
1086}
1087~~~
1088
1089### log_set_print_level {#rpc_log_set_print_level}
1090
1091Set the current level at which output will additionally be
1092sent to the current console.
1093
1094#### Parameters
1095
1096Name                    | Optional | Type        | Description
1097----------------------- | -------- | ----------- | -----------
1098level                   | Required | string      | ERROR, WARNING, NOTICE, INFO, DEBUG
1099
1100#### Example
1101
1102Example request:
1103
1104~~~json
1105{
1106  "jsonrpc": "2.0",
1107  "method": "log_set_print_level",
1108  "id": 1,
1109  "params": {
1110    "level": "ERROR"
1111  }
1112}
1113~~~
1114
1115Example response:
1116
1117~~~json
1118{
1119  "jsonrpc": "2.0",
1120  "id": 1,
1121  "result": true
1122}
1123~~~
1124
1125### log_get_print_level {#rpc_log_get_print_level}
1126
1127Get the current level at which output will additionally be
1128sent to the current console.
1129
1130#### Example
1131
1132Example request:
1133
1134~~~json
1135{
1136  "jsonrpc": "2.0",
1137  "method": "log_get_print_level",
1138  "id": 1,
1139}
1140~~~
1141
1142Example response:
1143
1144~~~json
1145{
1146  "jsonrpc": "2.0",
1147  "id": 1,
1148  "result": "NOTICE"
1149}
1150~~~
1151
1152### log_set_level {#rpc_log_set_level}
1153
1154Set the current logging level output by the `log` module.
1155
1156#### Parameters
1157
1158Name                    | Optional | Type        | Description
1159----------------------- | -------- | ----------- | -----------
1160level                   | Required | string      | ERROR, WARNING, NOTICE, INFO, DEBUG
1161
1162#### Example
1163
1164Example request:
1165
1166~~~json
1167{
1168  "jsonrpc": "2.0",
1169  "method": "log_set_level",
1170  "id": 1,
1171  "params": {
1172    "level": "ERROR"
1173  }
1174}
1175~~~
1176
1177Example response:
1178
1179~~~json
1180{
1181  "jsonrpc": "2.0",
1182  "id": 1,
1183  "result": true
1184}
1185~~~
1186
1187### log_get_level {#rpc_log_get_level}
1188
1189Get the current logging level output by the `log` module.
1190
1191#### Example
1192
1193Example request:
1194
1195~~~json
1196{
1197  "jsonrpc": "2.0",
1198  "method": "log_get_level",
1199  "id": 1,
1200}
1201~~~
1202
1203Example response:
1204
1205~~~json
1206{
1207  "jsonrpc": "2.0",
1208  "id": 1,
1209  "result": "NOTICE"
1210}
1211~~~
1212
1213### log_set_flag {#rpc_log_set_flag}
1214
1215Enable logging for specific portions of the application. The list of possible
1216log flags can be obtained using the `log_get_flags` RPC and may be different
1217for each application.
1218
1219#### Parameters
1220
1221Name                    | Optional | Type        | Description
1222----------------------- | -------- | ----------- | -----------
1223flag                    | Required | string      | A log flag, or 'all'
1224
1225#### Example
1226
1227Example request:
1228
1229~~~json
1230{
1231  "jsonrpc": "2.0",
1232  "method": "log_set_flag",
1233  "id": 1,
1234  "params": {
1235    "flag": "all"
1236  }
1237}
1238~~~
1239
1240Example response:
1241
1242~~~json
1243{
1244  "jsonrpc": "2.0",
1245  "id": 1,
1246  "result": true
1247}
1248~~~
1249
1250### log_clear_flag {#rpc_log_clear_flag}
1251
1252Disable logging for specific portions of the application. The list of possible
1253log flags can be obtained using the `log_get_flags` RPC and may be different
1254for each application.
1255
1256#### Parameters
1257
1258Name                    | Optional | Type        | Description
1259----------------------- | -------- | ----------- | -----------
1260flag                    | Required | string      | A log flag, or 'all'
1261
1262#### Example
1263
1264Example request:
1265
1266~~~json
1267{
1268  "jsonrpc": "2.0",
1269  "method": "log_clear_flag",
1270  "id": 1,
1271  "params": {
1272    "flag": "all"
1273  }
1274}
1275~~~
1276
1277Example response:
1278
1279~~~json
1280{
1281  "jsonrpc": "2.0",
1282  "id": 1,
1283  "result": true
1284}
1285~~~
1286
1287### log_get_flags {#rpc_log_get_flags}
1288
1289Get the list of valid flags for this application and whether
1290they are currently enabled.
1291
1292#### Example
1293
1294Example request:
1295
1296~~~json
1297{
1298  "jsonrpc": "2.0",
1299  "method": "log_get_flags",
1300  "id": 1,
1301}
1302~~~
1303
1304Example response:
1305
1306~~~json
1307{
1308  "jsonrpc": "2.0",
1309  "id": 1,
1310  "result": {
1311    "nvmf": true,
1312    "nvme": true,
1313    "aio": false,
1314    "bdev" false
1315  }
1316}
1317~~~
1318
1319### log_enable_timestamps {#rpc_log_enable_timestamps}
1320
1321Enable or disable timestamps.
1322
1323#### Parameters
1324
1325Name                    | Optional | Type        | Description
1326----------------------- | -------- | ----------- | -----------
1327enabled                 | Required | boolean     | on or off
1328
1329#### Example
1330
1331Example request:
1332
1333~~~json
1334{
1335  "jsonrpc": "2.0",
1336  "method": "log_enable_timestamps",
1337  "id": 1,
1338  "params": {
1339    "enabled": true
1340  }
1341}
1342~~~
1343
1344Example response:
1345
1346~~~json
1347{
1348  "jsonrpc": "2.0",
1349  "id": 1,
1350  "result": true
1351}
1352~~~
1353
1354### thread_get_pollers {#rpc_thread_get_pollers}
1355
1356Retrieve current pollers of all the threads.
1357
1358#### Parameters
1359
1360This method has no parameters.
1361
1362### Response
1363
1364The response is an array of objects containing pollers of all the threads.
1365
1366#### Example
1367
1368Example request:
1369
1370~~~json
1371{
1372  "jsonrpc": "2.0",
1373  "method": "thread_get_pollers",
1374  "id": 1
1375}
1376~~~
1377
1378Example response:
1379
1380~~~json
1381{
1382  "jsonrpc": "2.0",
1383  "id": 1,
1384  "result": {
1385    "tick_rate": 2500000000,
1386    "threads": [
1387      {
1388        "name": "app_thread",
1389        "id": 1,
1390        "active_pollers": [],
1391        "timed_pollers": [
1392          {
1393            "name": "spdk_rpc_subsystem_poll",
1394            "id": 1,
1395            "state": "waiting",
1396            "run_count": 12345,
1397            "busy_count": 10000,
1398            "period_ticks": 10000000
1399          }
1400        ],
1401        "paused_pollers": []
1402      }
1403    ]
1404  }
1405}
1406~~~
1407
1408### thread_get_io_channels {#rpc_thread_get_io_channels}
1409
1410Retrieve current IO channels of all the threads.
1411
1412#### Parameters
1413
1414This method has no parameters.
1415
1416#### Response
1417
1418The response is an array of objects containing IO channels of all the threads.
1419
1420#### Example
1421
1422Example request:
1423
1424~~~json
1425{
1426  "jsonrpc": "2.0",
1427  "method": "thread_get_io_channels",
1428  "id": 1
1429}
1430~~~
1431
1432Example response:
1433
1434~~~json
1435{
1436  "jsonrpc": "2.0",
1437  "id": 1,
1438  "result": {
1439    "tick_rate": 2500000000,
1440    "threads": [
1441      {
1442        "name": "app_thread",
1443        "io_channels": [
1444          {
1445            "name": "nvmf_tgt",
1446            "ref": 1
1447          }
1448        ]
1449      }
1450    ]
1451  }
1452}
1453~~~
1454
1455### env_dpdk_get_mem_stats {#rpc_env_dpdk_get_mem_stats}
1456
1457Write the dpdk memory stats to a file.
1458
1459#### Parameters
1460
1461This method has no parameters.
1462
1463#### Response
1464
1465The response is a pathname to a text file containing the memory stats.
1466
1467#### Example
1468
1469Example request:
1470
1471~~~json
1472{
1473  "jsonrpc": "2.0",
1474  "method": "env_dpdk_get_mem_stats",
1475  "id": 1
1476}
1477~~~
1478
1479Example response:
1480
1481~~~json
1482{
1483  "jsonrpc": "2.0",
1484  "id": 1,
1485  "result": {
1486    "filename": "/tmp/spdk_mem_dump.txt"
1487  }
1488}
1489~~~
1490
1491## Acceleration Framework Layer {#jsonrpc_components_accel_fw}
1492
1493### idxd_scan_accel_engine {#rpc_idxd_scan_accel_engine}
1494
1495Set config and enable idxd accel engine offload.
1496This feature is considered as experimental.
1497
1498#### Parameters
1499
1500Name                    | Optional | Type        | Description
1501----------------------- | -------- | ----------- | -----------
1502config_number           | Required | number      | Pre-defined config # to use (ie 0, 1). See [docs.](https://spdk.io/doc/idxd.html)
1503config_kernel_mode      | Optional | Boolean     | If set, will use kernel idxd driver.
1504
1505#### Example
1506
1507Example request:
1508
1509~~~json
1510{
1511  "params": {
1512    "config_number": 0,
1513    "config_kernel_mode": false
1514  },
1515  "jsonrpc": "2.0",
1516  "method": "idxd_scan_accel_engine",
1517  "id": 1
1518}
1519~~~
1520
1521Example response:
1522
1523~~~json
1524{
1525  "jsonrpc": "2.0",
1526  "id": 1,
1527  "result": true
1528}
1529~~~
1530
1531### ioat_scan_accel_engine {#rpc_ioat_scan_accel_engine}
1532
1533Enable ioat accel engine offload.
1534
1535#### Parameters
1536
1537None
1538
1539#### Example
1540
1541Example request:
1542
1543~~~json
1544{
1545  "jsonrpc": "2.0",
1546  "method": "ioat_scan_accel_engine",
1547  "id": 1
1548}
1549~~~
1550
1551Example response:
1552
1553~~~json
1554{
1555  "jsonrpc": "2.0",
1556  "id": 1,
1557  "result": true
1558}
1559~~~
1560
1561## Block Device Abstraction Layer {#jsonrpc_components_bdev}
1562
1563### bdev_set_options {#rpc_bdev_set_options}
1564
1565Set global parameters for the block device (bdev) subsystem.  This RPC may only be called
1566before SPDK subsystems have been initialized.
1567
1568#### Parameters
1569
1570Name                    | Optional | Type        | Description
1571----------------------- | -------- | ----------- | -----------
1572bdev_io_pool_size       | Optional | number      | Number of spdk_bdev_io structures in shared buffer pool
1573bdev_io_cache_size      | Optional | number      | Maximum number of spdk_bdev_io structures cached per thread
1574bdev_auto_examine       | Optional | boolean     | If set to false, the bdev layer will not examine every disks automatically
1575
1576#### Example
1577
1578Example request:
1579
1580~~~json
1581{
1582  "jsonrpc": "2.0",
1583  "id": 1,
1584  "method": "bdev_set_options",
1585  "params": {
1586    "bdev_io_pool_size": 65536,
1587    "bdev_io_cache_size": 256
1588  }
1589}
1590~~~
1591
1592Example response:
1593
1594~~~json
1595{
1596  "jsonrpc": "2.0",
1597  "id": 1,
1598  "result": true
1599}
1600~~~
1601
1602### bdev_get_bdevs {#rpc_bdev_get_bdevs}
1603
1604Get information about block devices (bdevs).
1605
1606#### Parameters
1607
1608The user may specify no parameters in order to list all block devices, or a block device may be
1609specified by name.
1610
1611Name                    | Optional | Type        | Description
1612----------------------- | -------- | ----------- | -----------
1613name                    | Optional | string      | Block device name
1614
1615#### Response
1616
1617The response is an array of objects containing information about the requested block devices.
1618
1619#### Example
1620
1621Example request:
1622
1623~~~json
1624{
1625  "jsonrpc": "2.0",
1626  "id": 1,
1627  "method": "bdev_get_bdevs",
1628  "params": {
1629    "name": "Malloc0"
1630  }
1631}
1632~~~
1633
1634Example response:
1635
1636~~~json
1637{
1638  "jsonrpc": "2.0",
1639  "id": 1,
1640  "result": [
1641    {
1642      "name": "Malloc0",
1643      "product_name": "Malloc disk",
1644      "block_size": 512,
1645      "num_blocks": 20480,
1646      "claimed": false,
1647      "zoned": false,
1648      "supported_io_types": {
1649        "read": true,
1650        "write": true,
1651        "unmap": true,
1652        "write_zeroes": true,
1653        "flush": true,
1654        "reset": true,
1655        "nvme_admin": false,
1656        "nvme_io": false
1657      },
1658      "driver_specific": {}
1659    }
1660  ]
1661}
1662~~~
1663
1664### bdev_examine {#rpc_bdev_examine}
1665
1666Request that the bdev layer examines the given bdev for metadata and creates
1667new bdevs if metadata is found. This is only necessary if `auto_examine` has
1668been set to false using `bdev_set_options`. By default, `auto_examine` is true
1669and bdev examination is automatic.
1670
1671#### Parameters
1672
1673Name                    | Optional | Type        | Description
1674----------------------- | -------- | ----------- | -----------
1675name                    | Required | string      | Block device name
1676
1677#### Response
1678
1679The response is an array of objects containing I/O statistics of the requested block devices.
1680
1681#### Example
1682
1683Example request:
1684
1685~~~json
1686{
1687  "jsonrpc": "2.0",
1688  "id": 1,
1689  "method": "bdev_examine",
1690  "params": {
1691    "name": "Nvme0n1"
1692  }
1693}
1694~~~
1695
1696Example response:
1697
1698~~~json
1699{
1700  "jsonrpc": "2.0",
1701  "id": 1,
1702  "result": true
1703}
1704~~~
1705
1706### bdev_wait_for_examine {#rpc_bdev_wait_for_examine}
1707
1708Report when all bdevs have been examined by every bdev module.
1709
1710#### Parameters
1711
1712None
1713
1714#### Response
1715
1716The response is sent when all bdev modules had a chance to examine every bdev.
1717
1718#### Example
1719
1720Example request:
1721
1722~~~json
1723{
1724  "jsonrpc": "2.0",
1725  "method": "bdev_wait_for_examine",
1726  "id": 1
1727}
1728~~~
1729
1730Example response:
1731
1732~~~json
1733{
1734  "jsonrpc": "2.0",
1735  "id": 1,
1736  "result": true
1737}
1738~~~
1739
1740### bdev_get_iostat {#rpc_bdev_get_iostat}
1741
1742Get I/O statistics of block devices (bdevs).
1743
1744#### Parameters
1745
1746The user may specify no parameters in order to list all block devices, or a block device may be
1747specified by name.
1748
1749Name                    | Optional | Type        | Description
1750----------------------- | -------- | ----------- | -----------
1751name                    | Optional | string      | Block device name
1752
1753#### Response
1754
1755The response is an array of objects containing I/O statistics of the requested block devices.
1756
1757#### Example
1758
1759Example request:
1760
1761~~~json
1762{
1763  "jsonrpc": "2.0",
1764  "id": 1,
1765  "method": "bdev_get_iostat",
1766  "params": {
1767    "name": "Nvme0n1"
1768  }
1769}
1770~~~
1771
1772Example response:
1773
1774~~~json
1775{
1776  "jsonrpc": "2.0",
1777  "id": 1,
1778  "result": {
1779    "tick_rate": 2200000000,
1780    "bdevs" : [
1781      {
1782        "name": "Nvme0n1",
1783        "bytes_read": 36864,
1784        "num_read_ops": 2,
1785        "bytes_written": 0,
1786        "num_write_ops": 0,
1787        "bytes_unmapped": 0,
1788        "num_unmap_ops": 0,
1789        "read_latency_ticks": 178904,
1790        "write_latency_ticks": 0,
1791        "unmap_latency_ticks": 0,
1792        "queue_depth_polling_period": 2,
1793        "queue_depth": 0,
1794        "io_time": 0,
1795        "weighted_io_time": 0
1796      }
1797    ]
1798  }
1799}
1800~~~
1801
1802### bdev_enable_histogram {#rpc_bdev_enable_histogram}
1803
1804Control whether collecting data for histogram is enabled for specified bdev.
1805
1806#### Parameters
1807
1808Name                    | Optional | Type        | Description
1809----------------------- | -------- | ----------- | -----------
1810name                    | Required | string      | Block device name
1811enable                  | Required | boolean     | Enable or disable histogram on specified device
1812
1813#### Example
1814
1815Example request:
1816
1817~~~json
1818{
1819  "jsonrpc": "2.0",
1820  "id": 1,
1821  "method": "bdev_enable_histogram",
1822  "params": {
1823    "name": "Nvme0n1"
1824    "enable": true
1825  }
1826}
1827~~~
1828
1829Example response:
1830
1831~~~json
1832{
1833  "jsonrpc": "2.0",
1834  "id": 1,
1835  "result": true
1836}
1837~~~
1838
1839### bdev_get_histogram {#rpc_bdev_get_histogram}
1840
1841Get latency histogram for specified bdev.
1842
1843#### Parameters
1844
1845Name                    | Optional | Type        | Description
1846----------------------- | -------- | ----------- | -----------
1847name                    | Required | string      | Block device name
1848
1849#### Result
1850
1851Name                    | Description
1852------------------------| -----------
1853histogram               | Base64 encoded histogram
1854bucket_shift            | Granularity of the histogram buckets
1855tsc_rate                | Ticks per second
1856
1857#### Example
1858
1859Example request:
1860
1861~~~json
1862{
1863  "jsonrpc": "2.0",
1864  "id": 1,
1865  "method": "bdev_get_histogram",
1866  "params": {
1867    "name": "Nvme0n1"
1868  }
1869}
1870~~~
1871
1872Example response:
1873Note that histogram field is trimmed, actual encoded histogram length is ~80kb.
1874
1875~~~json
1876{
1877  "jsonrpc": "2.0",
1878  "id": 1,
1879  "result": {
1880    "histogram": "AAAAAAAAAAAAAA...AAAAAAAAA==",
1881    "tsc_rate": 2300000000,
1882    "bucket_shift": 7
1883  }
1884}
1885~~~
1886
1887### bdev_set_qos_limit {#rpc_bdev_set_qos_limit}
1888
1889Set the quality of service rate limit on a bdev.
1890
1891#### Parameters
1892
1893Name                    | Optional | Type        | Description
1894----------------------- | -------- | ----------- | -----------
1895name                    | Required | string      | Block device name
1896rw_ios_per_sec          | Optional | number      | Number of R/W I/Os per second to allow. 0 means unlimited.
1897rw_mbytes_per_sec       | Optional | number      | Number of R/W megabytes per second to allow. 0 means unlimited.
1898r_mbytes_per_sec        | Optional | number      | Number of Read megabytes per second to allow. 0 means unlimited.
1899w_mbytes_per_sec        | Optional | number      | Number of Write megabytes per second to allow. 0 means unlimited.
1900
1901#### Example
1902
1903Example request:
1904
1905~~~json
1906{
1907  "jsonrpc": "2.0",
1908  "id": 1,
1909  "method": "bdev_set_qos_limit",
1910  "params": {
1911    "name": "Malloc0"
1912    "rw_ios_per_sec": 20000
1913    "rw_mbytes_per_sec": 100
1914    "r_mbytes_per_sec": 50
1915    "w_mbytes_per_sec": 50
1916  }
1917}
1918~~~
1919
1920Example response:
1921
1922~~~json
1923{
1924  "jsonrpc": "2.0",
1925  "id": 1,
1926  "result": true
1927}
1928~~~
1929
1930### bdev_set_qd_sampling_period {#rpc_bdev_set_qd_sampling_period}
1931
1932Enable queue depth tracking on a specified bdev.
1933
1934#### Parameters
1935
1936Name                    | Optional | Type        | Description
1937----------------------- | -------- | ----------- | -----------
1938name                    | Required | string      | Block device name
1939period                  | Required | int         | period (in microseconds).If set to 0, polling will be disabled.
1940
1941#### Example
1942
1943Example request:
1944
1945~~~json
1946{
1947  "jsonrpc": "2.0",
1948  "method": "bdev_set_qd_sampling_period",
1949  "id": 1,
1950  "params": {
1951    "name": "Malloc0",
1952    "period": 20
1953  }
1954}
1955~~~
1956
1957Example response:
1958
1959~~~json
1960{
1961  "jsonrpc": "2.0",
1962  "id": 1,
1963  "result": true
1964}
1965~~~
1966
1967### bdev_compress_create {#rpc_bdev_compress_create}
1968
1969Create a new compress bdev on a given base bdev.
1970
1971#### Parameters
1972
1973Name                    | Optional | Type        | Description
1974----------------------- | -------- | ----------- | -----------
1975base_bdev_name          | Required | string      | Name of the base bdev
1976pm_path                 | Required | string      | Path to persistent memory
1977lb_size                 | Optional | int         | Compressed vol logical block size (512 or 4096)
1978
1979#### Result
1980
1981Name of newly created bdev.
1982
1983#### Example
1984
1985Example request:
1986
1987~~~json
1988{
1989  "params": {
1990    "base_bdev_name": "Nvme0n1",
1991    "pm_path": "/pm_files",
1992    "lb_size": 4096
1993  },
1994  "jsonrpc": "2.0",
1995  "method": "bdev_compress_create",
1996  "id": 1
1997}
1998~~~
1999
2000### bdev_compress_delete {#rpc_bdev_compress_delete}
2001
2002Delete a compressed bdev.
2003
2004#### Parameters
2005
2006Name                    | Optional | Type        | Description
2007----------------------- | -------- | ----------- | -----------
2008name                    | Required | string      | Name of the compress bdev
2009
2010#### Example
2011
2012Example request:
2013
2014~~~json
2015{
2016  "params": {
2017    "name": "COMP_Nvme0n1"
2018  },
2019  "jsonrpc": "2.0",
2020  "method": "bdev_compress_delete",
2021  "id": 1
2022}
2023~~~
2024
2025Example response:
2026
2027~~~json
2028{
2029  "jsonrpc": "2.0",
2030  "id": 1,
2031  "result": true
2032}
2033~~~
2034
2035### bdev_compress_get_orphans {#rpc_bdev_compress_get_orphans}
2036
2037Get a list of compressed volumes that are missing their pmem metadata.
2038
2039#### Parameters
2040
2041Name                    | Optional | Type        | Description
2042----------------------- | -------- | ----------- | -----------
2043name                    | Required | string      | Name of the compress bdev
2044
2045#### Example
2046
2047Example request:
2048
2049~~~json
2050{
2051  "params": {
2052    "name": "COMP_Nvme0n1"
2053  },
2054  "jsonrpc": "2.0",
2055  "method": "bdev_compress_get_orphans",
2056  "id": 1
2057}
2058~~~
2059
2060Example response:
2061
2062~~~json
2063{
2064  "jsonrpc": "2.0",
2065  "id": 1,
2066  "name": "COMP_Nvme0n1"
2067}
2068~~~
2069
2070### bdev_compress_set_pmd {#rpc_bdev_compress_set_pmd}
2071
2072Select the DPDK polled mode driver (pmd) for a compressed bdev,
20730 = auto-select, 1= QAT only, 2 = ISAL only, 3 = mlx5_pci only.
2074
2075#### Parameters
2076
2077Name                    | Optional | Type        | Description
2078----------------------- | -------- | ----------- | -----------
2079pmd                     | Required | int         | pmd selection
2080
2081#### Example
2082
2083Example request:
2084
2085~~~json
2086{
2087  "params": {
2088    "pmd": 1
2089  },
2090  "jsonrpc": "2.0",
2091  "method": "bdev_compress_set_pmd",
2092  "id": 1
2093}
2094~~~
2095
2096Example response:
2097
2098~~~json
2099{
2100  "jsonrpc": "2.0",
2101  "id": 1,
2102  "result": true
2103}
2104~~~
2105
2106### bdev_crypto_create {#rpc_bdev_crypto_create}
2107
2108Create a new crypto bdev on a given base bdev.
2109
2110#### Parameters
2111
2112Name                    | Optional | Type        | Description
2113----------------------- | -------- | ----------- | -----------
2114base_bdev_name          | Required | string      | Name of the base bdev
2115name                    | Required | string      | Name of the crypto vbdev to create
2116crypto_pmd              | Required | string      | Name of the crypto device driver
2117key                     | Required | string      | Key
2118cipher                  | Required | string      | Cipher to use, AES_CBC or AES_XTS (QAT only)
2119key2                    | Required | string      | 2nd key only required for cipher AET_XTS
2120
2121#### Result
2122
2123Name of newly created bdev.
2124
2125#### Example
2126
2127Example request:
2128
2129~~~json
2130{
2131  "params": {
2132    "base_bdev_name": "Nvme0n1",
2133    "name": "my_crypto_bdev",
2134    "crypto_pmd": "crypto_aesni_mb",
2135    "key": "1234567890123456",
2136    "cipher": "AES_CBC"
2137  },
2138  "jsonrpc": "2.0",
2139  "method": "bdev_crypto_create",
2140  "id": 1
2141}
2142~~~
2143
2144Example response:
2145
2146~~~json
2147{
2148
2149  "jsonrpc": "2.0",
2150  "id": 1,
2151  "result": "my_crypto_bdev"
2152}
2153~~~
2154
2155### bdev_crypto_delete {#rpc_bdev_crypto_delete}
2156
2157Delete a crypto bdev.
2158
2159#### Parameters
2160
2161Name                    | Optional | Type        | Description
2162----------------------- | -------- | ----------- | -----------
2163name                    | Required | string      | Name of the crypto bdev
2164
2165#### Example
2166
2167Example request:
2168
2169~~~json
2170{
2171  "params": {
2172    "name": "my_crypto_bdev"
2173  },
2174  "jsonrpc": "2.0",
2175  "method": "bdev_crypto_delete",
2176  "id": 1
2177}
2178~~~
2179
2180Example response:
2181
2182~~~json
2183{
2184  "jsonrpc": "2.0",
2185  "id": 1,
2186  "result": true
2187}
2188~~~
2189
2190### bdev_ocf_create {#rpc_bdev_ocf_create}
2191
2192Construct new OCF bdev.
2193Command accepts cache mode that is going to be used.
2194You can find more details about supported cache modes in the [OCF documentation](https://open-cas.github.io/cache_configuration.html#cache-mode)
2195
2196#### Parameters
2197
2198Name                    | Optional | Type        | Description
2199----------------------- | -------- | ----------- | -----------
2200name                    | Required | string      | Bdev name to use
2201mode                    | Required | string      | OCF cache mode: wb, wt, pt, wa, wi, wo
2202cache_line_size         | Optional | int         | OCF cache line size in KiB: 4, 8, 16, 32, 64
2203cache_bdev_name         | Required | string      | Name of underlying cache bdev
2204core_bdev_name          | Required | string      | Name of underlying core bdev
2205
2206#### Result
2207
2208Name of newly created bdev.
2209
2210#### Example
2211
2212Example request:
2213
2214~~~json
2215{
2216  "params": {
2217    "name": "ocf0",
2218    "mode": "wt",
2219    "cache_line_size": 64,
2220    "cache_bdev_name": "Nvme0n1",
2221    "core_bdev_name": "aio0"
2222  },
2223  "jsonrpc": "2.0",
2224  "method": "bdev_ocf_create",
2225  "id": 1
2226}
2227~~~
2228
2229Example response:
2230
2231~~~json
2232{
2233  "jsonrpc": "2.0",
2234  "id": 1,
2235  "result": "ocf0"
2236}
2237~~~
2238
2239### bdev_ocf_delete {#rpc_bdev_ocf_delete}
2240
2241Delete the OCF bdev
2242
2243#### Parameters
2244
2245Name                    | Optional | Type        | Description
2246----------------------- | -------- | ----------- | -----------
2247name                    | Required | string      | Bdev name
2248
2249#### Example
2250
2251Example request:
2252
2253~~~json
2254{
2255  "params": {
2256    "name": "ocf0"
2257  },
2258  "jsonrpc": "2.0",
2259  "method": "bdev_ocf_delete",
2260  "id": 1
2261}
2262~~~
2263
2264Example response:
2265
2266~~~json
2267{
2268  "jsonrpc": "2.0",
2269  "id": 1,
2270  "result": true
2271}
2272~~~
2273
2274### bdev_ocf_get_stats {#rpc_bdev_ocf_get_stats}
2275
2276Get statistics of chosen OCF block device.
2277
2278#### Parameters
2279
2280Name                    | Optional | Type        | Description
2281----------------------- | -------- | ----------- | -----------
2282name                    | Required | string      | Block device name
2283
2284#### Response
2285
2286Statistics as json object.
2287
2288#### Example
2289
2290Example request:
2291
2292~~~json
2293{
2294  "jsonrpc": "2.0",
2295  "method": "bdev_ocf_get_stats",
2296  "id": 1
2297}
2298~~~
2299
2300Example response:
2301
2302~~~json
2303{
2304  "jsonrpc": "2.0",
2305  "id": 1,
2306  "result": [
2307  "usage": {
2308    "clean": {
2309      "count": 76033,
2310      "units": "4KiB blocks",
2311      "percentage": "100.0"
2312    },
2313    "free": {
2314      "count": 767,
2315      "units": "4KiB blocks",
2316      "percentage": "0.9"
2317    },
2318    "occupancy": {
2319      "count": 76033,
2320      "units": "4KiB blocks",
2321      "percentage": "99.0"
2322    },
2323    "dirty": {
2324      "count": 0,
2325      "units": "4KiB blocks",
2326      "percentage": "0.0"
2327    }
2328  },
2329  "requests": {
2330    "rd_total": {
2331      "count": 2,
2332      "units": "Requests",
2333      "percentage": "0.0"
2334    },
2335    "wr_full_misses": {
2336      "count": 76280,
2337      "units": "Requests",
2338      "percentage": "35.6"
2339    },
2340    "rd_full_misses": {
2341      "count": 1,
2342      "units": "Requests",
2343      "percentage": "0.0"
2344    },
2345    "rd_partial_misses": {
2346      "count": 0,
2347      "units": "Requests",
2348      "percentage": "0.0"
2349    },
2350    "wr_total": {
2351      "count": 212416,
2352      "units": "Requests",
2353      "percentage": "99.2"
2354    },
2355    "wr_pt": {
2356      "count": 1535,
2357      "units": "Requests",
2358      "percentage": "0.7"
2359    },
2360    "wr_partial_misses": {
2361      "count": 0,
2362      "units": "Requests",
2363      "percentage": "0.0"
2364    },
2365    "serviced": {
2366      "count": 212418,
2367      "units": "Requests",
2368      "percentage": "99.2"
2369    },
2370    "rd_pt": {
2371      "count": 0,
2372      "units": "Requests",
2373      "percentage": "0.0"
2374    },
2375    "total": {
2376      "count": 213953,
2377      "units": "Requests",
2378      "percentage": "100.0"
2379    },
2380    "rd_hits": {
2381      "count": 1,
2382      "units": "Requests",
2383      "percentage": "0.0"
2384    },
2385    "wr_hits": {
2386      "count": 136136,
2387      "units": "Requests",
2388      "percentage": "63.6"
2389    }
2390  },
2391  "errors": {
2392    "total": {
2393      "count": 0,
2394      "units": "Requests",
2395      "percentage": "0.0"
2396    },
2397    "cache_obj_total": {
2398      "count": 0,
2399      "units": "Requests",
2400      "percentage": "0.0"
2401    },
2402    "core_obj_total": {
2403      "count": 0,
2404      "units": "Requests",
2405      "percentage": "0.0"
2406    },
2407    "cache_obj_rd": {
2408      "count": 0,
2409      "units": "Requests",
2410      "percentage": "0.0"
2411    },
2412    "core_obj_wr": {
2413      "count": 0,
2414      "units": "Requests",
2415      "percentage": "0.0"
2416    },
2417    "core_obj_rd": {
2418      "count": 0,
2419      "units": "Requests",
2420      "percentage": "0.0"
2421    },
2422    "cache_obj_wr": {
2423      "count": 0,
2424      "units": "Requests",
2425      "percentage": "0.0"
2426    }
2427  },
2428  "blocks": {
2429    "volume_rd": {
2430      "count": 9,
2431      "units": "4KiB blocks",
2432      "percentage": "0.0"
2433    },
2434    "volume_wr": {
2435      "count": 213951,
2436      "units": "4KiB blocks",
2437      "percentage": "99.9"
2438    },
2439    "cache_obj_total": {
2440      "count": 212425,
2441      "units": "4KiB blocks",
2442      "percentage": "100.0"
2443    },
2444    "core_obj_total": {
2445      "count": 213959,
2446      "units": "4KiB blocks",
2447      "percentage": "100.0"
2448    },
2449    "cache_obj_rd": {
2450      "count": 1,
2451      "units": "4KiB blocks",
2452      "percentage": "0.0"
2453    },
2454    "core_obj_wr": {
2455      "count": 213951,
2456      "units": "4KiB blocks",
2457      "percentage": "99.9"
2458    },
2459    "volume_total": {
2460      "count": 213960,
2461      "units": "4KiB blocks",
2462      "percentage": "100.0"
2463    },
2464    "core_obj_rd": {
2465      "count": 8,
2466      "units": "4KiB blocks",
2467      "percentage": "0.0"
2468    },
2469    "cache_obj_wr": {
2470      "count": 212424,
2471      "units": "4KiB blocks",
2472      "percentage": "99.9"
2473    }
2474  ]
2475}
2476~~~
2477
2478### bdev_ocf_get_bdevs {#rpc_bdev_ocf_get_bdevs}
2479
2480Get list of OCF devices including unregistered ones.
2481
2482#### Parameters
2483
2484Name                    | Optional | Type        | Description
2485----------------------- | -------- | ----------- | -----------
2486name                    | Optional | string      | Name of OCF vbdev or name of cache device or name of core device
2487
2488#### Response
2489
2490Array of OCF devices with their current status, along with core and cache bdevs.
2491
2492#### Example
2493
2494Example request:
2495
2496~~~json
2497{
2498  "jsonrpc": "2.0",
2499  "method": "bdev_ocf_get_bdevs",
2500  "id": 1
2501}
2502~~~
2503
2504Example response:
2505
2506~~~json
2507{
2508  "jsonrpc": "2.0",
2509  "id": 1,
2510  "result": [
2511    {
2512      "name": "PartCache",
2513      "started": false,
2514      "cache": {
2515        "name": "Malloc0",
2516        "attached": true
2517      },
2518      "core": {
2519        "name": "Malloc1",
2520        "attached": false
2521      }
2522    }
2523  ]
2524}
2525~~~
2526
2527### bdev_ocf_set_cache_mode {#rpc_bdev_ocf_set_cache_mode}
2528
2529Set new cache mode on OCF bdev.
2530
2531#### Parameters
2532
2533Name                    | Optional | Type        | Description
2534----------------------- | -------- | ----------- | -----------
2535name                    | Required | string      | Bdev name
2536mode                    | Required | string      | OCF cache mode: wb, wt, pt, wa, wi, wo
2537
2538#### Response
2539
2540New cache mode name.
2541
2542#### Example
2543
2544Example request:
2545
2546~~~json
2547{
2548  "params": {
2549    "name": "ocf0",
2550    "mode": "pt",
2551  },
2552  "jsonrpc": "2.0",
2553  "method": "bdev_ocf_set_cache_mode",
2554  "id": 1
2555}
2556~~~
2557
2558Example response:
2559
2560~~~json
2561{
2562  "jsonrpc": "2.0",
2563  "id": 1,
2564  "result": "pt"
2565}
2566~~~
2567
2568### bdev_malloc_create {#rpc_bdev_malloc_create}
2569
2570Construct @ref bdev_config_malloc
2571
2572#### Parameters
2573
2574Name                    | Optional | Type        | Description
2575----------------------- | -------- | ----------- | -----------
2576name                    | Optional | string      | Bdev name to use
2577block_size              | Required | number      | Block size in bytes -must be multiple of 512
2578num_blocks              | Required | number      | Number of blocks
2579uuid                    | Optional | string      | UUID of new bdev
2580optimal_io_boundary     | Optional | number      | Split on optimal IO boundary, in number of blocks, default 0
2581
2582#### Result
2583
2584Name of newly created bdev.
2585
2586#### Example
2587
2588Example request:
2589
2590~~~json
2591{
2592  "params": {
2593    "block_size": 4096,
2594    "num_blocks": 16384,
2595    "name": "Malloc0",
2596    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90",
2597    "optimal_io_boundary": 16
2598  },
2599  "jsonrpc": "2.0",
2600  "method": "bdev_malloc_create",
2601  "id": 1
2602}
2603~~~
2604
2605Example response:
2606
2607~~~json
2608{
2609  "jsonrpc": "2.0",
2610  "id": 1,
2611  "result": "Malloc0"
2612}
2613~~~
2614
2615### bdev_malloc_delete {#rpc_bdev_malloc_delete}
2616
2617Delete @ref bdev_config_malloc
2618
2619#### Parameters
2620
2621Name                    | Optional | Type        | Description
2622----------------------- | -------- | ----------- | -----------
2623name                    | Required | string      | Bdev name
2624
2625#### Example
2626
2627Example request:
2628
2629~~~json
2630{
2631  "params": {
2632    "name": "Malloc0"
2633  },
2634  "jsonrpc": "2.0",
2635  "method": "bdev_malloc_delete",
2636  "id": 1
2637}
2638~~~
2639
2640Example response:
2641
2642~~~json
2643{
2644  "jsonrpc": "2.0",
2645  "id": 1,
2646  "result": true
2647}
2648~~~
2649
2650### bdev_null_create {#rpc_bdev_null_create}
2651
2652Construct @ref bdev_config_null
2653
2654#### Parameters
2655
2656Name                    | Optional | Type        | Description
2657----------------------- | -------- | ----------- | -----------
2658name                    | Optional | string      | Bdev name to use
2659block_size              | Required | number      | Block size in bytes
2660num_blocks              | Required | number      | Number of blocks
2661uuid                    | Optional | string      | UUID of new bdev
2662md_size                 | Optional | number      | Metadata size for this bdev. Default=0.
2663dif_type                | Optional | number      | Protection information type. Parameter --md-size needs to be set along --dif-type. Default=0 - no protection.
2664dif_is_head_of_md       | Optional | boolean     | Protection information is in the first 8 bytes of metadata. Default=false.
2665
2666#### Result
2667
2668Name of newly created bdev.
2669
2670#### Example
2671
2672Example request:
2673
2674~~~json
2675{
2676  "params": {
2677    "block_size": 4104,
2678    "num_blocks": 16384,
2679    "name": "Null0",
2680    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90",
2681    "md_size": 8,
2682    "dif_type": 1,
2683    "dif_is_head_of_md": true
2684  },
2685  "jsonrpc": "2.0",
2686  "method": "bdev_null_create",
2687  "id": 1
2688}
2689~~~
2690
2691Example response:
2692
2693~~~json
2694{
2695  "jsonrpc": "2.0",
2696  "id": 1,
2697  "result": "Null0"
2698}
2699~~~
2700
2701### bdev_null_delete {#rpc_bdev_null_delete}
2702
2703Delete @ref bdev_config_null.
2704
2705#### Parameters
2706
2707Name                    | Optional | Type        | Description
2708----------------------- | -------- | ----------- | -----------
2709name                    | Required | string      | Bdev name
2710
2711#### Example
2712
2713Example request:
2714
2715~~~json
2716{
2717  "params": {
2718    "name": "Null0"
2719  },
2720  "jsonrpc": "2.0",
2721  "method": "bdev_null_delete",
2722  "id": 1
2723}
2724~~~
2725
2726Example response:
2727
2728~~~json
2729{
2730  "jsonrpc": "2.0",
2731  "id": 1,
2732  "result": true
2733}
2734~~~
2735
2736### bdev_null_resize {#rpc_bdev_null_resize}
2737
2738Resize @ref bdev_config_null.
2739
2740#### Parameters
2741
2742Name                    | Optional | Type        | Description
2743----------------------- | -------- | ----------- | -----------
2744name                    | Required | string      | Bdev name
2745new_size                | Required | number      | Bdev new capacity in MB
2746
2747#### Example
2748
2749Example request:
2750
2751~~~json
2752{
2753  "params": {
2754    "name": "Null0",
2755    "new_size": 4096
2756  },
2757  "jsonrpc": "2.0",
2758  "method": "bdev_null_resize",
2759  "id": 1
2760}
2761~~~
2762
2763Example response:
2764
2765~~~json
2766{
2767  "jsonrpc": "2.0",
2768  "id": 1,
2769  "result": true
2770}
2771~~~
2772
2773### bdev_aio_create {#rpc_bdev_aio_create}
2774
2775Construct @ref bdev_config_aio.
2776
2777#### Parameters
2778
2779Name                    | Optional | Type        | Description
2780----------------------- | -------- | ----------- | -----------
2781name                    | Required | string      | Bdev name to use
2782filename                | Required | number      | Path to device or file
2783block_size              | Optional | number      | Block size in bytes
2784
2785#### Result
2786
2787Name of newly created bdev.
2788
2789#### Example
2790
2791Example request:
2792
2793~~~json
2794{
2795  "params": {
2796    "block_size": 4096,
2797    "name": "Aio0",
2798    "filename": "/tmp/aio_bdev_file"
2799  },
2800  "jsonrpc": "2.0",
2801  "method": "bdev_aio_create",
2802  "id": 1
2803}
2804~~~
2805
2806Example response:
2807
2808~~~json
2809{
2810  "jsonrpc": "2.0",
2811  "id": 1,
2812  "result": "Aio0"
2813}
2814~~~
2815
2816### bdev_aio_rescan {#rpc_bdev_aio_rescan}
2817
2818Rescan the size of @ref bdev_config_aio.
2819
2820#### Parameters
2821
2822Name                    | Optional | Type        | Description
2823----------------------- | -------- | ----------- | -----------
2824name                    | Required | string      | Bdev name
2825
2826#### Example
2827
2828Example request:
2829
2830~~json
2831{
2832  "params": {
2833    "name": "Aio0"
2834  },
2835  "jsonrpc": "2.0",
2836  "method": "bdev_aio_rescan",
2837  "id": 1
2838}
2839~~
2840
2841Example response:
2842
2843~~json
2844{
2845  "jsonrpc": "2.0",
2846  "id": 1,
2847  "result": true
2848}
2849~~
2850
2851### bdev_aio_delete {#rpc_bdev_aio_delete}
2852
2853Delete @ref bdev_config_aio.
2854
2855#### Parameters
2856
2857Name                    | Optional | Type        | Description
2858----------------------- | -------- | ----------- | -----------
2859name                    | Required | string      | Bdev name
2860
2861#### Example
2862
2863Example request:
2864
2865~~~json
2866{
2867  "params": {
2868    "name": "Aio0"
2869  },
2870  "jsonrpc": "2.0",
2871  "method": "bdev_aio_delete",
2872  "id": 1
2873}
2874~~~
2875
2876Example response:
2877
2878~~~json
2879{
2880  "jsonrpc": "2.0",
2881  "id": 1,
2882  "result": true
2883}
2884~~~
2885
2886### bdev_nvme_set_options {#rpc_bdev_nvme_set_options}
2887
2888Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized
2889or any bdev NVMe has been created.
2890
2891#### Parameters
2892
2893Name                       | Optional | Type        | Description
2894-------------------------- | -------- | ----------- | -----------
2895action_on_timeout          | Optional | string      | Action to take on command time out: none, reset or abort
2896timeout_us                 | Optional | number      | Timeout for each command, in microseconds. If 0, don't track timeouts
2897timeout_admin_us           | Optional | number      | Timeout for each admin command, in microseconds. If 0, treat same as io timeouts ('timeout_us')
2898keep_alive_timeout_ms      | Optional | number      | Keep alive timeout period in milliseconds, default is 10s
2899retry_count                | Optional | number      | The number of attempts per I/O before an I/O fails. (Deprecated. Please use transport_retry_count instead.)
2900arbitration_burst          | Optional | number      | The value is expressed as a power of two, a value of 111b indicates no limit
2901low_priority_weight        | Optional | number      | The maximum number of commands that the controller may launch at one time from a low priority queue
2902medium_priority_weight     | Optional | number      | The maximum number of commands that the controller may launch at one time from a medium priority queue
2903high_priority_weight       | Optional | number      | The maximum number of commands that the controller may launch at one time from a high priority queue
2904nvme_adminq_poll_period_us | Optional | number      | How often the admin queue is polled for asynchronous events in microseconds
2905nvme_ioq_poll_period_us    | Optional | number      | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible).
2906io_queue_requests          | Optional | number      | The number of requests allocated for each NVMe I/O queue. Default: 512.
2907delay_cmd_submit           | Optional | boolean     | Enable delaying NVMe command submission to allow batching of multiple commands. Default: `true`.
2908transport_retry_count      | Optional | number      | The number of attempts per I/O in the transport layer before an I/O fails.
2909bdev_retry_count           | Optional | number      | The number of attempts per I/O in the bdev layer before an I/O fails. -1 means infinite retries.
2910transport_ack_timeout      | Optional | number      | Time to wait ack until packet retransmission. RDMA specific. Range 0-31 where 0 is driver-specific default value.
2911
2912#### Example
2913
2914Example request:
2915
2916~~~json
2917request:
2918{
2919  "params": {
2920    "transport_retry_count": 5,
2921    "arbitration_burst": 3,
2922    "low_priority_weight": 8,
2923    "medium_priority_weight":8,
2924    "high_priority_weight": 8,
2925    "nvme_adminq_poll_period_us": 2000,
2926    "timeout_us": 10000000,
2927    "timeout_admin_us": 20000000,
2928    "keep_alive_timeout_ms": 600000,
2929    "action_on_timeout": "reset",
2930    "io_queue_requests" : 2048,
2931    "delay_cmd_submit": true
2932  },
2933  "jsonrpc": "2.0",
2934  "method": "bdev_nvme_set_options",
2935  "id": 1
2936}
2937~~~
2938
2939Example response:
2940
2941~~~json
2942{
2943  "jsonrpc": "2.0",
2944  "id": 1,
2945  "result": true
2946}
2947~~~
2948
2949### bdev_nvme_set_hotplug {#rpc_bdev_nvme_set_hotplug}
2950
2951Change settings of the NVMe hotplug feature. If enabled, PCIe NVMe bdevs will be automatically discovered on insertion
2952and deleted on removal.
2953
2954#### Parameters
2955
2956Name                    | Optional | Type        | Description
2957----------------------- | -------- | ----------- | -----------
2958enabled                 | Required | string      | True to enable, false to disable
2959period_us               | Optional | number      | How often to poll for hot-insert and hot-remove events. Values: 0 - reset/use default or 1 to 10000000.
2960
2961#### Example
2962
2963Example request:
2964
2965~~~json
2966request:
2967{
2968  "params": {
2969    "enabled": true,
2970    "period_us": 2000
2971  },
2972  "jsonrpc": "2.0",
2973  "method": "bdev_nvme_set_hotplug",
2974  "id": 1
2975}
2976~~~
2977
2978Example response:
2979
2980~~~json
2981{
2982  "jsonrpc": "2.0",
2983  "id": 1,
2984  "result": true
2985}
2986~~~
2987
2988### bdev_nvme_attach_controller {#rpc_bdev_nvme_attach_controller}
2989
2990Construct @ref bdev_config_nvme. This RPC can also be used to add additional paths to an existing controller to enable
2991multipathing. This is done by specifying the `name` parameter as an existing controller. When adding an additional
2992path, the hostnqn, hostsvcid, hostaddr, prchk_reftag, and prchk_guard_arguments must not be specified and are assumed
2993to have the same value as the existing path.
2994
2995The parameters, `ctrlr_loss_timeout_sec`, `reconnect_delay_sec`, and `fast_io_fail_timeout_sec`, are mutually dependent.
2996If `reconnect_delay_sec` is non-zero, `ctrlr_loss_timeout_sec` has to be -1 or not less than `reconnect_delay_sec`.
2997If `reconnect_delay_sec` is zero, `ctrlr_loss_timeout_sec` has to be zero.
2998If `fast_io_fail_timeout_sec` is not zero, it has to be not less than `reconnect_delay_sec` and less than `ctrlr_loss_timeout_sec` if `ctrlr_loss_timeout_sec` is not -1.
2999
3000#### Result
3001
3002Array of names of newly created bdevs.
3003
3004#### Parameters
3005
3006Name                       | Optional | Type        | Description
3007-------------------------- | -------- | ----------- | -----------
3008name                       | Required | string      | Name of the NVMe controller, prefix for each bdev name
3009trtype                     | Required | string      | NVMe-oF target trtype: rdma or pcie
3010traddr                     | Required | string      | NVMe-oF target address: ip or BDF
3011adrfam                     | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
3012trsvcid                    | Optional | string      | NVMe-oF target trsvcid: port number
3013subnqn                     | Optional | string      | NVMe-oF target subnqn
3014hostnqn                    | Optional | string      | NVMe-oF target hostnqn
3015hostaddr                   | Optional | string      | NVMe-oF host address: ip address
3016hostsvcid                  | Optional | string      | NVMe-oF host trsvcid: port number
3017prchk_reftag               | Optional | bool        | Enable checking of PI reference tag for I/O processing
3018prchk_guard                | Optional | bool        | Enable checking of PI guard for I/O processing
3019hdgst                      | Optional | bool        | Enable TCP header digest
3020ddgst                      | Optional | bool        | Enable TCP data digest
3021fabrics_connect_timeout_us | Optional | bool        | Timeout for fabrics connect (in microseconds)
3022multipath                  | Optional | string      | Multipathing behavior: disable, failover, multipath. Default is failover.
3023num_io_queues              | Optional | uint32_t    | The number of IO queues to request during initialization. Range: (0, UINT16_MAX + 1], Default is 1024.
3024ctrlr_loss_timeout_sec     | Optional | number      | Time to wait until ctrlr is reconnected before deleting ctrlr.  -1 means infinite reconnects. 0 means no reconnect.
3025reconnect_delay_sec        | Optional | number      | Time to delay a reconnect trial. 0 means no reconnect.
3026fast_io_fail_timeout_sec   | Optional | number      | Time to wait until ctrlr is reconnected before failing I/O to ctrlr. 0 means no such timeout.
3027
3028#### Example
3029
3030Example request:
3031
3032~~~json
3033{
3034  "params": {
3035    "trtype": "pcie",
3036    "name": "Nvme0",
3037    "traddr": "0000:0a:00.0"
3038  },
3039  "jsonrpc": "2.0",
3040  "method": "bdev_nvme_attach_controller",
3041  "id": 1
3042}
3043~~~
3044
3045Example response:
3046
3047~~~json
3048{
3049  "jsonrpc": "2.0",
3050  "id": 1,
3051  "result": [
3052    "Nvme0n1"
3053  ]
3054}
3055~~~
3056
3057### bdev_nvme_get_controllers {#rpc_bdev_nvme_get_controllers}
3058
3059Get information about NVMe controllers.
3060
3061#### Parameters
3062
3063The user may specify no parameters in order to list all NVMe controllers, or one NVMe controller may be
3064specified by name.
3065
3066Name                    | Optional | Type        | Description
3067----------------------- | -------- | ----------- | -----------
3068name                    | Optional | string      | NVMe controller name
3069
3070#### Response
3071
3072The response is an array of objects containing information about the requested NVMe controllers.
3073
3074#### Example
3075
3076Example request:
3077
3078~~~json
3079{
3080  "jsonrpc": "2.0",
3081  "id": 1,
3082  "method": "bdev_nvme_get_controllers",
3083  "params": {
3084    "name": "Nvme0"
3085  }
3086}
3087~~~
3088
3089Example response:
3090
3091~~~json
3092{
3093  "jsonrpc": "2.0",
3094  "id": 1,
3095  "result": [
3096    {
3097      "name": "Nvme0",
3098      "trid": {
3099        "trtype": "PCIe",
3100        "traddr": "0000:05:00.0"
3101      }
3102    }
3103  ]
3104}
3105~~~
3106
3107### bdev_nvme_detach_controller {#rpc_bdev_nvme_detach_controller}
3108
3109Detach NVMe controller and delete any associated bdevs. Optionally,
3110If all of the transport ID options are specified, only remove that
3111transport path from the specified controller. If that is the only
3112available path for the controller, this will also result in the
3113controller being detached and the associated bdevs being deleted.
3114
3115returns true if the controller and bdevs were successfully destroyed
3116or the address was properly removed, false otherwise.
3117
3118#### Parameters
3119
3120Name                    | Optional | Type        | Description
3121----------------------- | -------- | ----------- | -----------
3122name                    | Required | string      | Controller name
3123trtype                  | Optional | string      | NVMe-oF target trtype: rdma or tcp
3124traddr                  | Optional | string      | NVMe-oF target address: ip or BDF
3125adrfam                  | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
3126trsvcid                 | Optional | string      | NVMe-oF target trsvcid: port number
3127subnqn                  | Optional | string      | NVMe-oF target subnqn
3128hostaddr                | Optional | string      | NVMe-oF host address: ip
3129hostsvcid               | Optional | string      | NVMe-oF host svcid: port number
3130
3131#### Example
3132
3133Example requests:
3134
3135~~~json
3136{
3137  "params": {
3138    "name": "Nvme0"
3139  },
3140  "jsonrpc": "2.0",
3141  "method": "bdev_nvme_detach_controller",
3142  "id": 1
3143}
3144~~~
3145
3146Example response:
3147
3148~~~json
3149{
3150  "jsonrpc": "2.0",
3151  "id": 1,
3152  "result": true
3153}
3154~~~
3155
3156### bdev_nvme_reset_controller {#rpc_bdev_nvme_reset_controller}
3157
3158Reset NVMe controller.
3159
3160Returns true if the controller reset was successful, false otherwise.
3161
3162#### Parameters
3163
3164Name                    | Optional | Type        | Description
3165----------------------- | -------- | ----------- | -----------
3166name                    | Required | string      | NVMe controller name
3167
3168#### Example
3169
3170Example request:
3171
3172~~~json
3173{
3174  "jsonrpc": "2.0",
3175  "id": 1,
3176  "method": "bdev_nvme_reset_controller",
3177  "params": {
3178    "name": "Nvme0"
3179  }
3180}
3181~~~
3182
3183Example response:
3184
3185~~~json
3186{
3187  "jsonrpc": "2.0",
3188  "id": 1,
3189  "result": true
3190}
3191~~~
3192
3193### bdev_nvme_start_discovery {#rpc_bdev_nvme_start_discovery}
3194
3195Start a discovery service for the discovery subsystem of the specified transport ID.
3196
3197The discovery service will read the discovery log page for the specified
3198discovery subsystem, and automatically attach to any subsystems found in the
3199log page. When determining a controller name to use when attaching, it will use
3200the 'name' parameter as a prefix, followed by a unique integer for that discovery
3201service. If the discovery service identifies a subsystem that has been previously
3202attached but is listed with a different path, it will use the same controller name
3203as the previous entry, and connect as a multipath.
3204
3205When the discovery service sees that a subsystem entry has been removed
3206from the log page, it will automatically detach from that controller as well.
3207
3208The 'name' is also used to later stop the discovery service.
3209
3210#### Parameters
3211
3212Name                       | Optional | Type        | Description
3213-------------------------- | -------- | ----------- | -----------
3214name                       | Required | string      | Prefix for NVMe controllers
3215trtype                     | Required | string      | NVMe-oF target trtype: rdma or tcp
3216traddr                     | Required | string      | NVMe-oF target address: ip
3217adrfam                     | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6
3218trsvcid                    | Optional | string      | NVMe-oF target trsvcid: port number
3219hostnqn                    | Optional | string      | NVMe-oF target hostnqn
3220
3221#### Example
3222
3223Example request:
3224
3225~~~json
3226{
3227  "jsonrpc": "2.0",
3228  "method": "bdev_nvme_start_discovery",
3229  "id": 1,
3230  "params": {
3231    "name": "nvme_auto",
3232    "trtype": "tcp",
3233    "traddr": "127.0.0.1",
3234    "hostnqn": "nqn.2021-12.io.spdk:host1",
3235    "adrfam": "ipv4",
3236    "trsvcid": "4420"
3237  }
3238}
3239~~~
3240
3241Example response:
3242
3243~~~json
3244{
3245  "jsonrpc": "2.0",
3246  "id": 1,
3247  "result": true
3248}
3249~~~
3250
3251### bdev_nvme_stop_discovery {#rpc_bdev_nvme_stop_discovery}
3252
3253Stop a discovery service. This includes detaching any controllers that were
3254discovered via the service that is being stopped.
3255
3256#### Parameters
3257
3258Name                       | Optional | Type        | Description
3259-------------------------- | -------- | ----------- | -----------
3260name                       | Required | string      | Name of service to stop
3261
3262#### Example
3263
3264Example request:
3265
3266~~~json
3267{
3268  "jsonrpc": "2.0",
3269  "method": "bdev_nvme_stop_discovery",
3270  "id": 1,
3271  "params": {
3272    "name": "nvme_auto"
3273  }
3274}
3275~~~
3276
3277Example response:
3278
3279~~~json
3280{
3281  "jsonrpc": "2.0",
3282  "id": 1,
3283  "result": true
3284}
3285~~~
3286
3287### bdev_nvme_cuse_register {#rpc_bdev_nvme_cuse_register}
3288
3289Register CUSE device on NVMe controller.
3290This feature is considered as experimental.
3291
3292#### Parameters
3293
3294Name                    | Optional | Type        | Description
3295----------------------- | -------- | ----------- | -----------
3296name                    | Required | string      | Name of the NVMe controller
3297dev_path                | Required | string      | Path to the CUSE controller device, e.g. spdk/nvme0
3298
3299#### Example
3300
3301Example request:
3302
3303~~~json
3304{
3305  "params": {
3306    "dev_path": "spdk/nvme0",
3307    "name": "Nvme0"
3308  },
3309  "jsonrpc": "2.0",
3310  "method": "bdev_nvme_cuse_register",
3311  "id": 1
3312}
3313~~~
3314
3315Example response:
3316
3317~~~json
3318{
3319  "jsonrpc": "2.0",
3320  "id": 1,
3321  "result": true
3322}
3323~~~
3324
3325### bdev_nvme_cuse_unregister {#rpc_bdev_nvme_cuse_unregister}
3326
3327Unregister CUSE device on NVMe controller.
3328This feature is considered as experimental.
3329
3330#### Parameters
3331
3332Name                    | Optional | Type        | Description
3333----------------------- | -------- | ----------- | -----------
3334name                    | Required | string      | Name of the NVMe controller
3335
3336#### Example
3337
3338Example request:
3339
3340~~~json
3341{
3342  "params": {
3343    "name": "Nvme0"
3344  },
3345  "jsonrpc": "2.0",
3346  "method": "bdev_nvme_cuse_unregister",
3347  "id": 1
3348}
3349~~~
3350
3351Example response:
3352
3353~~~json
3354{
3355  "jsonrpc": "2.0",
3356  "id": 1,
3357  "result": true
3358}
3359~~~
3360
3361### bdev_zone_block_create {#rpc_bdev_zone_block_create}
3362
3363Creates a virtual zone device on top of existing non-zoned bdev.
3364
3365#### Parameters
3366
3367Name                    | Optional | Type        | Description
3368----------------------- | -------- | ----------- | -----------
3369name                    | Required | string      | Name of the Zone device
3370base_bdev               | Required | string      | Name of the Base bdev
3371zone_capacity           | Required | number      | Zone capacity in blocks
3372optimal_open_zones      | Required | number      | Number of zones required to reach optimal write speed
3373
3374#### Example
3375
3376Example request:
3377
3378~~~json
3379{
3380  "jsonrpc": "2.0",
3381  "method": "bdev_zone_block_create",
3382  "id": 1,
3383  "params": {
3384    "name": "zone1",
3385    "base_bdev": "NVMe0n1",
3386    "zone_capacity": 4096,
3387    "optimal_open_zones": 32
3388  }
3389}
3390~~~
3391
3392Example response:
3393
3394~~~json
3395{
3396  "jsonrpc": "2.0",
3397  "id": 1,
3398  "result": "zone1"
3399}
3400~~~
3401
3402### bdev_zone_block_delete {#rpc_bdev_zone_block_delete}
3403
3404Deletes a virtual zone device.
3405
3406#### Parameters
3407
3408Name                    | Optional | Type        | Description
3409----------------------- | -------- | ----------- | -----------
3410name                    | Required | string      | Name of the Zone device
3411
3412#### Example
3413
3414Example request:
3415
3416~~~json
3417{
3418  "jsonrpc": "2.0",
3419  "method": "bdev_zone_block_delete",
3420  "id": 1,
3421  "params": {
3422    "name": "zone1"
3423  }
3424}
3425~~~
3426
3427Example response:
3428
3429~~~json
3430{
3431  "jsonrpc": "2.0",
3432  "id": 1,
3433  "result": true
3434}
3435~~~
3436
3437### bdev_nvme_apply_firmware {#rpc_bdev_nvme_apply_firmware}
3438
3439Download and commit firmware to NVMe device.
3440
3441#### Parameters
3442
3443Name                    | Optional | Type        | Description
3444----------------------- | -------- | ----------- | -----------
3445filename                | Required | string      | filename of the firmware to download
3446bdev_name               | Required | string      | Name of the NVMe block device
3447
3448#### Example
3449
3450Example request:
3451
3452~~~json
3453{
3454  "jsonrpc": "2.0",
3455  "method": "bdev_nvme_apply_firmware",
3456  "id": 1,
3457  "params": {
3458    "filename": "firmware_file",
3459    "bdev_name": "NVMe0n1"
3460  }
3461}
3462~~~
3463
3464### bdev_nvme_get_transport_statistics {#rpc_bdev_nvme_get_transport_statistics}
3465
3466Get bdev_nvme poll group transport statistics.
3467
3468#### Parameters
3469
3470This RPC method accepts no parameters
3471
3472#### Response
3473
3474The response is an array of objects containing information about transport statistics per NVME poll group.
3475
3476#### Example
3477
3478Example request:
3479
3480~~~json
3481{
3482  "jsonrpc": "2.0",
3483  "id": 1,
3484  "method": "bdev_nvme_get_transport_statistics",
3485}
3486~~~
3487
3488Example response:
3489
3490~~~json
3491{
3492  "jsonrpc": "2.0",
3493  "id": 1,
3494	"result": {
3495	  "poll_groups": [
3496		{
3497		  "thread": "nvmf_tgt_poll_group_0",
3498		  "transports": [
3499			{
3500			  "trname": "RDMA",
3501			  "devices": [
3502				{
3503				  "dev_name": "mlx5_1",
3504				  "polls": 137492169,
3505				  "idle_polls": 137492169,
3506				  "completions": 0,
3507				  "queued_requests": 0,
3508				  "total_send_wrs": 0,
3509				  "send_sq_doorbell_updates": 0,
3510				  "total_recv_wrs": 0,
3511				  "recv_sq_doorbell_updates": 0
3512				},
3513				{
3514				  "dev_name": "mlx5_0",
3515				  "polls": 137985185,
3516				  "idle_polls": 137492169,
3517				  "completions": 1474593,
3518				  "queued_requests": 0,
3519				  "total_send_wrs": 1474593,
3520				  "send_sq_doorbell_updates": 426147,
3521				  "total_recv_wrs": 1474721,
3522				  "recv_sq_doorbell_updates": 348445
3523				}
3524			  ]
3525			},
3526			{
3527			  "trname": "PCIE",
3528			  "polls": 435419831,
3529			  "idle_polls": 434901004,
3530			  "completions": 1485543,
3531			  "cq_doorbell_updates": 518827,
3532			  "queued_requests": 0,
3533			  "submitted_requests": 1485543,
3534			  "sq_doobell_updates": 516081
3535			}
3536		  ]
3537		},
3538		{
3539		  "thread": "nvmf_tgt_poll_group_1",
3540		  "transports": [
3541			{
3542			  "trname": "RDMA",
3543			  "devices": [
3544				{
3545				  "dev_name": "mlx5_1",
3546				  "polls": 140245630,
3547				  "idle_polls": 140245630,
3548				  "completions": 0,
3549				  "queued_requests": 0,
3550				  "total_send_wrs": 0,
3551				  "send_sq_doorbell_updates": 0,
3552				  "total_recv_wrs": 0,
3553				  "recv_sq_doorbell_updates": 0
3554				},
3555				{
3556				  "dev_name": "mlx5_0",
3557				  "polls": 140751844,
3558				  "idle_polls": 140245630,
3559				  "completions": 1489298,
3560				  "queued_requests": 0,
3561				  "total_send_wrs": 1489298,
3562				  "send_sq_doorbell_updates": 433510,
3563				  "total_recv_wrs": 1489426,
3564				  "recv_sq_doorbell_updates": 357956
3565				}
3566			  ]
3567			},
3568			{
3569			  "trname": "PCIE",
3570			  "polls": 429044294,
3571			  "idle_polls": 428525658,
3572			  "completions": 1478730,
3573			  "cq_doorbell_updates": 518636,
3574			  "queued_requests": 0,
3575			  "submitted_requests": 1478730,
3576			  "sq_doobell_updates": 511658
3577			}
3578		  ]
3579		}
3580	  ]
3581	}
3582}
3583~~~
3584
3585### bdev_nvme_get_controller_health_info {#rpc_bdev_nvme_get_controller_health_info}
3586
3587Display health log of the required NVMe bdev device.
3588
3589#### Parameters
3590
3591Name                    | Optional | Type        | Description
3592----------------------- | -------- | ----------- | -----------
3593name                    | Required | string      | Name of the NVMe bdev controller
3594
3595#### Response
3596
3597The response is the object containing information about health log of the NVMe controller.
3598
3599#### Example
3600
3601Example request:
3602
3603~~~json
3604{
3605  "jsonrpc": "2.0",
3606  "method": "bdev_nvme_get_controller_health_info",
3607  "id": 1,
3608  "params": {
3609    "name": "Nvme0"
3610  }
3611}
3612~~~
3613
3614Example response:
3615
3616~~~json
3617{
3618  "model_number": "INTEL SSDPE2KX020T8",
3619  "serial_number": "BTLJ72430ARH2P0BGN",
3620  "firmware_revision": "VDV10110",
3621  "traddr": "0000:08:00.0",
3622  "temperature_celsius": 32,
3623  "available_spare_percentage": 99,
3624  "available_spare_threshold_percentage": 10,
3625  "percentage_used": 2,
3626  "data_units_read": 1013408619,
3627  "data_units_written": 346792685,
3628  "host_read_commands": 30457773282,
3629  "host_write_commands": 18949677715,
3630  "controller_busy_time": 4979,
3631  "power_cycles": 49,
3632  "power_on_hours": 31118,
3633  "unsafe_shutdowns": 18,
3634  "media_errors": 17,
3635  "num_err_log_entries": 19,
3636  "warning_temperature_time_minutes": 0,
3637  "critical_composite_temperature_time_minutes": 0
3638}
3639~~~
3640
3641### bdev_rbd_register_cluster {#rpc_bdev_rbd_register_cluster}
3642
3643This method is available only if SPDK was build with Ceph RBD support.
3644
3645#### Parameters
3646
3647Name                    | Optional | Type        | Description
3648----------------------- | -------- | ----------- | -----------
3649name                    | Required | string      | Registerd Rados cluster object name
3650user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
3651config_param            | Optional | string map  | Explicit librados configuration
3652config_file             | Optional | string      | File path of libraodos configuration file
3653key_file                | Optional | string      | File path of libraodos key file
3654
3655This RPC registers a Rados Cluster object handle which is only known
3656to rbd module, it uses user_id + config_param or user_id + config_file +
3657key_file or user_id + config_param + config_file + key_file to identify
3658a Rados cluster object.
3659
3660When accessing the Ceph cluster as some user other than "admin" (the
3661default), the "user_id" has to be set.
3662
3663The configuration items and secret key can be specified by setting config_param,
3664config_file and key_file, all of them, or none of them. If only config_param is
3665passed, all key/value pairs are passed to rados_conf_set to configure cluster access.
3666In practice, "mon_host" (= list of monitor address+port) and "key" (= the secret key
3667stored in Ceph keyrings) are enough. If config_file and key_file are specified, they must
3668exist with all relevant settings for accessing the Ceph cluster. If config_param, config_file
3669and key_file are specified, get the key/value pairs from config_file first and set to
3670rados_conf_set function, then set pairs in config_param and keyring in key_file. If nothing
3671is specified, it will get configuration file and key file from the default location
3672/etc/ceph/ceph.conf and /etc/ceph/ceph.client.user_id.keyring.
3673
3674#### Result
3675
3676Name of newly created Rados cluster object.
3677
3678#### Example
3679
3680Example request:
3681
3682~~
3683{
3684  "params": {
3685    "name": "rbd_cluster",
3686    "user_id": cinder,
3687    "config_file": "/root/ceph_conf/ceph.conf",
3688    "key_file": "/root/ceph_conf/ceph.client.cinder.keyring"
3689  },
3690  "jsonrpc": "2.0",
3691  "method": "bdev_rbd_register_cluster",
3692  "id": 1
3693}
3694~~
3695
3696Example response:
3697
3698~~
3699response:
3700{
3701  "jsonrpc": "2.0",
3702  "id": 1,
3703  "result": "rbd_cluster"
3704}
3705~~
3706
3707### bdev_rbd_unregister_cluster {#rpc_bdev_rbd_unregister_cluster}
3708
3709This method is available only if SPDK was build with Ceph RBD support.
3710If there is still rbd bdev using this cluster, the unregisteration operation
3711will fail.
3712
3713#### Result
3714
3715`true` if Rados cluster object with provided name was deleted or `false` otherwise.
3716
3717#### Parameters
3718
3719Name                    | Optional | Type        | Description
3720----------------------- | -------- | ----------- | -------------------------
3721name                    | Required | string      | Rados cluster object name
3722
3723#### Example
3724
3725Example request:
3726
3727~~
3728{
3729  "params": {
3730    "name": "rbd_cluster"
3731  },
3732  "jsonrpc": "2.0",
3733  "method": "bdev_rbd_unregister_cluster",
3734  "id": 1
3735}
3736~~
3737
3738Example response:
3739
3740~~
3741{
3742  "jsonrpc": "2.0",
3743  "id": 1,
3744  "result": true
3745}
3746~~
3747
3748### bdev_rbd_get_clusters_info {#rpc_bdev_rbd_get_clusters_info}
3749
3750This method is available only if SPDK was build with Ceph RBD support.
3751
3752#### Result
3753
3754Returns the cluster info of the Rados Cluster name if provided. Otherwise, it
3755returns the cluster info of every registered Raods Cluster name.
3756
3757#### Parameters
3758
3759Name                    | Optional | Type        | Description
3760----------------------- | -------- | ----------- | -------------------------
3761name                    | Optional | string      | Rados cluster object name
3762
3763#### Example
3764
3765Example request:
3766
3767~~
3768{
3769  "params": {
3770    "name": "rbd_cluster"
3771  },
3772  "jsonrpc": "2.0",
3773  "method": "bdev_rbd_get_clusters_info",
3774  "id": 1
3775}
3776~~
3777
3778Example response:
3779
3780~~
3781{
3782  "jsonrpc": "2.0",
3783  "cluster_name": "rbd_cluster"
3784}
3785~~
3786
3787### bdev_rbd_create {#rpc_bdev_rbd_create}
3788
3789Create @ref bdev_config_rbd bdev
3790
3791This method is available only if SPDK was build with Ceph RBD support.
3792
3793#### Parameters
3794
3795Name                    | Optional | Type        | Description
3796----------------------- | -------- | ----------- | -----------
3797name                    | Optional | string      | Bdev name
3798user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
3799pool_name               | Required | string      | Pool name
3800rbd_name                | Required | string      | Image name
3801block_size              | Required | number      | Block size
3802config                  | Optional | string map  | Explicit librados configuration
3803cluster_name            | Optional | string      | Rados cluster object name created in this module.
3804uuid                    | Optional | string      | UUID of new bdev
3805
3806If no config is specified, Ceph configuration files must exist with
3807all relevant settings for accessing the pool. If a config map is
3808passed, the configuration files are ignored and instead all key/value
3809pairs are passed to rados_conf_set to configure cluster access. In
3810practice, "mon_host" (= list of monitor address+port) and "key" (= the
3811secret key stored in Ceph keyrings) are enough.
3812
3813When accessing the image as some user other than "admin" (the
3814default), the "user_id" has to be set.
3815
3816If provided with cluster_name option, it will use the Rados cluster object
3817referenced by the name (created by bdev_rbd_register_cluster RPC) and ignores
3818"user_id + config" combination to create its own Rados cluster.
3819
3820#### Result
3821
3822Name of newly created bdev.
3823
3824#### Example
3825
3826Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`:
3827
3828~~~json
3829{
3830  "params": {
3831    "pool_name": "rbd",
3832    "rbd_name": "foo",
3833    "config": {
3834      "mon_host": "192.168.7.1:6789,192.168.7.2:6789",
3835      "key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ==",
3836    }
3837    "block_size": 4096,
3838    "uuid": "76210ea4-7920-40a0-a07b-8992a7443c76"
3839  },
3840  "jsonrpc": "2.0",
3841  "method": "bdev_rbd_create",
3842  "id": 1
3843}
3844~~~
3845
3846Example response:
3847
3848~~~json
3849response:
3850{
3851  "jsonrpc": "2.0",
3852  "id": 1,
3853  "result": "Ceph0"
3854}
3855~~~
3856
3857Example request with `cluster_name`:
3858
3859~~
3860{
3861  "params": {
3862    "pool_name": "rbd",
3863    "rbd_name": "foo",
3864    "block_size": 4096,
3865    "cluster_name": "rbd_cluster"
3866  },
3867  "jsonrpc": "2.0",
3868  "method": "bdev_rbd_create",
3869  "id": 1
3870}
3871~~
3872
3873Example response:
3874
3875~~
3876response:
3877{
3878  "jsonrpc": "2.0",
3879  "id": 1,
3880  "result": "Ceph0"
3881}
3882~~
3883
3884### bdev_rbd_delete {#rpc_bdev_rbd_delete}
3885
3886Delete @ref bdev_config_rbd bdev
3887
3888This method is available only if SPDK was build with Ceph RBD support.
3889
3890#### Result
3891
3892`true` if bdev with provided name was deleted or `false` otherwise.
3893
3894#### Parameters
3895
3896Name                    | Optional | Type        | Description
3897----------------------- | -------- | ----------- | -----------
3898name                    | Required | string      | Bdev name
3899
3900#### Example
3901
3902Example request:
3903
3904~~~json
3905{
3906  "params": {
3907    "name": "Rbd0"
3908  },
3909  "jsonrpc": "2.0",
3910  "method": "bdev_rbd_delete",
3911  "id": 1
3912}
3913~~~
3914
3915Example response:
3916
3917~~~json
3918{
3919  "jsonrpc": "2.0",
3920  "id": 1,
3921  "result": true
3922}
3923~~~
3924
3925### bdev_rbd_resize {#rpc_bdev_rbd_resize}
3926
3927Resize @ref bdev_config_rbd bdev
3928
3929This method is available only if SPDK was build with Ceph RBD support.
3930
3931#### Result
3932
3933`true` if bdev with provided name was resized or `false` otherwise.
3934
3935#### Parameters
3936
3937Name                    | Optional | Type        | Description
3938----------------------- | -------- | ----------- | -----------
3939name                    | Required | string      | Bdev name
3940new_size                | Required | int         | New bdev size for resize operation in MiB
3941
3942#### Example
3943
3944Example request:
3945
3946~~~json
3947{
3948  "params": {
3949    "name": "Rbd0"
3950    "new_size": "4096"
3951  },
3952  "jsonrpc": "2.0",
3953  "method": "bdev_rbd_resize",
3954  "id": 1
3955}
3956~~~
3957
3958Example response:
3959
3960~~~json
3961{
3962  "jsonrpc": "2.0",
3963  "id": 1,
3964  "result": true
3965}
3966~~~
3967
3968### bdev_delay_create {#rpc_bdev_delay_create}
3969
3970Create delay bdev. This bdev type redirects all IO to it's base bdev and inserts a delay on the completion
3971path to create an artificial drive latency. All latency values supplied to this bdev should be in microseconds.
3972
3973#### Parameters
3974
3975Name                    | Optional | Type        | Description
3976----------------------- | -------- | ----------- | -----------
3977name                    | Required | string      | Bdev name
3978base_bdev_name          | Required | string      | Base bdev name
3979avg_read_latency        | Required | number      | average read latency (us)
3980p99_read_latency        | Required | number      | p99 read latency (us)
3981avg_write_latency       | Required | number      | average write latency (us)
3982p99_write_latency       | Required | number      | p99 write latency (us)
3983
3984#### Result
3985
3986Name of newly created bdev.
3987
3988#### Example
3989
3990Example request:
3991
3992~~~json
3993{
3994  "params": {
3995    "base_bdev_name": "Null0",
3996    "name": "Delay0",
3997    "avg_read_latency": "15",
3998    "p99_read_latency": "50",
3999    "avg_write_latency": "40",
4000    "p99_write_latency": "110",
4001  },
4002  "jsonrpc": "2.0",
4003  "method": "bdev_delay_create",
4004  "id": 1
4005}
4006~~~
4007
4008Example response:
4009
4010~~~json
4011{
4012  "jsonrpc": "2.0",
4013  "id": 1,
4014  "result": "Delay0"
4015}
4016~~~
4017
4018### bdev_delay_delete {#rpc_bdev_delay_delete}
4019
4020Delete delay bdev.
4021
4022#### Parameters
4023
4024Name                    | Optional | Type        | Description
4025----------------------- | -------- | ----------- | -----------
4026name                    | Required | string      | Bdev name
4027
4028#### Example
4029
4030Example request:
4031
4032~~~json
4033{
4034  "params": {
4035    "name": "Delay0"
4036  },
4037  "jsonrpc": "2.0",
4038  "method": "bdev_delay_delete",
4039  "id": 1
4040}
4041
4042~~~
4043
4044Example response:
4045
4046~~~json
4047{
4048  "jsonrpc": "2.0",
4049  "id": 1,
4050  "result": true
4051}
4052~~~
4053
4054### bdev_delay_update_latency {#rpc_bdev_delay_update_latency}
4055
4056Update a target latency value associated with a given delay bdev. Any currently
4057outstanding I/O will be completed with the old latency.
4058
4059#### Parameters
4060
4061Name                    | Optional | Type        | Description
4062----------------------- | -------- | ----------- | -----------
4063delay_bdev_name         | Required | string      | Name of the delay bdev
4064latency_type            | Required | string      | One of: avg_read, avg_write, p99_read, p99_write
4065latency_us              | Required | number      | The new latency value in microseconds
4066
4067#### Result
4068
4069Name of newly created bdev.
4070
4071#### Example
4072
4073Example request:
4074
4075~~~json
4076{
4077  "params": {
4078    "delay_bdev_name": "Delay0",
4079    "latency_type": "avg_read",
4080    "latency_us": "100",
4081  },
4082  "jsonrpc": "2.0",
4083  "method": "bdev_delay_update_latency",
4084  "id": 1
4085}
4086~~~
4087
4088Example response:
4089
4090~~~json
4091{
4092  "result": "true"
4093}
4094~~~
4095
4096### bdev_error_create {#rpc_bdev_error_create}
4097
4098Construct error bdev.
4099
4100#### Parameters
4101
4102Name                    | Optional | Type        | Description
4103----------------------- | -------- | ----------- | -----------
4104base_name               | Required | string      | Base bdev name
4105
4106#### Example
4107
4108Example request:
4109
4110~~~json
4111{
4112  "params": {
4113    "base_name": "Malloc0"
4114  },
4115  "jsonrpc": "2.0",
4116  "method": "bdev_error_create",
4117  "id": 1
4118}
4119~~~
4120
4121Example response:
4122
4123~~~json
4124{
4125  "jsonrpc": "2.0",
4126  "id": 1,
4127  "result": true
4128}
4129~~~
4130
4131### bdev_error_delete {#rpc_bdev_error_delete}
4132
4133Delete error bdev
4134
4135#### Result
4136
4137`true` if bdev with provided name was deleted or `false` otherwise.
4138
4139#### Parameters
4140
4141Name                    | Optional | Type        | Description
4142----------------------- | -------- | ----------- | -----------
4143name                    | Required | string      | Error bdev name
4144
4145#### Example
4146
4147Example request:
4148
4149~~~json
4150{
4151  "params": {
4152    "name": "EE_Malloc0"
4153  },
4154  "jsonrpc": "2.0",
4155  "method": "bdev_error_delete",
4156  "id": 1
4157}
4158~~~
4159
4160Example response:
4161
4162~~~json
4163{
4164  "jsonrpc": "2.0",
4165  "id": 1,
4166  "result": true
4167}
4168~~~
4169
4170### bdev_error_inject_error {#rpc_bdev_error_inject_error}
4171
4172Inject an error via an error bdev. Create an error bdev on base bdev first. Default 'num'
4173value is 1 and if 'num' is set to zero, the specified injection is disabled.
4174
4175#### Parameters
4176
4177Name                    | Optional | Type        | Description
4178----------------------- | -------- | ----------- | -----------
4179name                    | Required | string      | Name of the error injection bdev
4180io_type                 | Required | string      | io type 'clear' 'read' 'write' 'unmap' 'flush' 'all'
4181error_type              | Required | string      | error type 'failure' 'pending'
4182num                     | Optional | int         | the number of commands you want to fail.(default:1)
4183
4184#### Example
4185
4186Example request:
4187
4188~~~json
4189{
4190  "jsonrpc": "2.0",
4191  "method": "bdev_error_inject_error",
4192  "id": 1,
4193  "params": {
4194    "name": "EE_Malloc0",
4195    "io_type": "write",
4196    "error_type": "pending",
4197    "num": 1
4198  }
4199}
4200~~~
4201
4202Example response:
4203
4204~~~json
4205{
4206  "jsonrpc": "2.0",
4207  "id": 1,
4208  "result": true
4209}
4210~~~
4211
4212### bdev_iscsi_create {#rpc_bdev_iscsi_create}
4213
4214Connect to iSCSI target and create bdev backed by this connection.
4215
4216This method is available only if SPDK was build with iSCSI initiator support.
4217
4218#### Parameters
4219
4220Name                    | Optional | Type        | Description
4221----------------------- | -------- | ----------- | -----------
4222name                    | Required | string      | Bdev name
4223initiator_iqn           | Required | string      | IQN name used during connection
4224url                     | Required | string      | iSCSI resource URI
4225
4226#### Result
4227
4228Name of newly created bdev.
4229
4230#### Example
4231
4232Example request:
4233
4234~~~json
4235{
4236  "params": {
4237    "url": "iscsi://127.0.0.1/iqn.2016-06.io.spdk:disk1/0",
4238    "initiator_iqn": "iqn.2016-06.io.spdk:init",
4239    "name": "iSCSI0"
4240  },
4241  "jsonrpc": "2.0",
4242  "method": "bdev_iscsi_create",
4243  "id": 1
4244}
4245~~~
4246
4247Example response:
4248
4249~~~json
4250{
4251  "jsonrpc": "2.0",
4252  "id": 1,
4253  "result": "iSCSI0"
4254}
4255~~~
4256
4257### bdev_iscsi_delete {#rpc_bdev_iscsi_delete}
4258
4259Delete iSCSI bdev and terminate connection to target.
4260
4261This method is available only if SPDK was built with iSCSI initiator support.
4262
4263#### Parameters
4264
4265Name                    | Optional | Type        | Description
4266----------------------- | -------- | ----------- | -----------
4267name                    | Required | string      | Bdev name
4268
4269#### Example
4270
4271Example request:
4272
4273~~~json
4274{
4275  "params": {
4276    "name": "iSCSI0"
4277  },
4278  "jsonrpc": "2.0",
4279  "method": "bdev_iscsi_delete",
4280  "id": 1
4281}
4282~~~
4283
4284Example response:
4285
4286~~~json
4287{
4288  "jsonrpc": "2.0",
4289  "id": 1,
4290  "result": true
4291}
4292~~~
4293
4294### bdev_ftl_create {#rpc_bdev_ftl_create}
4295
4296Create FTL bdev.
4297
4298This RPC is subject to change.
4299
4300#### Parameters
4301
4302Name                    | Optional | Type        | Description
4303----------------------- | -------- | ----------- | -----------
4304name                    | Required | string      | Bdev name
4305trtype                  | Required | string      | Transport type
4306traddr                  | Required | string      | NVMe target address
4307punits                  | Required | string      | Parallel unit range in the form of start-end e.g 4-8
4308uuid                    | Optional | string      | UUID of restored bdev (not applicable when creating new instance)
4309cache                   | Optional | string      | Name of the bdev to be used as a write buffer cache
4310
4311#### Result
4312
4313Name of newly created bdev.
4314
4315#### Example
4316
4317Example request:
4318
4319~~~json
4320{
4321  "params": {
4322    "name": "nvme0"
4323    "trtype" "pcie"
4324    "traddr": "0000:00:04.0"
4325    "punits": "0-3"
4326    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
4327  },
4328  "jsonrpc": "2.0",
4329  "method": "bdev_ftl_create",
4330  "id": 1
4331}
4332~~~
4333
4334Example response:
4335
4336~~~json
4337{
4338  "jsonrpc": "2.0",
4339  "id": 1,
4340  "result": {
4341      "name" : "nvme0"
4342      "uuid" : "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
4343  }
4344}
4345~~~
4346
4347### bdev_ftl_delete {#rpc_bdev_ftl_delete}
4348
4349Delete FTL bdev.
4350
4351This RPC is subject to change.
4352
4353#### Parameters
4354
4355Name                    | Optional | Type        | Description
4356----------------------- | -------- | ----------- | -----------
4357name                    | Required | string      | Bdev name
4358
4359#### Example
4360
4361Example request:
4362
4363~~~json
4364{
4365  "params": {
4366    "name": "nvme0"
4367  },
4368  "jsonrpc": "2.0",
4369  "method": "bdev_ftl_delete",
4370  "id": 1
4371}
4372~~~
4373
4374Example response:
4375
4376~~~json
4377{
4378  "jsonrpc": "2.0",
4379  "id": 1,
4380  "result": true
4381}
4382~~~
4383
4384### bdev_pmem_create_pool {#rpc_bdev_pmem_create_pool}
4385
4386Create a @ref bdev_config_pmem blk pool file. It is equivalent of following `pmempool create` command:
4387
4388~~~bash
4389pmempool create -s $((num_blocks * block_size)) blk $block_size $pmem_file
4390~~~
4391
4392This method is available only if SPDK was built with PMDK support.
4393
4394#### Parameters
4395
4396Name                    | Optional | Type        | Description
4397----------------------- | -------- | ----------- | -----------
4398pmem_file               | Required | string      | Path to new pmem file
4399num_blocks              | Required | number      | Number of blocks
4400block_size              | Required | number      | Size of each block in bytes
4401
4402#### Example
4403
4404Example request:
4405
4406~~~json
4407{
4408  "params": {
4409    "block_size": 512,
4410    "num_blocks": 131072,
4411    "pmem_file": "/tmp/pmem_file"
4412  },
4413  "jsonrpc": "2.0",
4414  "method": "bdev_pmem_create_pool",
4415  "id": 1
4416}
4417~~~
4418
4419Example response:
4420
4421~~~json
4422{
4423  "jsonrpc": "2.0",
4424  "id": 1,
4425  "result": true
4426}
4427~~~
4428
4429### bdev_pmem_get_pool_info {#rpc_bdev_pmem_get_pool_info}
4430
4431Retrieve basic information about PMDK memory pool.
4432
4433This method is available only if SPDK was built with PMDK support.
4434
4435#### Parameters
4436
4437Name                    | Optional | Type        | Description
4438----------------------- | -------- | ----------- | -----------
4439pmem_file               | Required | string      | Path to existing pmem file
4440
4441#### Result
4442
4443Array of objects describing memory pool:
4444
4445Name                    | Type        | Description
4446----------------------- | ----------- | -----------
4447num_blocks              | number      | Number of blocks
4448block_size              | number      | Size of each block in bytes
4449
4450#### Example
4451
4452Example request:
4453
4454~~~json
4455request:
4456{
4457  "params": {
4458    "pmem_file": "/tmp/pmem_file"
4459  },
4460  "jsonrpc": "2.0",
4461  "method": "bdev_pmem_get_pool_info",
4462  "id": 1
4463}
4464~~~
4465
4466Example response:
4467
4468~~~json
4469{
4470  "jsonrpc": "2.0",
4471  "id": 1,
4472  "result": [
4473    {
4474      "block_size": 512,
4475      "num_blocks": 129728
4476    }
4477  ]
4478}
4479~~~
4480
4481### bdev_pmem_delete_pool {#rpc_bdev_pmem_delete_pool}
4482
4483Delete pmem pool by removing file `pmem_file`. This method will fail if `pmem_file` is not a
4484valid pmem pool file.
4485
4486This method is available only if SPDK was built with PMDK support.
4487
4488#### Parameters
4489
4490Name                    | Optional | Type        | Description
4491----------------------- | -------- | ----------- | -----------
4492pmem_file               | Required | string      | Path to new pmem file
4493
4494#### Example
4495
4496Example request:
4497
4498~~~json
4499{
4500  "params": {
4501    "pmem_file": "/tmp/pmem_file"
4502  },
4503  "jsonrpc": "2.0",
4504  "method": "bdev_pmem_delete_pool",
4505  "id": 1
4506}
4507~~~
4508
4509Example response:
4510
4511~~~json
4512{
4513  "jsonrpc": "2.0",
4514  "id": 1,
4515  "result": true
4516}
4517~~~
4518
4519### bdev_pmem_create {#rpc_bdev_pmem_create}
4520
4521Construct @ref bdev_config_pmem bdev.
4522
4523This method is available only if SPDK was built with PMDK support.
4524
4525#### Parameters
4526
4527Name                    | Optional | Type        | Description
4528----------------------- | -------- | ----------- | -----------
4529name                    | Required | string      | Bdev name
4530pmem_file               | Required | string      | Path to existing pmem blk pool file
4531
4532#### Result
4533
4534Name of newly created bdev.
4535
4536#### Example
4537
4538Example request:
4539
4540~~~json
4541{
4542  "params": {
4543    "pmem_file": "/tmp/pmem_file",
4544    "name": "Pmem0"
4545  },
4546  "jsonrpc": "2.0",
4547  "method": "bdev_pmem_create",
4548  "id": 1
4549}
4550~~~
4551
4552Example response:
4553
4554~~~json
4555{
4556  "jsonrpc": "2.0",
4557  "id": 1,
4558  "result": "Pmem0"
4559}
4560~~~
4561
4562### bdev_pmem_delete {#rpc_bdev_pmem_delete}
4563
4564Delete @ref bdev_config_pmem bdev. This call will not remove backing pool files.
4565
4566This method is available only if SPDK was built with PMDK support.
4567
4568#### Result
4569
4570`true` if bdev with provided name was deleted or `false` otherwise.
4571
4572#### Parameters
4573
4574Name                    | Optional | Type        | Description
4575----------------------- | -------- | ----------- | -----------
4576name                    | Required | string      | Bdev name
4577
4578#### Example
4579
4580Example request:
4581
4582~~~json
4583{
4584  "params": {
4585    "name": "Pmem0"
4586  },
4587  "jsonrpc": "2.0",
4588  "method": "bdev_pmem_delete",
4589  "id": 1
4590}
4591~~~
4592
4593Example response:
4594
4595~~~json
4596{
4597  "jsonrpc": "2.0",
4598  "id": 1,
4599  "result": true
4600}
4601~~~
4602
4603### bdev_passthru_create {#rpc_bdev_passthru_create}
4604
4605Create passthru bdev. This bdev type redirects all IO to it's base bdev. It has no other purpose than being an example
4606and a starting point in development of new bdev type.
4607
4608#### Parameters
4609
4610Name                    | Optional | Type        | Description
4611----------------------- | -------- | ----------- | -----------
4612name                    | Required | string      | Bdev name
4613base_bdev_name          | Required | string      | Base bdev name
4614
4615#### Result
4616
4617Name of newly created bdev.
4618
4619#### Example
4620
4621Example request:
4622
4623~~~json
4624{
4625  "params": {
4626    "base_bdev_name": "Malloc0",
4627    "name": "Passsthru0"
4628  },
4629  "jsonrpc": "2.0",
4630  "method": "bdev_passthru_create",
4631  "id": 1
4632}
4633~~~
4634
4635Example response:
4636
4637~~~json
4638{
4639  "jsonrpc": "2.0",
4640  "id": 1,
4641  "result": "Passsthru0"
4642}
4643~~~
4644
4645### bdev_passthru_delete {#rpc_bdev_passthru_delete}
4646
4647Delete passthru bdev.
4648
4649#### Parameters
4650
4651Name                    | Optional | Type        | Description
4652----------------------- | -------- | ----------- | -----------
4653name                    | Required | string      | Bdev name
4654
4655#### Example
4656
4657Example request:
4658
4659~~~json
4660{
4661  "params": {
4662    "name": "Passsthru0"
4663  },
4664  "jsonrpc": "2.0",
4665  "method": "bdev_passthru_delete",
4666  "id": 1
4667}
4668
4669~~~
4670
4671Example response:
4672
4673~~~json
4674{
4675  "jsonrpc": "2.0",
4676  "id": 1,
4677  "result": true
4678}
4679~~~
4680
4681### bdev_virtio_attach_controller {#rpc_bdev_virtio_attach_controller}
4682
4683Create new initiator @ref bdev_config_virtio_scsi or @ref bdev_config_virtio_blk and expose all found bdevs.
4684
4685#### Parameters
4686
4687Name                    | Optional | Type        | Description
4688----------------------- | -------- | ----------- | -----------
4689name                    | Required | string      | Virtio SCSI base bdev name or Virtio Blk bdev name
4690trtype                  | Required | string      | Virtio target trtype: pci or user
4691traddr                  | Required | string      | target address: BDF or UNIX socket file path
4692dev_type                | Required | string      | Virtio device type: blk or scsi
4693vq_count                | Optional | number      | Number of queues this controller will utilize (default: 1)
4694vq_size                 | Optional | number      | Size of each queue. Must be power of 2. (default: 512)
4695
4696In case of Virtio SCSI the `name` parameter will be base name for new created bdevs. For Virtio Blk `name` will be the
4697name of created bdev.
4698
4699`vq_count` and `vq_size` parameters are valid only if `trtype` is `user`.
4700
4701#### Result
4702
4703Array of names of newly created bdevs.
4704
4705#### Example
4706
4707Example request:
4708
4709~~~json
4710{
4711  "params": {
4712    "name": "VirtioScsi0",
4713    "trtype": "user",
4714    "vq_size": 128,
4715    "dev_type": "scsi",
4716    "traddr": "/tmp/VhostScsi0",
4717    "vq_count": 4
4718  },
4719  "jsonrpc": "2.0",
4720  "method": "bdev_virtio_attach_controller",
4721  "id": 1
4722}
4723~~~
4724
4725Example response:
4726
4727~~~json
4728{
4729  "jsonrpc": "2.0",
4730  "id": 1,
4731  "result": ["VirtioScsi0t2", "VirtioScsi0t4"]
4732}
4733~~~
4734
4735### bdev_virtio_scsi_get_devices {#rpc_bdev_virtio_scsi_get_devices}
4736
4737Show information about all available Virtio SCSI devices.
4738
4739#### Parameters
4740
4741This method has no parameters.
4742
4743#### Result
4744
4745Array of Virtio SCSI information objects.
4746
4747#### Example
4748
4749Example request:
4750
4751~~~json
4752{
4753  "jsonrpc": "2.0",
4754  "method": "bdev_virtio_scsi_get_devices",
4755  "id": 1
4756}
4757~~~
4758
4759Example response:
4760
4761~~~json
4762{
4763  "jsonrpc": "2.0",
4764  "id": 1,
4765  "result": [
4766    {
4767      "name": "VirtioScsi0",
4768      "virtio": {
4769          "vq_size": 128,
4770          "vq_count": 4,
4771          "type": "user",
4772          "socket": "/tmp/VhostScsi0"
4773      }
4774    }
4775  ]
4776}
4777~~~
4778
4779### bdev_virtio_detach_controller {#rpc_bdev_virtio_detach_controller}
4780
4781Remove a Virtio device. This command can be used to remove any type of virtio device.
4782
4783#### Parameters
4784
4785Name                    | Optional | Type        | Description
4786----------------------- | -------- | ----------- | -----------
4787name                    | Required | string      | Virtio name
4788
4789#### Example
4790
4791Example request:
4792
4793~~~json
4794{
4795  "params": {
4796    "name": "VirtioUser0"
4797  },
4798  "jsonrpc": "2.0",
4799  "method": "bdev_virtio_detach_controller",
4800  "id": 1
4801}
4802
4803~~~
4804
4805Example response:
4806
4807~~~json
4808{
4809  "jsonrpc": "2.0",
4810  "id": 1,
4811  "result": true
4812}
4813~~~
4814
4815### bdev_virtio_blk_set_hotplug {#rpc_bdev_virtio_blk_set_hotplug}
4816
4817Enable/Disable the virtio blk hotplug monitor or change the monitor period time
4818
4819#### Parameters
4820
4821Name                    | Optional | Type        | Description
4822----------------------- | -------- | ----------- | -----------
4823enable                  | Required | bool        | Enable or disable the virtio blk hotplug monitor
4824period-us               | Optional | number      | The period time of the monitor
4825
4826When the enable is true then the period-us is optional. If user don't set the period time then use the default
4827value. When the enable is false then the period-us is not required.
4828
4829#### Result
4830
4831True the rpc is successful otherwise false
4832
4833#### Example
4834
4835Example request:
4836
4837~~~json
4838{
4839  "params": {
4840    "enable": "true",
4841    "period-us": "1000000"
4842  },
4843  "jsonrpc": "2.0",
4844  "method": "bdev_virtio_blk_set_hotplug",
4845  "id": 1
4846}
4847~~~
4848
4849Example response:
4850
4851~~~json
4852{
4853  "jsonrpc": "2.0",
4854  "id": 1,
4855  "result": true
4856}
4857~~~
4858
4859## iSCSI Target {#jsonrpc_components_iscsi_tgt}
4860
4861### iscsi_set_options method {#rpc_iscsi_set_options}
4862
4863Set global parameters for iSCSI targets.
4864
4865This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once.
4866
4867#### Parameters
4868
4869Name                            | Optional | Type    | Description
4870------------------------------- | -------- | ------- | -----------
4871auth_file                       | Optional | string  | Path to CHAP shared secret file (default: "")
4872node_base                       | Optional | string  | Prefix of the name of iSCSI target node (default: "iqn.2016-06.io.spdk")
4873nop_timeout                     | Optional | number  | Timeout in seconds to nop-in request to the initiator (default: 60)
4874nop_in_interval                 | Optional | number  | Time interval in secs between nop-in requests by the target (default: 30)
4875disable_chap                    | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
4876require_chap                    | Optional | boolean | CHAP for discovery session should be required (default: `false`)
4877mutual_chap                     | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
4878chap_group                      | Optional | number  | CHAP group ID for discovery session (default: 0)
4879max_sessions                    | Optional | number  | Maximum number of sessions in the host (default: 128)
4880max_queue_depth                 | Optional | number  | Maximum number of outstanding I/Os per queue (default: 64)
4881max_connections_per_session     | Optional | number  | Session specific parameter, MaxConnections (default: 2)
4882default_time2wait               | Optional | number  | Session specific parameter, DefaultTime2Wait (default: 2)
4883default_time2retain             | Optional | number  | Session specific parameter, DefaultTime2Retain (default: 20)
4884first_burst_length              | Optional | number  | Session specific parameter, FirstBurstLength (default: 8192)
4885immediate_data                  | Optional | boolean | Session specific parameter, ImmediateData (default: `true`)
4886error_recovery_level            | Optional | number  | Session specific parameter, ErrorRecoveryLevel (default: 0)
4887allow_duplicated_isid           | Optional | boolean | Allow duplicated initiator session ID (default: `false`)
4888max_large_datain_per_connection | Optional | number  | Max number of outstanding split read I/Os per connection (default: 64)
4889max_r2t_per_connection          | Optional | number  | Max number of outstanding R2Ts per connection (default: 4)
4890pdu_pool_size                   | Optional | number  | Number of PDUs in the pool (default: approximately 2 * max_sessions * (max_queue_depth + max_connections_per_session))
4891immediate_data_pool_size        | Optional | number  | Number of immediate data buffers in the pool (default: 128 * max_sessions)
4892data_out_pool_size              | Optional | number  | Number of data out buffers in the pool (default: 16 * max_sessions)
4893
4894To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.
4895
4896Parameters `disable_chap` and `require_chap` are mutually exclusive. Parameters `no_discovery_auth`, `req_discovery_auth`,
4897`req_discovery_auth_mutual`, and `discovery_auth_group` are still available instead of `disable_chap`, `require_chap`,
4898`mutual_chap`, and `chap_group`, respectivey but will be removed in future releases.
4899
4900#### Example
4901
4902Example request:
4903
4904~~~json
4905{
4906  "params": {
4907    "allow_duplicated_isid": true,
4908    "default_time2retain": 60,
4909    "first_burst_length": 8192,
4910    "immediate_data": true,
4911    "node_base": "iqn.2016-06.io.spdk",
4912    "max_sessions": 128,
4913    "nop_timeout": 30,
4914    "nop_in_interval": 30,
4915    "auth_file": "/usr/local/etc/spdk/auth.conf",
4916    "disable_chap": true,
4917    "default_time2wait": 2
4918  },
4919  "jsonrpc": "2.0",
4920  "method": "iscsi_set_options",
4921  "id": 1
4922}
4923~~~
4924
4925Example response:
4926
4927~~~json
4928{
4929  "jsonrpc": "2.0",
4930  "id": 1,
4931  "result": true
4932}
4933~~~
4934
4935### iscsi_get_options method {#rpc_iscsi_get_options}
4936
4937Show global parameters of iSCSI targets.
4938
4939#### Parameters
4940
4941This method has no parameters.
4942
4943#### Example
4944
4945Example request:
4946
4947~~~json
4948request:
4949{
4950  "jsonrpc": "2.0",
4951  "method": "iscsi_get_options",
4952  "id": 1
4953}
4954~~~
4955
4956Example response:
4957
4958~~~json
4959{
4960  "jsonrpc": "2.0",
4961  "id": 1,
4962  "result": {
4963    "allow_duplicated_isid": true,
4964    "default_time2retain": 60,
4965    "first_burst_length": 8192,
4966    "immediate_data": true,
4967    "node_base": "iqn.2016-06.io.spdk",
4968    "mutual_chap": false,
4969    "nop_in_interval": 30,
4970    "chap_group": 0,
4971    "max_connections_per_session": 2,
4972    "max_queue_depth": 64,
4973    "nop_timeout": 30,
4974    "max_sessions": 128,
4975    "error_recovery_level": 0,
4976    "auth_file": "/usr/local/etc/spdk/auth.conf",
4977    "disable_chap": true,
4978    "default_time2wait": 2,
4979    "require_chap": false,
4980    "max_large_datain_per_connection": 64,
4981    "max_r2t_per_connection": 4
4982  }
4983}
4984~~~
4985
4986### scsi_get_devices {#rpc_scsi_get_devices}
4987
4988Display SCSI devices
4989
4990#### Parameters
4991
4992This method has no parameters.
4993
4994#### Example
4995
4996Example request:
4997
4998~~~json
4999{
5000  "jsonrpc": "2.0",
5001  "method": "scsi_get_devices",
5002  "id": 1
5003}
5004~~~
5005
5006Example response:
5007
5008~~~json
5009{
5010  "jsonrpc": "2.0",
5011  "id": 1,
5012  "result": [
5013    {
5014      "id": 0,
5015      "device_name": "iqn.2016-06.io.spdk:Target3"
5016    }
5017  ]
5018}
5019~~~
5020
5021### iscsi_set_discovery_auth method {#rpc_iscsi_set_discovery_auth}
5022
5023Set CHAP authentication for sessions dynamically.
5024
5025#### Parameters
5026
5027Name                        | Optional | Type    | Description
5028--------------------------- | -------- | --------| -----------
5029disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
5030require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
5031mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
5032chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
5033
5034Parameters `disable_chap` and `require_chap` are mutually exclusive.
5035
5036#### Example
5037
5038Example request:
5039
5040~~~json
5041request:
5042{
5043  "params": {
5044    "chap_group": 1,
5045    "require_chap": true,
5046    "mutual_chap": true
5047  },
5048  "jsonrpc": "2.0",
5049  "method": "iscsi_set_discovery_auth",
5050  "id": 1
5051}
5052~~~
5053
5054Example response:
5055
5056~~~json
5057{
5058  "jsonrpc": "2.0",
5059  "id": 1,
5060  "result": true
5061}
5062~~~
5063
5064### iscsi_create_auth_group method {#rpc_iscsi_create_auth_group}
5065
5066Create an authentication group for CHAP authentication.
5067
5068#### Parameters
5069
5070Name                        | Optional | Type    | Description
5071--------------------------- | -------- | --------| -----------
5072tag                         | Required | number  | Authentication group tag (unique, integer > 0)
5073secrets                     | Optional | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
5074
5075#### secret {#rpc_iscsi_create_auth_group_secret}
5076
5077Name                        | Optional | Type    | Description
5078--------------------------- | ---------| --------| -----------
5079user                        | Required | string  | Unidirectional CHAP name
5080secret                      | Required | string  | Unidirectional CHAP secret
5081muser                       | Optional | string  | Bidirectional CHAP name
5082msecret                     | Optional | string  | Bidirectional CHAP secret
5083
5084#### Example
5085
5086Example request:
5087
5088~~~json
5089{
5090  "params": {
5091    "secrets": [
5092      {
5093        "muser": "mu1",
5094        "secret": "s1",
5095        "user": "u1",
5096        "msecret": "ms1"
5097      }
5098    ],
5099    "tag": 2
5100  },
5101  "jsonrpc": "2.0",
5102  "method": "iscsi_create_auth_group",
5103  "id": 1
5104}
5105~~~
5106
5107Example response:
5108
5109~~~json
5110{
5111  "jsonrpc": "2.0",
5112  "id": 1,
5113  "result": true
5114}
5115~~~
5116
5117### iscsi_delete_auth_group method {#rpc_iscsi_delete_auth_group}
5118
5119Delete an existing authentication group for CHAP authentication.
5120
5121#### Parameters
5122
5123Name                        | Optional | Type    | Description
5124--------------------------- | -------- | --------| -----------
5125tag                         | Required | number  | Authentication group tag (unique, integer > 0)
5126
5127#### Example
5128
5129Example request:
5130
5131~~~json
5132{
5133  "params": {
5134    "tag": 2
5135  },
5136  "jsonrpc": "2.0",
5137  "method": "iscsi_delete_auth_group",
5138  "id": 1
5139}
5140~~~
5141
5142Example response:
5143
5144~~~json
5145{
5146  "jsonrpc": "2.0",
5147  "id": 1,
5148  "result": true
5149}
5150~~~
5151
5152### iscsi_get_auth_groups {#rpc_iscsi_get_auth_groups}
5153
5154Show information about all existing authentication group for CHAP authentication.
5155
5156#### Parameters
5157
5158This method has no parameters.
5159
5160#### Result
5161
5162Array of objects describing authentication group.
5163
5164Name                        | Type    | Description
5165--------------------------- | --------| -----------
5166tag                         | number  | Authentication group tag
5167secrets                     | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
5168
5169#### Example
5170
5171Example request:
5172
5173~~~json
5174{
5175  "jsonrpc": "2.0",
5176  "method": "iscsi_get_auth_groups",
5177  "id": 1
5178}
5179~~~
5180
5181Example response:
5182
5183~~~json
5184{
5185  "jsonrpc": "2.0",
5186  "id": 1,
5187  "result": [
5188    {
5189      "secrets": [
5190        {
5191          "muser": "mu1",
5192          "secret": "s1",
5193          "user": "u1",
5194          "msecret": "ms1"
5195        }
5196      ],
5197      "tag": 1
5198    },
5199    {
5200      "secrets": [
5201        {
5202          "secret": "s2",
5203          "user": "u2"
5204        }
5205      ],
5206      "tag": 2
5207    }
5208  ]
5209}
5210~~~
5211
5212### iscsi_auth_group_add_secret {#rpc_iscsi_auth_group_add_secret}
5213
5214Add a secret to an existing authentication group for CHAP authentication.
5215
5216#### Parameters
5217
5218Name                        | Optional | Type    | Description
5219--------------------------- | -------- | --------| -----------
5220tag                         | Required | number  | Authentication group tag (unique, integer > 0)
5221user                        | Required | string  | Unidirectional CHAP name
5222secret                      | Required | string  | Unidirectional CHAP secret
5223muser                       | Optional | string  | Bidirectional CHAP name
5224msecret                     | Optional | string  | Bidirectional CHAP secret
5225
5226#### Example
5227
5228Example request:
5229
5230~~~json
5231{
5232  "params": {
5233    "muser": "mu3",
5234    "secret": "s3",
5235    "tag": 2,
5236    "user": "u3",
5237    "msecret": "ms3"
5238  },
5239  "jsonrpc": "2.0",
5240  "method": "iscsi_auth_group_add_secret",
5241  "id": 1
5242}
5243~~~json
5244
5245Example response:
5246
5247~~~json
5248{
5249  "jsonrpc": "2.0",
5250  "id": 1,
5251  "result": true
5252}
5253~~~
5254
5255### iscsi_auth_group_remove_secret {#rpc_iscsi_auth_group_remove_secret}
5256
5257Remove a secret from an existing authentication group for CHAP authentication.
5258
5259#### Parameters
5260
5261Name                        | Optional | Type    | Description
5262--------------------------- | -------- | --------| -----------
5263tag                         | Required | number  | Authentication group tag (unique, integer > 0)
5264user                        | Required | string  | Unidirectional CHAP name
5265
5266#### Example
5267
5268Example request:
5269
5270~~~json
5271{
5272  "params": {
5273    "tag": 2,
5274    "user": "u3"
5275  },
5276  "jsonrpc": "2.0",
5277  "method": "iscsi_auth_group_remove_secret",
5278  "id": 1
5279}
5280~~~
5281
5282Example response:
5283
5284~~~json
5285{
5286  "jsonrpc": "2.0",
5287  "id": 1,
5288  "result": true
5289}
5290~~~
5291
5292### iscsi_get_initiator_groups method {#rpc_iscsi_get_initiator_groups}
5293
5294Show information about all available initiator groups.
5295
5296#### Parameters
5297
5298This method has no parameters.
5299
5300#### Result
5301
5302Array of objects describing initiator groups.
5303
5304Name                        | Type    | Description
5305--------------------------- | --------| -----------
5306tag                         | number  | Initiator group tag
5307initiators                  | array   | Array of initiator hostnames or IP addresses
5308netmasks                    | array   | Array of initiator netmasks
5309
5310#### Example
5311
5312Example request:
5313
5314~~~json
5315{
5316  "jsonrpc": "2.0",
5317  "method": "iscsi_get_initiator_groups",
5318  "id": 1
5319}
5320~~~
5321
5322Example response:
5323
5324~~~json
5325{
5326  "jsonrpc": "2.0",
5327  "id": 1,
5328  "result": [
5329    {
5330      "initiators": [
5331        "iqn.2016-06.io.spdk:host1",
5332        "iqn.2016-06.io.spdk:host2"
5333      ],
5334      "tag": 1,
5335      "netmasks": [
5336        "192.168.1.0/24"
5337      ]
5338    }
5339  ]
5340}
5341~~~
5342
5343### iscsi_create_initiator_group method {#rpc_iscsi_create_initiator_group}
5344
5345Add an initiator group.
5346
5347#### Parameters
5348
5349Name                        | Optional | Type    | Description
5350--------------------------- | -------- | --------| -----------
5351tag                         | Required | number  | Initiator group tag (unique, integer > 0)
5352initiators                  | Required | array   | Not empty array of initiator hostnames or IP addresses
5353netmasks                    | Required | array   | Not empty array of initiator netmasks
5354
5355#### Example
5356
5357Example request:
5358
5359~~~json
5360{
5361  "params": {
5362    "initiators": [
5363      "iqn.2016-06.io.spdk:host1",
5364      "iqn.2016-06.io.spdk:host2"
5365    ],
5366    "tag": 1,
5367    "netmasks": [
5368      "192.168.1.0/24"
5369    ]
5370  },
5371  "jsonrpc": "2.0",
5372  "method": "iscsi_create_initiator_group",
5373  "id": 1
5374}
5375~~~
5376
5377Example response:
5378
5379~~~json
5380response:
5381{
5382  "jsonrpc": "2.0",
5383  "id": 1,
5384  "result": true
5385}
5386~~~
5387
5388### iscsi_delete_initiator_group method {#rpc_iscsi_delete_initiator_group}
5389
5390Delete an existing initiator group.
5391
5392#### Parameters
5393
5394Name                        | Optional | Type    | Description
5395--------------------------- | -------- | --------| -----------
5396tag                         | Required | number  | Initiator group tag (unique, integer > 0)
5397
5398#### Example
5399
5400Example request:
5401
5402~~~json
5403{
5404  "params": {
5405    "tag": 1
5406  },
5407  "jsonrpc": "2.0",
5408  "method": "iscsi_delete_initiator_group",
5409  "id": 1
5410}
5411~~~
5412
5413Example response:
5414
5415~~~json
5416{
5417  "jsonrpc": "2.0",
5418  "id": 1,
5419  "result": true
5420}
5421~~~
5422
5423### iscsi_initiator_group_add_initiators method {#rpc_iscsi_initiator_group_add_initiators}
5424
5425Add initiators to an existing initiator group.
5426
5427#### Parameters
5428
5429Name                        | Optional | Type    | Description
5430--------------------------- | -------- | --------| -----------
5431tag                         | Required | number  | Existing initiator group tag.
5432initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
5433netmasks                    | Optional | array   | Array of initiator netmasks
5434
5435#### Example
5436
5437Example request:
5438
5439~~~json
5440request:
5441{
5442  "params": {
5443    "initiators": [
5444      "iqn.2016-06.io.spdk:host3"
5445    ],
5446    "tag": 1,
5447    "netmasks": [
5448      "255.255.255.1"
5449    ]
5450  },
5451  "jsonrpc": "2.0",
5452  "method": "iscsi_initiator_group_add_initiators",
5453  "id": 1
5454}
5455~~~
5456
5457Example response:
5458
5459~~~json
5460response:
5461{
5462  "jsonrpc": "2.0",
5463  "id": 1,
5464  "result": true
5465}
5466~~~
5467
5468### iscsi_initiator_group_remove_initiators method {#rpc_iscsi_initiator_group_remove_initiators}
5469
5470Remove initiators from an initiator group.
5471
5472#### Parameters
5473
5474Name                        | Optional | Type    | Description
5475--------------------------- | -------- | --------| -----------
5476tag                         | Required | number  | Existing initiator group tag.
5477initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
5478netmasks                    | Optional | array   | Array of initiator netmasks
5479
5480#### Example
5481
5482Example request:
5483
5484~~~json
5485request:
5486{
5487  "params": {
5488    "initiators": [
5489      "iqn.2016-06.io.spdk:host3"
5490    ],
5491    "tag": 1,
5492    "netmasks": [
5493      "255.255.255.1"
5494    ]
5495  },
5496  "jsonrpc": "2.0",
5497  "method": "iscsi_initiator_group_remove_initiators",
5498  "id": 1
5499}
5500~~~
5501
5502Example response:
5503
5504~~~json
5505response:
5506{
5507  "jsonrpc": "2.0",
5508  "id": 1,
5509  "result": true
5510}
5511~~~
5512
5513### iscsi_get_target_nodes method {#rpc_iscsi_get_target_nodes}
5514
5515Show information about all available iSCSI target nodes.
5516
5517#### Parameters
5518
5519This method has no parameters.
5520
5521#### Result
5522
5523Array of objects describing target node.
5524
5525Name                        | Type    | Description
5526--------------------------- | --------| -----------
5527name                        | string  | Target node name (ASCII)
5528alias_name                  | string  | Target node alias name (ASCII)
5529pg_ig_maps                  | array   | Array of Portal_Group_Tag:Initiator_Group_Tag mappings
5530luns                        | array   | Array of Bdev names to LUN ID mappings
5531queue_depth                 | number  | Target queue depth
5532disable_chap                | boolean | CHAP authentication should be disabled for this target
5533require_chap                | boolean | CHAP authentication should be required for this target
5534mutual_chap                 | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
5535chap_group                  | number  | Authentication group ID for this target node
5536header_digest               | boolean | Header Digest should be required for this target node
5537data_digest                 | boolean | Data Digest should be required for this target node
5538
5539#### Example
5540
5541Example request:
5542
5543~~~json
5544{
5545  "jsonrpc": "2.0",
5546  "method": "iscsi_get_target_nodes",
5547  "id": 1
5548}
5549~~~
5550
5551Example response:
5552
5553~~~json
5554{
5555  "jsonrpc": "2.0",
5556  "id": 1,
5557  "result": [
5558    {
5559      "luns": [
5560        {
5561          "lun_id": 0,
5562          "bdev_name": "Nvme0n1"
5563        }
5564      ],
5565      "mutual_chap": false,
5566      "name": "iqn.2016-06.io.spdk:target1",
5567      "alias_name": "iscsi-target1-alias",
5568      "require_chap": false,
5569      "chap_group": 0,
5570      "pg_ig_maps": [
5571        {
5572          "ig_tag": 1,
5573          "pg_tag": 1
5574        }
5575      ],
5576      "data_digest": false,
5577      "disable_chap": false,
5578      "header_digest": false,
5579      "queue_depth": 64
5580    }
5581  ]
5582}
5583~~~
5584
5585### iscsi_create_target_node method {#rpc_iscsi_create_target_node}
5586
5587Add an iSCSI target node.
5588
5589#### Parameters
5590
5591Name                        | Optional | Type    | Description
5592--------------------------- | -------- | --------| -----------
5593name                        | Required | string  | Target node name (ASCII)
5594alias_name                  | Required | string  | Target node alias name (ASCII)
5595pg_ig_maps                  | Required | array   | Array of (Portal_Group_Tag:Initiator_Group_Tag) mappings
5596luns                        | Required | array   | Array of Bdev names to LUN ID mappings
5597queue_depth                 | Required | number  | Target queue depth
5598disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
5599require_chap                | Optional | boolean | CHAP authentication should be required for this target
5600mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
5601chap_group                  | Optional | number  | Authentication group ID for this target node
5602header_digest               | Optional | boolean | Header Digest should be required for this target node
5603data_digest                 | Optional | boolean | Data Digest should be required for this target node
5604
5605Parameters `disable_chap` and `require_chap` are mutually exclusive.
5606
5607#### Example
5608
5609Example request:
5610
5611~~~json
5612{
5613  "params": {
5614    "luns": [
5615      {
5616        "lun_id": 0,
5617        "bdev_name": "Nvme0n1"
5618      }
5619    ],
5620    "mutual_chap": true,
5621    "name": "target2",
5622    "alias_name": "iscsi-target2-alias",
5623    "pg_ig_maps": [
5624      {
5625        "ig_tag": 1,
5626        "pg_tag": 1
5627      },
5628      {
5629        "ig_tag": 2,
5630        "pg_tag": 2
5631      }
5632    ],
5633    "data_digest": true,
5634    "disable_chap": true,
5635    "header_digest": true,
5636    "queue_depth": 24
5637  },
5638  "jsonrpc": "2.0",
5639  "method": "iscsi_create_target_node",
5640  "id": 1
5641}
5642~~~
5643
5644Example response:
5645
5646~~~json
5647{
5648  "jsonrpc": "2.0",
5649  "id": 1,
5650  "result": true
5651}
5652~~~
5653
5654### iscsi_target_node_set_auth method {#rpc_iscsi_target_node_set_auth}
5655
5656Set CHAP authentication to an existing iSCSI target node.
5657
5658#### Parameters
5659
5660Name                        | Optional | Type    | Description
5661--------------------------- | -------- | --------| -----------
5662name                        | Required | string  | Target node name (ASCII)
5663disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
5664require_chap                | Optional | boolean | CHAP authentication should be required for this target
5665mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
5666chap_group                  | Optional | number  | Authentication group ID for this target node
5667
5668Parameters `disable_chap` and `require_chap` are mutually exclusive.
5669
5670#### Example
5671
5672Example request:
5673
5674~~~json
5675{
5676  "params": {
5677    "chap_group": 1,
5678    "require_chap": true,
5679    "name": "iqn.2016-06.io.spdk:target1",
5680    "mutual_chap": true
5681  },
5682  "jsonrpc": "2.0",
5683  "method": "iscsi_target_node_set_auth",
5684  "id": 1
5685}
5686~~~
5687
5688Example response:
5689
5690~~~json
5691{
5692  "jsonrpc": "2.0",
5693  "id": 1,
5694  "result": true
5695}
5696~~~
5697
5698### iscsi_target_node_add_pg_ig_maps method {#rpc_iscsi_target_node_add_pg_ig_maps}
5699
5700Add initiator group to portal group mappings to an existing iSCSI target node.
5701
5702#### Parameters
5703
5704Name                        | Optional | Type    | Description
5705--------------------------- | -------- | --------| -----------
5706name                        | Required | string  | Target node name (ASCII)
5707pg_ig_maps                  | Required | array   | Not empty array of initiator to portal group mappings objects
5708
5709Portal to Initiator group mappings object:
5710
5711Name                        | Optional | Type    | Description
5712--------------------------- | -------- | --------| -----------
5713ig_tag                      | Required | number  | Existing initiator group tag
5714pg_tag                      | Required | number  | Existing portal group tag
5715
5716#### Example
5717
5718Example request:
5719
5720~~~json
5721{
5722  "params": {
5723    "pg_ig_maps": [
5724      {
5725        "ig_tag": 1,
5726        "pg_tag": 1
5727      },
5728      {
5729        "ig_tag": 2,
5730        "pg_tag": 2
5731      },
5732      {
5733        "ig_tag": 3,
5734        "pg_tag": 3
5735      }
5736    ],
5737    "name": "iqn.2016-06.io.spdk:target3"
5738  },
5739  "jsonrpc": "2.0",
5740  "method": "iscsi_target_node_add_pg_ig_maps",
5741  "id": 1
5742}
5743~~~
5744
5745Example response:
5746
5747~~~json
5748{
5749  "jsonrpc": "2.0",
5750  "id": 1,
5751  "result": true
5752}
5753~~~
5754
5755### iscsi_target_node_remove_pg_ig_maps method {#rpc_iscsi_target_node_remove_pg_ig_maps}
5756
5757Delete initiator group to portal group mappings from an existing iSCSI target node.
5758
5759#### Parameters
5760
5761Name                        | Optional | Type    | Description
5762--------------------------- | -------- | --------| -----------
5763name                        | Required | string  | Target node name (ASCII)
5764pg_ig_maps                  | Required | array   | Not empty array of Portal to Initiator group mappings objects
5765
5766Portal to Initiator group mappings object:
5767
5768Name                        | Optional | Type    | Description
5769--------------------------- | -------- | --------| -----------
5770ig_tag                      | Required | number  | Existing initiator group tag
5771pg_tag                      | Required | number  | Existing portal group tag
5772
5773#### Example
5774
5775Example request:
5776
5777~~~json
5778{
5779  "params": {
5780    "pg_ig_maps": [
5781      {
5782        "ig_tag": 1,
5783        "pg_tag": 1
5784      },
5785      {
5786        "ig_tag": 2,
5787        "pg_tag": 2
5788      },
5789      {
5790        "ig_tag": 3,
5791        "pg_tag": 3
5792      }
5793    ],
5794    "name": "iqn.2016-06.io.spdk:target3"
5795  },
5796  "jsonrpc": "2.0",
5797  "method": "iscsi_target_node_remove_pg_ig_maps",
5798  "id": 1
5799}
5800~~~
5801
5802Example response:
5803
5804~~~json
5805{
5806  "jsonrpc": "2.0",
5807  "id": 1,
5808  "result": true
5809}
5810~~~
5811
5812### iscsi_delete_target_node method {#rpc_iscsi_delete_target_node}
5813
5814Delete an iSCSI target node.
5815
5816#### Parameters
5817
5818Name                        | Optional | Type    | Description
5819--------------------------- | -------- | --------| -----------
5820name                        | Required | string  | Target node name (ASCII)
5821
5822#### Example
5823
5824Example request:
5825
5826~~~json
5827{
5828  "params": {
5829    "name": "iqn.2016-06.io.spdk:target1"
5830  },
5831  "jsonrpc": "2.0",
5832  "method": "iscsi_delete_target_node",
5833  "id": 1
5834}
5835~~~
5836
5837Example response:
5838
5839~~~json
5840{
5841  "jsonrpc": "2.0",
5842  "id": 1,
5843  "result": true
5844}
5845~~~
5846
5847### iscsi_get_portal_groups method {#rpc_iscsi_get_portal_groups}
5848
5849Show information about all available portal groups.
5850
5851#### Parameters
5852
5853This method has no parameters.
5854
5855#### Example
5856
5857Example request:
5858
5859~~~json
5860request:
5861{
5862  "jsonrpc": "2.0",
5863  "method": "iscsi_get_portal_groups",
5864  "id": 1
5865}
5866~~~
5867
5868Example response:
5869
5870~~~json
5871{
5872  "jsonrpc": "2.0",
5873  "id": 1,
5874  "result": [
5875    {
5876      "portals": [
5877        {
5878          "host": "127.0.0.1",
5879          "port": "3260"
5880        }
5881      ],
5882      "tag": 1,
5883      "private": false
5884    }
5885  ]
5886}
5887~~~
5888
5889### iscsi_create_portal_group method {#rpc_iscsi_create_portal_group}
5890
5891Add a portal group.
5892
5893#### Parameters
5894
5895Name                        | Optional | Type    | Description
5896--------------------------- | -------- | --------| -----------
5897tag                         | Required | number  | Portal group tag
5898portals                     | Required | array   | Not empty array of portals
5899private                     | Optional | boolean | When true, portals in this group are not returned by a discovery session. Used for login redirection. (default: `false`)
5900wait                        | Optional | boolean | When true, do not listen on portals until it is started explicitly. (default: `false`)
5901
5902Portal object
5903
5904Name                        | Optional | Type    | Description
5905--------------------------- | -------- | --------| -----------
5906host                        | Required | string  | Hostname or IP address
5907port                        | Required | string  | Port number
5908
5909#### Example
5910
5911Example request:
5912
5913~~~json
5914{
5915  "params": {
5916    "portals": [
5917      {
5918        "host": "127.0.0.1",
5919        "port": "3260"
5920      }
5921    ],
5922    "tag": 1
5923  },
5924  "jsonrpc": "2.0",
5925  "method": "iscsi_create_portal_group",
5926  "id": 1
5927}
5928~~~
5929
5930Example response:
5931
5932~~~json
5933{
5934  "jsonrpc": "2.0",
5935  "id": 1,
5936  "result": true
5937}
5938~~~
5939
5940### iscsi_start_portal_group method {#rpc_iscsi_start_portal_group}
5941
5942Start listening on portals if the portal group is not started yet, or do nothing
5943if the portal group already started. Return a success response for both cases.
5944
5945#### Parameters
5946
5947Name                        | Optional | Type    | Description
5948--------------------------- | -------- | --------| -----------
5949tag                         | Required | number  | Existing portal group tag
5950
5951#### Example
5952
5953Example request:
5954
5955~~~json
5956{
5957  "params": {
5958    "tag": 1
5959  },
5960  "jsonrpc": "2.0",
5961  "method": "iscsi_start_portal_group",
5962  "id": 1
5963}
5964~~~
5965
5966Example response:
5967
5968~~~json
5969{
5970  "jsonrpc": "2.0",
5971  "id": 1,
5972  "result": true
5973}
5974~~~
5975
5976### iscsi_delete_portal_group method {#rpc_iscsi_delete_portal_group}
5977
5978Delete an existing portal group.
5979
5980#### Parameters
5981
5982Name                        | Optional | Type    | Description
5983--------------------------- | -------- | --------| -----------
5984tag                         | Required | number  | Existing portal group tag
5985
5986#### Example
5987
5988Example request:
5989
5990~~~json
5991{
5992  "params": {
5993    "tag": 1
5994  },
5995  "jsonrpc": "2.0",
5996  "method": "iscsi_delete_portal_group",
5997  "id": 1
5998}
5999~~~
6000
6001Example response:
6002
6003~~~json
6004{
6005  "jsonrpc": "2.0",
6006  "id": 1,
6007  "result": true
6008}
6009~~~
6010
6011### iscsi_portal_group_set_auth method {#rpc_iscsi_portal_group_set_auth}
6012
6013Set CHAP authentication for discovery sessions specific for the existing iSCSI portal group.
6014This RPC overwrites the setting by the global parameters for the iSCSI portal group.
6015
6016#### Parameters
6017
6018Name                        | Optional | Type    | Description
6019--------------------------- | -------- | --------| -----------
6020disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
6021require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
6022mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
6023chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
6024
6025Parameters `disable_chap` and `require_chap` are mutually exclusive.
6026
6027#### Example
6028
6029Example request:
6030
6031~~~json
6032request:
6033{
6034  "params": {
6035    "tag": 1,
6036    "chap_group": 1,
6037    "require_chap": true,
6038    "mutual_chap": true
6039  },
6040  "jsonrpc": "2.0",
6041  "method": "iscsi_portal_group_set_auth",
6042  "id": 1
6043}
6044~~~
6045
6046Example response:
6047
6048~~~json
6049{
6050  "jsonrpc": "2.0",
6051  "id": 1,
6052  "result": true
6053}
6054~~~
6055
6056### iscsi_get_connections method {#rpc_iscsi_get_connections}
6057
6058Show information about all active connections.
6059
6060#### Parameters
6061
6062This method has no parameters.
6063
6064#### Results
6065
6066Array of objects describing iSCSI connection.
6067
6068Name                        | Type    | Description
6069--------------------------- | --------| -----------
6070id                          | number  | Index (used for TTT - Target Transfer Tag)
6071cid                         | number  | CID (Connection ID)
6072tsih                        | number  | TSIH (Target Session Identifying Handle)
6073lcore_id                    | number  | Core number on which the iSCSI connection runs
6074initiator_addr              | string  | Initiator address
6075target_addr                 | string  | Target address
6076target_node_name            | string  | Target node name (ASCII) without prefix
6077
6078#### Example
6079
6080Example request:
6081
6082~~~json
6083{
6084  "jsonrpc": "2.0",
6085  "method": "iscsi_get_connections",
6086  "id": 1
6087}
6088~~~
6089
6090Example response:
6091
6092~~~json
6093{
6094  "jsonrpc": "2.0",
6095  "id": 1,
6096  "result": [
6097    {
6098      "tsih": 4,
6099      "cid": 0,
6100      "target_node_name": "target1",
6101      "lcore_id": 0,
6102      "initiator_addr": "10.0.0.2",
6103      "target_addr": "10.0.0.1",
6104      "id": 0
6105    }
6106  ]
6107}
6108~~~
6109
6110### iscsi_target_node_add_lun method {#rpc_iscsi_target_node_add_lun}
6111
6112Add an LUN to an existing iSCSI target node.
6113
6114#### Parameters
6115
6116Name                        | Optional | Type    | Description
6117--------------------------- | -------- | --------| -----------
6118name                        | Required | string  | Target node name (ASCII)
6119bdev_name                   | Required | string  | bdev name to be added as a LUN
6120lun_id                      | Optional | number  | LUN ID (default: first free ID)
6121
6122#### Example
6123
6124Example request:
6125
6126~~~json
6127{
6128  "params": {
6129    "lun_id": 2,
6130    "name": "iqn.2016-06.io.spdk:target1",
6131    "bdev_name": "Malloc0"
6132  },
6133  "jsonrpc": "2.0",
6134  "method": "iscsi_target_node_add_lun",
6135  "id": 1
6136}
6137~~~
6138
6139Example response:
6140
6141~~~json
6142{
6143  "jsonrpc": "2.0",
6144  "id": 1,
6145  "result": true
6146}
6147~~~
6148
6149### iscsi_target_node_set_redirect method {#rpc_iscsi_target_node_set_redirect}
6150
6151Update redirect portal of the primary portal group for the target node,
6152
6153#### Parameters
6154
6155Name                        | Optional | Type    | Description
6156--------------------------- | -------- | --------| -----------
6157name                        | Required | string  | Target node name (ASCII)
6158pg_tag                      | Required | number  | Existing portal group tag
6159redirect_host               | Optional | string  | Numeric IP address to which the target node is redirected
6160redirect_port               | Optional | string  | Numeric TCP port to which the target node is redirected
6161
6162If both redirect_host and redirect_port are omitted, clear the redirect portal.
6163
6164#### Example
6165
6166Example request:
6167
6168~~~json
6169{
6170  "params": {
6171    "name": "iqn.2016-06.io.spdk:target1",
6172    "pg_tag": 1,
6173    "redirect_host": "10.0.0.3",
6174    "redirect_port": "3260"
6175  },
6176  "jsonrpc": "2.0",
6177  "method": "iscsi_target_node_set_redirect",
6178  "id": 1
6179}
6180~~~
6181
6182Example response:
6183
6184~~~json
6185{
6186  "jsonrpc": "2.0",
6187  "id": 1,
6188  "result": true
6189}
6190~~~
6191
6192### iscsi_target_node_request_logout method {#rpc_iscsi_target_node_request_logout}
6193
6194For the target node, request connections whose portal group tag match to logout,
6195or request all connections to logout if portal group tag is omitted.
6196
6197#### Parameters
6198
6199Name                        | Optional | Type    | Description
6200--------------------------- | -------- | --------| -----------
6201name                        | Required | string  | Target node name (ASCII)
6202pg_tag                      | Optional | number  | Existing portal group tag
6203
6204#### Example
6205
6206Example request:
6207
6208~~~json
6209{
6210  "params": {
6211    "name": "iqn.2016-06.io.spdk:target1",
6212    "pg_tag": 1
6213  },
6214  "jsonrpc": "2.0",
6215  "method": "iscsi_target_node_request_logout",
6216  "id": 1
6217}
6218~~~
6219
6220Example response:
6221
6222~~~json
6223{
6224  "jsonrpc": "2.0",
6225  "id": 1,
6226  "result": true
6227}
6228~~~
6229
6230## NVMe-oF Target {#jsonrpc_components_nvmf_tgt}
6231
6232### nvmf_create_transport method {#rpc_nvmf_create_transport}
6233
6234Initialize an NVMe-oF transport with the given options.
6235
6236#### Parameters
6237
6238Name                        | Optional | Type    | Description
6239--------------------------- | -------- | --------| -----------
6240trtype                      | Required | string  | Transport type (ex. RDMA)
6241tgt_name                    | Optional | string  | Parent NVMe-oF target name.
6242max_queue_depth             | Optional | number  | Max number of outstanding I/O per queue
6243max_io_qpairs_per_ctrlr     | Optional | number  | Max number of IO qpairs per controller
6244in_capsule_data_size        | Optional | number  | Max number of in-capsule data size
6245max_io_size                 | Optional | number  | Max I/O size (bytes)
6246io_unit_size                | Optional | number  | I/O unit size (bytes)
6247max_aq_depth                | Optional | number  | Max number of admin cmds per AQ
6248num_shared_buffers          | Optional | number  | The number of pooled data buffers available to the transport
6249buf_cache_size              | Optional | number  | The number of shared buffers to reserve for each poll group
6250num_cqe                     | Optional | number  | The number of CQ entires. Only used when no_srq=true (RDMA only)
6251max_srq_depth               | Optional | number  | The number of elements in a per-thread shared receive queue (RDMA only)
6252no_srq                      | Optional | boolean | Disable shared receive queue even for devices that support it. (RDMA only)
6253c2h_success                 | Optional | boolean | Disable C2H success optimization (TCP only)
6254dif_insert_or_strip         | Optional | boolean | Enable DIF insert for write I/O and DIF strip for read I/O DIF
6255sock_priority               | Optional | number  | The socket priority of the connection owned by this transport (TCP only)
6256acceptor_backlog            | Optional | number  | The number of pending connections allowed in backlog before failing new connection attempts (RDMA only)
6257abort_timeout_sec           | Optional | number  | Abort execution timeout value, in seconds
6258no_wr_batching              | Optional | boolean | Disable work requests batching (RDMA only)
6259control_msg_num             | Optional | number  | The number of control messages per poll group (TCP only)
6260disable_mappable_bar0       | Optional | boolean | disable client mmap() of BAR0 (VFIO-USER only)
6261zcopy                       | Optional | boolean | Use zero-copy operations if the underlying bdev supports them
6262
6263#### Example
6264
6265Example request:
6266
6267~~~json
6268{
6269  "jsonrpc": "2.0",
6270  "method": "nvmf_create_transport",
6271  "id": 1,
6272  "params": {
6273    "trtype": "RDMA",
6274    "max_queue_depth": 32
6275  }
6276}
6277~~~
6278
6279Example response:
6280
6281~~~json
6282{
6283  "jsonrpc": "2.0",
6284  "id": 1,
6285  "result": true
6286}
6287~~~
6288
6289### nvmf_get_subsystems method {#rpc_nvmf_get_subsystems}
6290
6291#### Parameters
6292
6293Name                        | Optional | Type        | Description
6294--------------------------- | -------- | ------------| -----------
6295tgt_name                    | Optional | string      | Parent NVMe-oF target name.
6296
6297#### Example
6298
6299Example request:
6300
6301~~~json
6302{
6303  "jsonrpc": "2.0",
6304  "id": 1,
6305  "method": "nvmf_get_subsystems"
6306}
6307~~~
6308
6309Example response:
6310
6311~~~json
6312{
6313  "jsonrpc": "2.0",
6314  "id": 1,
6315  "result": [
6316    {
6317      "nqn": "nqn.2014-08.org.nvmexpress.discovery",
6318      "subtype": "Discovery"
6319      "listen_addresses": [],
6320      "hosts": [],
6321      "allow_any_host": true
6322    },
6323    {
6324      "nqn": "nqn.2016-06.io.spdk:cnode1",
6325      "subtype": "NVMe",
6326      "listen_addresses": [
6327        {
6328          "trtype": "RDMA",
6329          "adrfam": "IPv4",
6330          "traddr": "192.168.0.123",
6331          "trsvcid": "4420"
6332        }
6333      ],
6334      "hosts": [
6335        {"nqn": "nqn.2016-06.io.spdk:host1"}
6336      ],
6337      "allow_any_host": false,
6338      "serial_number": "abcdef",
6339      "model_number": "ghijklmnop",
6340      "namespaces": [
6341        {"nsid": 1, "name": "Malloc2"},
6342        {"nsid": 2, "name": "Nvme0n1"}
6343      ]
6344    }
6345  ]
6346}
6347~~~
6348
6349### nvmf_create_subsystem method {#rpc_nvmf_create_subsystem}
6350
6351Construct an NVMe over Fabrics target subsystem.
6352
6353#### Parameters
6354
6355Name                    | Optional | Type        | Description
6356----------------------- | -------- | ----------- | -----------
6357nqn                     | Required | string      | Subsystem NQN
6358tgt_name                | Optional | string      | Parent NVMe-oF target name.
6359serial_number           | Optional | string      | Serial number of virtual controller
6360model_number            | Optional | string      | Model number of virtual controller
6361max_namespaces          | Optional | number      | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
6362allow_any_host          | Optional | boolean     | Allow any host (`true`) or enforce allowed host list (`false`). Default: `false`.
6363ana_reporting           | Optional | boolean     | Enable ANA reporting feature (default: `false`).
6364min_cntlid              | Optional | number      | Minimum controller ID. Default: 1
6365max_cntlid              | Optional | number      | Maximum controller ID. Default: 0xffef
6366
6367#### Example
6368
6369Example request:
6370
6371~~~json
6372{
6373  "jsonrpc": "2.0",
6374  "id": 1,
6375  "method": "nvmf_create_subsystem",
6376  "params": {
6377    "nqn": "nqn.2016-06.io.spdk:cnode1",
6378    "allow_any_host": false,
6379    "serial_number": "abcdef",
6380    "model_number": "ghijklmnop"
6381  }
6382}
6383~~~
6384
6385Example response:
6386
6387~~~json
6388{
6389  "jsonrpc": "2.0",
6390  "id": 1,
6391  "result": true
6392}
6393~~~
6394
6395### nvmf_delete_subsystem method {#rpc_nvmf_delete_subsystem}
6396
6397Delete an existing NVMe-oF subsystem.
6398
6399#### Parameters
6400
6401Parameter              | Optional | Type        | Description
6402---------------------- | -------- | ----------- | -----------
6403nqn                    | Required | string      | Subsystem NQN to delete.
6404tgt_name               | Optional | string      | Parent NVMe-oF target name.
6405
6406#### Example
6407
6408Example request:
6409
6410~~~json
6411{
6412  "jsonrpc": "2.0",
6413  "id": 1,
6414  "method": "nvmf_delete_subsystem",
6415  "params": {
6416    "nqn": "nqn.2016-06.io.spdk:cnode1"
6417  }
6418}
6419~~~
6420
6421Example response:
6422
6423~~~json
6424{
6425  "jsonrpc": "2.0",
6426  "id": 1,
6427  "result": true
6428}
6429~~~
6430
6431### nvmf_subsystem_add_listener  method {#rpc_nvmf_subsystem_add_listener}
6432
6433Add a new listen address to an NVMe-oF subsystem.
6434
6435#### Parameters
6436
6437Name                    | Optional | Type        | Description
6438----------------------- | -------- | ----------- | -----------
6439nqn                     | Required | string      | Subsystem NQN
6440tgt_name                | Optional | string      | Parent NVMe-oF target name.
6441listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
6442
6443#### listen_address {#rpc_nvmf_listen_address}
6444
6445Name                    | Optional | Type        | Description
6446----------------------- | -------- | ----------- | -----------
6447trtype                  | Required | string      | Transport type ("RDMA")
6448adrfam                  | Required | string      | Address family ("IPv4", "IPv6", "IB", or "FC")
6449traddr                  | Required | string      | Transport address
6450trsvcid                 | Optional | string      | Transport service ID (required for RDMA or TCP)
6451
6452#### Example
6453
6454Example request:
6455
6456~~~json
6457{
6458  "jsonrpc": "2.0",
6459  "id": 1,
6460  "method": "nvmf_subsystem_add_listener",
6461  "params": {
6462    "nqn": "nqn.2016-06.io.spdk:cnode1",
6463    "listen_address": {
6464      "trtype": "RDMA",
6465      "adrfam": "IPv4",
6466      "traddr": "192.168.0.123",
6467      "trsvcid": "4420"
6468    }
6469  }
6470}
6471~~~
6472
6473Example response:
6474
6475~~~json
6476{
6477  "jsonrpc": "2.0",
6478  "id": 1,
6479  "result": true
6480}
6481~~~
6482
6483### nvmf_subsystem_remove_listener  method {#rpc_nvmf_subsystem_remove_listener}
6484
6485Remove a listen address from an NVMe-oF subsystem.
6486
6487#### Parameters
6488
6489Name                    | Optional | Type        | Description
6490----------------------- | -------- | ----------- | -----------
6491nqn                     | Required | string      | Subsystem NQN
6492tgt_name                | Optional | string      | Parent NVMe-oF target name.
6493listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
6494
6495#### Example
6496
6497Example request:
6498
6499~~~json
6500{
6501  "jsonrpc": "2.0",
6502  "id": 1,
6503  "method": "nvmf_subsystem_remove_listener",
6504  "params": {
6505    "nqn": "nqn.2016-06.io.spdk:cnode1",
6506    "listen_address": {
6507      "trtype": "RDMA",
6508      "adrfam": "IPv4",
6509      "traddr": "192.168.0.123",
6510      "trsvcid": "4420"
6511    }
6512  }
6513}
6514~~~
6515
6516Example response:
6517
6518~~~json
6519{
6520  "jsonrpc": "2.0",
6521  "id": 1,
6522  "result": true
6523}
6524~~~
6525
6526### nvmf_subsystem_listener_set_ana_state  method {#rpc_nvmf_subsystem_listener_set_ana_state}
6527
6528Set ANA state of a listener for an NVMe-oF subsystem. Only the ANA state of the specified ANA
6529group is updated, or ANA states of all ANA groups if ANA group is not specified.
6530
6531#### Parameters
6532
6533Name                    | Optional | Type        | Description
6534----------------------- | -------- | ----------- | -----------
6535nqn                     | Required | string      | Subsystem NQN
6536tgt_name                | Optional | string      | Parent NVMe-oF target name.
6537listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
6538ana_state               | Required | string      | ANA state to set ("optimized", "non_optimized", or "inaccessible")
6539anagrpid                | Optional | number      | ANA group ID
6540
6541#### Example
6542
6543Example request:
6544
6545~~~json
6546{
6547  "jsonrpc": "2.0",
6548  "id": 1,
6549  "method": "nvmf_subsystem_listener_set_ana_state",
6550  "params": {
6551    "nqn": "nqn.2016-06.io.spdk:cnode1",
6552    "listen_address": {
6553      "trtype": "RDMA",
6554      "adrfam": "IPv4",
6555      "traddr": "192.168.0.123",
6556      "trsvcid": "4420"
6557    },
6558    "ana_state", "inaccessible"
6559  }
6560}
6561~~~
6562
6563Example response:
6564
6565~~~json
6566{
6567  "jsonrpc": "2.0",
6568  "id": 1,
6569  "result": true
6570}
6571~~~
6572
6573### nvmf_subsystem_add_ns method {#rpc_nvmf_subsystem_add_ns}
6574
6575Add a namespace to a subsystem. The namespace ID is returned as the result.
6576
6577### Parameters
6578
6579Name                    | Optional | Type        | Description
6580----------------------- | -------- | ----------- | -----------
6581nqn                     | Required | string      | Subsystem NQN
6582namespace               | Required | object      | @ref rpc_nvmf_namespace object
6583tgt_name                | Optional | string      | Parent NVMe-oF target name.
6584
6585#### namespace {#rpc_nvmf_namespace}
6586
6587Name                    | Optional | Type        | Description
6588----------------------- | -------- | ----------- | -----------
6589nsid                    | Optional | number      | Namespace ID between 1 and 4294967294, inclusive. Default: Automatically assign NSID.
6590bdev_name               | Required | string      | Name of bdev to expose as a namespace.
6591nguid                   | Optional | string      | 16-byte namespace globally unique identifier in hexadecimal (e.g. "ABCDEF0123456789ABCDEF0123456789")
6592eui64                   | Optional | string      | 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789")
6593uuid                    | Optional | string      | RFC 4122 UUID (e.g. "ceccf520-691e-4b46-9546-34af789907c5")
6594ptpl_file               | Optional | string      | File path to save/restore persistent reservation information
6595anagrpid                | Optional | number      | ANA group ID. Default: Namespace ID.
6596
6597#### Example
6598
6599Example request:
6600
6601~~~json
6602{
6603  "jsonrpc": "2.0",
6604  "id": 1,
6605  "method": "nvmf_subsystem_add_ns",
6606  "params": {
6607    "nqn": "nqn.2016-06.io.spdk:cnode1",
6608    "namespace": {
6609      "nsid": 3,
6610      "bdev_name": "Nvme0n1",
6611      "ptpl_file": "/opt/Nvme0n1PR.json"
6612    }
6613  }
6614}
6615~~~
6616
6617Example response:
6618
6619~~~json
6620{
6621  "jsonrpc": "2.0",
6622  "id": 1,
6623  "result": 3
6624}
6625~~~
6626
6627### nvmf_subsystem_remove_ns method {#rpc_nvmf_subsystem_remove_ns}
6628
6629Remove a namespace from a subsystem.
6630
6631#### Parameters
6632
6633Name                    | Optional | Type        | Description
6634----------------------- | -------- | ----------- | -----------
6635nqn                     | Required | string      | Subsystem NQN
6636nsid                    | Required | number      | Namespace ID
6637tgt_name                | Optional | string      | Parent NVMe-oF target name.
6638
6639#### Example
6640
6641Example request:
6642
6643~~~json
6644{
6645  "jsonrpc": "2.0",
6646  "id": 1,
6647  "method": "nvmf_subsystem_remove_ns",
6648  "params": {
6649    "nqn": "nqn.2016-06.io.spdk:cnode1",
6650    "nsid": 1
6651  }
6652}
6653~~~
6654
6655Example response:
6656
6657~~~json
6658{
6659  "jsonrpc": "2.0",
6660  "id": 1,
6661  "result": true
6662}
6663~~~
6664
6665### nvmf_subsystem_add_host method {#rpc_nvmf_subsystem_add_host}
6666
6667Add a host NQN to the list of allowed hosts.
6668
6669#### Parameters
6670
6671Name                    | Optional | Type        | Description
6672----------------------- | -------- | ----------- | -----------
6673nqn                     | Required | string      | Subsystem NQN
6674host                    | Required | string      | Host NQN to add to the list of allowed host NQNs
6675tgt_name                | Optional | string      | Parent NVMe-oF target name.
6676
6677#### Example
6678
6679Example request:
6680
6681~~~json
6682{
6683  "jsonrpc": "2.0",
6684  "id": 1,
6685  "method": "nvmf_subsystem_add_host",
6686  "params": {
6687    "nqn": "nqn.2016-06.io.spdk:cnode1",
6688    "host": "nqn.2016-06.io.spdk:host1"
6689  }
6690}
6691~~~
6692
6693Example response:
6694
6695~~~json
6696{
6697  "jsonrpc": "2.0",
6698  "id": 1,
6699  "result": true
6700}
6701~~~
6702
6703### nvmf_subsystem_remove_host method {#rpc_nvmf_subsystem_remove_host}
6704
6705Remove a host NQN from the list of allowed hosts.
6706
6707#### Parameters
6708
6709Name                    | Optional | Type        | Description
6710----------------------- | -------- | ----------- | -----------
6711nqn                     | Required | string      | Subsystem NQN
6712host                    | Required | string      | Host NQN to remove from the list of allowed host NQNs
6713tgt_name                | Optional | string      | Parent NVMe-oF target name.
6714
6715#### Example
6716
6717Example request:
6718
6719~~~json
6720{
6721  "jsonrpc": "2.0",
6722  "id": 1,
6723  "method": "nvmf_subsystem_remove_host",
6724  "params": {
6725    "nqn": "nqn.2016-06.io.spdk:cnode1",
6726    "host": "nqn.2016-06.io.spdk:host1"
6727  }
6728}
6729~~~
6730
6731Example response:
6732
6733~~~json
6734{
6735  "jsonrpc": "2.0",
6736  "id": 1,
6737  "result": true
6738}
6739~~~
6740
6741### nvmf_subsystem_allow_any_host method {#rpc_nvmf_subsystem_allow_any_host}
6742
6743Configure a subsystem to allow any host to connect or to enforce the host NQN list.
6744
6745#### Parameters
6746
6747Name                    | Optional | Type        | Description
6748----------------------- | -------- | ----------- | -----------
6749nqn                     | Required | string      | Subsystem NQN
6750allow_any_host          | Required | boolean     | Allow any host (`true`) or enforce allowed host list (`false`).
6751tgt_name                | Optional | string      | Parent NVMe-oF target name.
6752
6753#### Example
6754
6755Example request:
6756
6757~~~json
6758{
6759  "jsonrpc": "2.0",
6760  "id": 1,
6761  "method": "nvmf_subsystem_allow_any_host",
6762  "params": {
6763    "nqn": "nqn.2016-06.io.spdk:cnode1",
6764    "allow_any_host": true
6765  }
6766}
6767~~~
6768
6769Example response:
6770
6771~~~json
6772{
6773  "jsonrpc": "2.0",
6774  "id": 1,
6775  "result": true
6776}
6777~~~
6778
6779### nvmf_subsystem_get_controllers {#rpc_nvmf_subsystem_get_controllers}
6780
6781#### Parameters
6782
6783Name                    | Optional | Type        | Description
6784----------------------- | -------- | ----------- | -----------
6785nqn                     | Required | string      | Subsystem NQN
6786tgt_name                | Optional | string      | Parent NVMe-oF target name.
6787
6788#### Example
6789
6790Example request:
6791
6792~~~json
6793{
6794  "jsonrpc": "2.0",
6795  "id": 1,
6796  "method": "nvmf_subsystem_get_controllers",
6797  "params": {
6798    "nqn": "nqn.2016-06.io.spdk:cnode1"
6799  }
6800}
6801~~~
6802
6803Example response:
6804
6805~~~json
6806{
6807  "jsonrpc": "2.0",
6808  "id": 1,
6809  "result": [
6810    {
6811      "cntlid": 1,
6812      "hostnqn": "nqn.2016-06.io.spdk:host1",
6813      "hostid": "27dad528-6368-41c3-82d3-0b956b49025d",
6814      "num_io_qpairs": 5
6815    }
6816  ]
6817}
6818~~~
6819
6820### nvmf_subsystem_get_qpairs {#rpc_nvmf_subsystem_get_qpairs}
6821
6822#### Parameters
6823
6824Name                    | Optional | Type        | Description
6825----------------------- | -------- | ----------- | -----------
6826nqn                     | Required | string      | Subsystem NQN
6827tgt_name                | Optional | string      | Parent NVMe-oF target name.
6828
6829#### Example
6830
6831Example request:
6832
6833~~~json
6834{
6835  "jsonrpc": "2.0",
6836  "id": 1,
6837  "method": "nvmf_subsystem_get_qpairs",
6838  "params": {
6839    "nqn": "nqn.2016-06.io.spdk:cnode1"
6840  }
6841}
6842~~~
6843
6844Example response:
6845
6846~~~json
6847{
6848  "jsonrpc": "2.0",
6849  "id": 1,
6850  "result": [
6851    {
6852      "cntlid": 1,
6853      "qid": 0,
6854      "state": "active",
6855      "listen_address": {
6856        "trtype": "RDMA",
6857        "adrfam": "IPv4",
6858        "traddr": "192.168.0.123",
6859        "trsvcid": "4420"
6860      }
6861    },
6862    {
6863      "cntlid": 1,
6864      "qid": 1,
6865      "state": "active",
6866      "listen_address": {
6867        "trtype": "RDMA",
6868        "adrfam": "IPv4",
6869        "traddr": "192.168.0.123",
6870        "trsvcid": "4420"
6871      }
6872    }
6873  ]
6874}
6875~~~
6876
6877### nvmf_subsystem_get_listeners {#rpc_nvmf_subsystem_get_listeners}
6878
6879#### Parameters
6880
6881Name                    | Optional | Type        | Description
6882----------------------- | -------- | ----------- | -----------
6883nqn                     | Required | string      | Subsystem NQN
6884tgt_name                | Optional | string      | Parent NVMe-oF target name.
6885
6886#### Example
6887
6888Example request:
6889
6890~~~json
6891{
6892  "jsonrpc": "2.0",
6893  "id": 1,
6894  "method": "nvmf_subsystem_get_listeners",
6895  "params": {
6896    "nqn": "nqn.2016-06.io.spdk:cnode1"
6897  }
6898}
6899~~~
6900
6901Example response:
6902
6903~~~json
6904{
6905  "jsonrpc": "2.0",
6906  "id": 1,
6907  "result": [
6908    {
6909      "address": {
6910        "trtype": "RDMA",
6911        "adrfam": "IPv4",
6912        "traddr": "192.168.0.123",
6913        "trsvcid": "4420"
6914      },
6915      "ana_state": "optimized"
6916    }
6917  ]
6918}
6919~~~
6920
6921### nvmf_set_max_subsystems {#rpc_nvmf_set_max_subsystems}
6922
6923Set the maximum allowed subsystems for the NVMe-oF target.  This RPC may only be called
6924before SPDK subsystems have been initialized.
6925
6926#### Parameters
6927
6928Name                    | Optional | Type        | Description
6929----------------------- | -------- | ----------- | -----------
6930max_subsystems          | Required | number      | Maximum number of NVMe-oF subsystems
6931
6932#### Example
6933
6934Example request:
6935
6936~~~json
6937{
6938  "jsonrpc": "2.0",
6939  "id": 1,
6940  "method": "nvmf_set_max_subsystems",
6941  "params": {
6942    "max_subsystems": 1024
6943  }
6944}
6945~~~
6946
6947Example response:
6948
6949~~~json
6950{
6951  "jsonrpc": "2.0",
6952  "id": 1,
6953  "result": true
6954}
6955~~~
6956
6957### nvmf_set_config {#rpc_nvmf_set_config}
6958
6959Set global configuration of NVMe-oF target.  This RPC may only be called before SPDK subsystems
6960have been initialized.
6961
6962#### Parameters
6963
6964Name                    | Optional | Type        | Description
6965----------------------- | -------- | ----------- | -----------
6966acceptor_poll_rate      | Optional | number      | Polling interval of the acceptor for incoming connections (microseconds)
6967admin_cmd_passthru      | Optional | object      | Admin command passthru configuration
6968poll_groups_mask        | Optional | string      | Set cpumask for NVMf poll groups
6969discovery_filter        | Optional | string      | Set discovery filter, possible values are: `match_any` (default) or comma separated values: `transport`, `address`, `svcid`
6970
6971#### admin_cmd_passthru {#spdk_nvmf_admin_passthru_conf}
6972
6973Name                    | Optional | Type        | Description
6974----------------------- | -------- | ----------- | -----------
6975identify_ctrlr          | Required | bool        | If true, enables custom identify handler that reports some identify attributes from the underlying NVMe drive
6976
6977#### Example
6978
6979Example request:
6980
6981~~~json
6982{
6983  "jsonrpc": "2.0",
6984  "id": 1,
6985  "method": "nvmf_set_config",
6986  "params": {
6987    "acceptor_poll_rate": 10000
6988  }
6989}
6990~~~
6991
6992Example response:
6993
6994~~~json
6995{
6996  "jsonrpc": "2.0",
6997  "id": 1,
6998  "result": true
6999}
7000~~~
7001
7002### nvmf_get_transports method {#rpc_nvmf_get_transports}
7003
7004#### Parameters
7005
7006The user may specify no parameters in order to list all transports, or a transport may be
7007specified by type.
7008
7009Name                        | Optional | Type        | Description
7010--------------------------- | -------- | ------------| -----------
7011tgt_name                    | Optional | string      | Parent NVMe-oF target name.
7012trtype                      | Optional | string      | Transport type.
7013
7014#### Example
7015
7016Example request:
7017
7018~~~json
7019{
7020  "jsonrpc": "2.0",
7021  "id": 1,
7022  "method": "nvmf_get_transports"
7023}
7024~~~
7025
7026Example response:
7027
7028~~~json
7029{
7030  "jsonrpc": "2.0",
7031  "id": 1,
7032  "result": [
7033    {
7034      "type": "RDMA".
7035      "max_queue_depth": 128,
7036      "max_io_qpairs_per_ctrlr": 64,
7037      "in_capsule_data_size": 4096,
7038      "max_io_size": 131072,
7039      "io_unit_size": 131072,
7040      "abort_timeout_sec": 1
7041    }
7042  ]
7043}
7044~~~
7045
7046### nvmf_get_stats method {#rpc_nvmf_get_stats}
7047
7048Retrieve current statistics of the NVMf subsystem.
7049
7050#### Parameters
7051
7052Name                        | Optional | Type        | Description
7053--------------------------- | -------- | ------------| -----------
7054tgt_name                    | Optional | string      | Parent NVMe-oF target name.
7055
7056#### Response
7057
7058The response is an object containing NVMf subsystem statistics.
7059In the response, `admin_qpairs` and `io_qpairs` are reflecting cumulative queue pair counts while
7060`current_admin_qpairs` and `current_io_qpairs` are showing the current number.
7061
7062#### Example
7063
7064Example request:
7065
7066~~~json
7067{
7068  "jsonrpc": "2.0",
7069  "method": "nvmf_get_stats",
7070  "id": 1
7071}
7072~~~
7073
7074Example response:
7075
7076~~~json
7077{
7078  "jsonrpc": "2.0",
7079  "id": 1,
7080  "result": {
7081    "tick_rate": 2400000000,
7082    "poll_groups": [
7083      {
7084        "name": "app_thread",
7085        "admin_qpairs": 1,
7086        "io_qpairs": 4,
7087        "current_admin_qpairs": 1,
7088        "current_io_qpairs": 2,
7089        "pending_bdev_io": 1721,
7090        "transports": [
7091          {
7092            "trtype": "RDMA",
7093            "pending_data_buffer": 12131888,
7094            "devices": [
7095              {
7096                "name": "mlx5_1",
7097                "polls": 72284105,
7098                "completions": 0,
7099                "requests": 0,
7100                "request_latency": 0,
7101                "pending_free_request": 0,
7102                "pending_rdma_read": 0,
7103                "pending_rdma_write": 0,
7104                "total_send_wrs": 0,
7105                "send_doorbell_updates": 0,
7106                "total_recv_wrs": 0,
7107                "recv_doorbell_updates": 1
7108              },
7109              {
7110                "name": "mlx5_0",
7111                "polls": 72284105,
7112                "completions": 15165875,
7113                "requests": 7582935,
7114                "request_latency": 1249323766184,
7115                "pending_free_request": 0,
7116                "pending_rdma_read": 337602,
7117                "pending_rdma_write": 0,
7118                "total_send_wrs": 15165875,
7119                "send_doorbell_updates": 1516587,
7120                "total_recv_wrs": 15165875,
7121                "recv_doorbell_updates": 1516587
7122              }
7123            ]
7124          }
7125        ]
7126      }
7127    ]
7128  }
7129}
7130~~~
7131
7132### nvmf_set_crdt {#rpc_nvmf_set_crdt}
7133
7134Set the 3 CRDT (Command Retry Delay Time) values. For details about
7135CRDT, please refer to the NVMe specification. Currently all the
7136SPDK nvmf subsystems share the same CRDT values. The default values
7137are 0. This rpc can only be invoked in STARTUP stage. All values are
7138in units of 100 milliseconds (same as the NVMe specification).
7139
7140#### Parameters
7141
7142Name                    | Optional | Type        | Description
7143----------------------- | -------- | ----------- | -----------
7144crdt1                   | Optional | number      | Command Retry Delay Time 1
7145crdt2                   | Optional | number      | Command Retry Delay Time 2
7146crdt3                   | Optional | number      | Command Retry Delay Time 3
7147
7148## Vhost Target {#jsonrpc_components_vhost_tgt}
7149
7150The following common preconditions need to be met in all target types.
7151
7152Controller name will be used to create UNIX domain socket. This implies that name concatenated with vhost socket
7153directory path needs to be valid UNIX socket name.
7154
7155@ref cpu_mask parameter is used to choose CPU on which pollers will be launched when new initiator is connecting.
7156It must be a subset of application CPU mask. Default value is CPU mask of the application.
7157
7158### vhost_controller_set_coalescing {#rpc_vhost_controller_set_coalescing}
7159
7160Controls interrupt coalescing for specific target. Because `delay_base_us` is used to calculate delay in CPU ticks
7161there is no hardcoded limit for this parameter. Only limitation is that final delay in CPU ticks might not overflow
716232 bit unsigned integer (which is more than 1s @ 4GHz CPU). In real scenarios `delay_base_us` should be much lower
7163than 150us. To disable coalescing set `delay_base_us` to 0.
7164
7165#### Parameters
7166
7167Name                    | Optional | Type        | Description
7168----------------------- | -------- | ----------- | -----------
7169ctrlr                   | Required | string      | Controller name
7170delay_base_us           | Required | number      | Base (minimum) coalescing time in microseconds
7171iops_threshold          | Required | number      | Coalescing activation level greater than 0 in IO per second
7172
7173#### Example
7174
7175Example request:
7176
7177~~~json
7178{
7179  "params": {
7180    "iops_threshold": 100000,
7181    "ctrlr": "VhostScsi0",
7182    "delay_base_us": 80
7183  },
7184  "jsonrpc": "2.0",
7185  "method": "vhost_controller_set_coalescing",
7186  "id": 1
7187}
7188~~~
7189
7190Example response:
7191
7192~~~json
7193{
7194  "jsonrpc": "2.0",
7195  "id": 1,
7196  "result": true
7197}
7198~~~
7199
7200### vhost_create_scsi_controller {#rpc_vhost_create_scsi_controller}
7201
7202Construct vhost SCSI target.
7203
7204#### Parameters
7205
7206Name                    | Optional | Type        | Description
7207----------------------- | -------- | ----------- | -----------
7208ctrlr                   | Required | string      | Controller name
7209cpumask                 | Optional | string      | @ref cpu_mask for this controller
7210
7211#### Example
7212
7213Example request:
7214
7215~~~json
7216{
7217  "params": {
7218    "cpumask": "0x2",
7219    "ctrlr": "VhostScsi0"
7220  },
7221  "jsonrpc": "2.0",
7222  "method": "vhost_create_scsi_controller",
7223  "id": 1
7224}
7225~~~
7226
7227Example response:
7228
7229~~~json
7230{
7231  "jsonrpc": "2.0",
7232  "id": 1,
7233  "result": true
7234}
7235~~~
7236
7237### vhost_scsi_controller_add_target {#rpc_vhost_scsi_controller_add_target}
7238
7239In vhost target `ctrlr` create SCSI target with ID `scsi_target_num` and add `bdev_name` as LUN 0.
7240
7241#### Parameters
7242
7243Name                    | Optional | Type        | Description
7244----------------------- | -------- | ----------- | -----------
7245ctrlr                   | Required | string      | Controller name
7246scsi_target_num         | Required | number      | SCSI target ID between 0 and 7 or -1 to use first free ID.
7247bdev_name               | Required | string      | Name of bdev to expose as a LUN 0
7248
7249#### Response
7250
7251SCSI target ID.
7252
7253#### Example
7254
7255Example request:
7256
7257~~~json
7258{
7259  "params": {
7260    "scsi_target_num": 1,
7261    "bdev_name": "Malloc0",
7262    "ctrlr": "VhostScsi0"
7263  },
7264  "jsonrpc": "2.0",
7265  "method": "vhost_scsi_controller_add_target",
7266  "id": 1
7267}
7268~~~
7269
7270Example response:
7271
7272~~~json
7273response:
7274{
7275  "jsonrpc": "2.0",
7276  "id": 1,
7277  "result": 1
7278}
7279~~~
7280
7281### vhost_scsi_controller_remove_target {#rpc_vhost_scsi_controller_remove_target}
7282
7283Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`.
7284
7285This method will fail if initiator is connected, but doesn't support hot-remove (the `VIRTIO_SCSI_F_HOTPLUG` is not negotiated).
7286
7287#### Parameters
7288
7289Name                    | Optional | Type        | Description
7290----------------------- | -------- | ----------- | -----------
7291ctrlr                   | Required | string      | Controller name
7292scsi_target_num         | Required | number      | SCSI target ID between 0 and 7
7293
7294#### Example
7295
7296Example request:
7297
7298~~~json
7299request:
7300{
7301  "params": {
7302    "scsi_target_num": 1,
7303    "ctrlr": "VhostScsi0"
7304  },
7305  "jsonrpc": "2.0",
7306  "method": "vhost_scsi_controller_remove_target",
7307  "id": 1
7308}
7309~~~
7310
7311Example response:
7312
7313~~~json
7314{
7315  "jsonrpc": "2.0",
7316  "id": 1,
7317  "result": true
7318}
7319~~~
7320
7321### vhost_create_blk_controller {#rpc_vhost_create_blk_controller}
7322
7323Create vhost block controller
7324
7325If `readonly` is `true` then vhost block target will be created as read only and fail any write requests.
7326The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator.
7327
7328#### Parameters
7329
7330Name                    | Optional | Type        | Description
7331----------------------- | -------- | ----------- | -----------
7332ctrlr                   | Required | string      | Controller name
7333bdev_name               | Required | string      | Name of bdev to expose block device
7334readonly                | Optional | boolean     | If true, this target will be read only (default: false)
7335cpumask                 | Optional | string      | @ref cpu_mask for this controller
7336
7337#### Example
7338
7339Example request:
7340
7341~~~json
7342{
7343  "params": {
7344    "dev_name": "Malloc0",
7345    "ctrlr": "VhostBlk0"
7346  },
7347  "jsonrpc": "2.0",
7348  "method": "vhost_create_blk_controller",
7349  "id": 1
7350}
7351~~~
7352
7353Example response:
7354
7355~~~json
7356{
7357  "jsonrpc": "2.0",
7358  "id": 1,
7359  "result": true
7360}
7361~~~
7362
7363### vhost_get_controllers {#rpc_vhost_get_controllers}
7364
7365Display information about all or specific vhost controller(s).
7366
7367#### Parameters
7368
7369The user may specify no parameters in order to list all controllers, or a controller may be
7370specified by name.
7371
7372Name                    | Optional | Type        | Description
7373----------------------- | -------- | ----------- | -----------
7374name                    | Optional | string      | Vhost controller name
7375
7376#### Response {#rpc_vhost_get_controllers_response}
7377
7378Response is an array of objects describing requested controller(s). Common fields are:
7379
7380Name                    | Type        | Description
7381----------------------- | ----------- | -----------
7382ctrlr                   | string      | Controller name
7383cpumask                 | string      | @ref cpu_mask of this controller
7384delay_base_us           | number      | Base (minimum) coalescing time in microseconds (0 if disabled)
7385iops_threshold          | number      | Coalescing activation level
7386backend_specific        | object      | Backend specific informations
7387
7388### Vhost block {#rpc_vhost_get_controllers_blk}
7389
7390`backend_specific` contains one `block` object  of type:
7391
7392Name                    | Type        | Description
7393----------------------- | ----------- | -----------
7394bdev                    | string      | Backing bdev name or Null if bdev is hot-removed
7395readonly                | boolean     | True if controllers is readonly, false otherwise
7396
7397### Vhost SCSI {#rpc_vhost_get_controllers_scsi}
7398
7399`backend_specific` contains `scsi` array of following objects:
7400
7401Name                    | Type        | Description
7402----------------------- | ----------- | -----------
7403target_name             | string      | Name of this SCSI target
7404id                      | number      | Unique SPDK global SCSI target ID
7405scsi_dev_num            | number      | SCSI target ID initiator will see when scanning this controller
7406luns                    | array       | array of objects describing @ref rpc_vhost_get_controllers_scsi_luns
7407
7408### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns}
7409
7410Object of type:
7411
7412Name                    | Type        | Description
7413----------------------- | ----------- | -----------
7414id                      | number      | SCSI LUN ID
7415bdev_name               | string      | Backing bdev name
7416
7417### Vhost NVMe {#rpc_vhost_get_controllers_nvme}
7418
7419`backend_specific` contains `namespaces` array of following objects:
7420
7421Name                    | Type        | Description
7422----------------------- | ----------- | -----------
7423nsid                    | number      | Namespace ID
7424bdev                    | string      | Backing bdev name
7425
7426#### Example
7427
7428Example request:
7429
7430~~~json
7431{
7432  "jsonrpc": "2.0",
7433  "method": "vhost_get_controllers",
7434  "id": 1
7435}
7436~~~
7437
7438Example response:
7439
7440~~~json
7441{
7442  "jsonrpc": "2.0",
7443  "id": 1,
7444  "result": [
7445    {
7446      "cpumask": "0x2",
7447      "backend_specific": {
7448        "block": {
7449          "readonly": false,
7450          "bdev": "Malloc0"
7451        }
7452      },
7453      "iops_threshold": 60000,
7454      "ctrlr": "VhostBlk0",
7455      "delay_base_us": 100
7456    },
7457    {
7458      "cpumask": "0x2",
7459      "backend_specific": {
7460        "scsi": [
7461          {
7462            "target_name": "Target 2",
7463            "luns": [
7464              {
7465                "id": 0,
7466                "bdev_name": "Malloc1"
7467              }
7468            ],
7469            "id": 0,
7470            "scsi_dev_num": 2
7471          },
7472          {
7473            "target_name": "Target 5",
7474            "luns": [
7475              {
7476                "id": 0,
7477                "bdev_name": "Malloc2"
7478              }
7479            ],
7480            "id": 1,
7481            "scsi_dev_num": 5
7482          }
7483        ]
7484      },
7485      "iops_threshold": 60000,
7486      "ctrlr": "VhostScsi0",
7487      "delay_base_us": 0
7488    },
7489    {
7490      "cpumask": "0x2",
7491      "backend_specific": {
7492        "namespaces": [
7493          {
7494            "bdev": "Malloc3",
7495            "nsid": 1
7496          },
7497          {
7498            "bdev": "Malloc4",
7499            "nsid": 2
7500          }
7501        ]
7502      },
7503      "iops_threshold": 60000,
7504      "ctrlr": "VhostNvme0",
7505      "delay_base_us": 0
7506    }
7507  ]
7508}
7509~~~
7510
7511### vhost_delete_controller {#rpc_vhost_delete_controller}
7512
7513Remove vhost target.
7514
7515This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of
7516vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_vhost_scsi_controller_remove_target.
7517
7518#### Parameters
7519
7520Name                    | Optional | Type        | Description
7521----------------------- | -------- | ----------- | -----------
7522ctrlr                   | Required | string      | Controller name
7523
7524#### Example
7525
7526Example request:
7527
7528~~~json
7529{
7530  "params": {
7531    "ctrlr": "VhostNvme0"
7532  },
7533  "jsonrpc": "2.0",
7534  "method": "vhost_delete_controller",
7535  "id": 1
7536}
7537~~~
7538
7539Example response:
7540
7541~~~json
7542{
7543  "jsonrpc": "2.0",
7544  "id": 1,
7545  "result": true
7546}
7547~~~
7548
7549## Logical Volume {#jsonrpc_components_lvol}
7550
7551Identification of logical volume store and logical volume is explained first.
7552
7553A logical volume store has a UUID and a name for its identification.
7554The UUID is generated on creation and it can be used as a unique identifier.
7555The name is specified on creation and can be renamed.
7556Either UUID or name is used to access logical volume store in RPCs.
7557
7558A logical volume has a UUID and a name for its identification.
7559The UUID of the logical volume is generated on creation and it can be unique identifier.
7560The alias of the logical volume takes the format _lvs_name/lvol_name_ where:
7561
7562* _lvs_name_ is the name of the logical volume store.
7563* _lvol_name_ is specified on creation and can be renamed.
7564
7565### bdev_lvol_create_lvstore {#rpc_bdev_lvol_create_lvstore}
7566
7567Construct a logical volume store.
7568
7569#### Parameters
7570
7571Name                    | Optional | Type        | Description
7572----------------------- | -------- | ----------- | -----------
7573bdev_name               | Required | string      | Bdev on which to construct logical volume store
7574lvs_name                | Required | string      | Name of the logical volume store to create
7575cluster_sz              | Optional | number      | Cluster size of the logical volume store in bytes
7576clear_method            | Optional | string      | Change clear method for data region. Available: none, unmap (default), write_zeroes
7577
7578#### Response
7579
7580UUID of the created logical volume store is returned.
7581
7582#### Example
7583
7584Example request:
7585
7586~~~json
7587{
7588  "jsonrpc": "2.0",
7589  "id": 1,
7590  "method": "bdev_lvol_create_lvstore",
7591  "params": {
7592    "lvs_name": "LVS0",
7593    "bdev_name": "Malloc0"
7594    "clear_method": "write_zeroes"
7595  }
7596}
7597~~~
7598
7599Example response:
7600
7601~~~json
7602{
7603  "jsonrpc": "2.0",
7604  "id": 1,
7605  "result": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
7606}
7607~~~
7608
7609### bdev_lvol_delete_lvstore {#rpc_bdev_lvol_delete_lvstore}
7610
7611Destroy a logical volume store.
7612
7613#### Parameters
7614
7615Name                    | Optional | Type        | Description
7616----------------------- | -------- | ----------- | -----------
7617uuid                    | Optional | string      | UUID of the logical volume store to destroy
7618lvs_name                | Optional | string      | Name of the logical volume store to destroy
7619
7620Either uuid or lvs_name must be specified, but not both.
7621
7622#### Example
7623
7624Example request:
7625
7626~~~json
7627{
7628  "jsonrpc": "2.0",
7629  "method": "bdev_lvol_delete_lvstore",
7630  "id": 1
7631  "params": {
7632    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
7633  }
7634}
7635~~~
7636
7637Example response:
7638
7639~~~json
7640{
7641  "jsonrpc": "2.0",
7642  "id": 1,
7643  "result": true
7644}
7645~~~
7646
7647### bdev_lvol_get_lvstores {#rpc_bdev_lvol_get_lvstores}
7648
7649Get a list of logical volume stores.
7650
7651#### Parameters
7652
7653Name                    | Optional | Type        | Description
7654----------------------- | -------- | ----------- | -----------
7655uuid                    | Optional | string      | UUID of the logical volume store to retrieve information about
7656lvs_name                | Optional | string      | Name of the logical volume store to retrieve information about
7657
7658Either uuid or lvs_name may be specified, but not both.
7659If both uuid and lvs_name are omitted, information about all logical volume stores is returned.
7660
7661#### Example
7662
7663Example request:
7664
7665~~~json
7666{
7667  "jsonrpc": "2.0",
7668  "method": "bdev_lvol_get_lvstores",
7669  "id": 1,
7670  "params": {
7671    "lvs_name": "LVS0"
7672  }
7673}
7674~~~
7675
7676Example response:
7677
7678~~~json
7679{
7680  "jsonrpc": "2.0",
7681  "id": 1,
7682  "result": [
7683    {
7684      "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5",
7685      "base_bdev": "Malloc0",
7686      "free_clusters": 31,
7687      "cluster_size": 4194304,
7688      "total_data_clusters": 31,
7689      "block_size": 4096,
7690      "name": "LVS0"
7691    }
7692  ]
7693}
7694~~~
7695
7696### bdev_lvol_rename_lvstore {#rpc_bdev_lvol_rename_lvstore}
7697
7698Rename a logical volume store.
7699
7700#### Parameters
7701
7702Name                    | Optional | Type        | Description
7703----------------------- | -------- | ----------- | -----------
7704old_name                | Required | string      | Existing logical volume store name
7705new_name                | Required | string      | New logical volume store name
7706
7707#### Example
7708
7709Example request:
7710
7711~~~json
7712{
7713  "jsonrpc": "2.0",
7714  "method": "bdev_lvol_rename_lvstore",
7715  "id": 1,
7716  "params": {
7717    "old_name": "LVS0",
7718    "new_name": "LVS2"
7719  }
7720}
7721~~~
7722
7723Example response:
7724
7725~~~json
7726{
7727  "jsonrpc": "2.0",
7728  "id": 1,
7729  "result": true
7730}
7731~~~
7732
7733### bdev_lvol_create {#rpc_bdev_lvol_create}
7734
7735Create a logical volume on a logical volume store.
7736
7737#### Parameters
7738
7739Name                    | Optional | Type        | Description
7740----------------------- | -------- | ----------- | -----------
7741lvol_name               | Required | string      | Name of logical volume to create
7742size                    | Required | number      | Desired size of logical volume in bytes
7743thin_provision          | Optional | boolean     | True to enable thin provisioning
7744uuid                    | Optional | string      | UUID of logical volume store to create logical volume on
7745lvs_name                | Optional | string      | Name of logical volume store to create logical volume on
7746clear_method            | Optional | string      | Change default data clusters clear method. Available: none, unmap, write_zeroes
7747
7748Size will be rounded up to a multiple of cluster size. Either uuid or lvs_name must be specified, but not both.
7749lvol_name will be used in the alias of the created logical volume.
7750
7751#### Response
7752
7753UUID of the created logical volume is returned.
7754
7755#### Example
7756
7757Example request:
7758
7759~~~json
7760{
7761  "jsonrpc": "2.0",
7762  "method": "bdev_lvol_create",
7763  "id": 1,
7764  "params": {
7765    "lvol_name": "LVOL0",
7766    "size": 1048576,
7767    "lvs_name": "LVS0",
7768    "clear_method": "unmap",
7769    "thin_provision": true
7770  }
7771}
7772~~~
7773
7774Example response:
7775
7776~~~json
7777{
7778  "jsonrpc": "2.0",
7779  "id": 1,
7780  "result": "1b38702c-7f0c-411e-a962-92c6a5a8a602"
7781}
7782~~~
7783
7784### bdev_lvol_snapshot {#rpc_bdev_lvol_snapshot}
7785
7786Capture a snapshot of the current state of a logical volume.
7787
7788#### Parameters
7789
7790Name                    | Optional | Type        | Description
7791----------------------- | -------- | ----------- | -----------
7792lvol_name               | Required | string      | UUID or alias of the logical volume to create a snapshot from
7793snapshot_name           | Required | string      | Name for the newly created snapshot
7794
7795#### Response
7796
7797UUID of the created logical volume snapshot is returned.
7798
7799#### Example
7800
7801Example request:
7802
7803~~~json
7804{
7805  "jsonrpc": "2.0",
7806  "method": "bdev_lvol_snapshot",
7807  "id": 1,
7808  "params": {
7809    "lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602",
7810    "snapshot_name": "SNAP1"
7811  }
7812}
7813~~~
7814
7815Example response:
7816
7817~~~json
7818{
7819  "jsonrpc": "2.0",
7820  "id": 1,
7821  "result": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670"
7822}
7823~~~
7824
7825### bdev_lvol_clone {#rpc_bdev_lvol_clone}
7826
7827Create a logical volume based on a snapshot.
7828
7829#### Parameters
7830
7831Name                    | Optional | Type        | Description
7832----------------------- | -------- | ----------- | -----------
7833snapshot_name           | Required | string      | UUID or alias of the snapshot to clone
7834clone_name              | Required | string      | Name for the logical volume to create
7835
7836#### Response
7837
7838UUID of the created logical volume clone is returned.
7839
7840#### Example
7841
7842Example request:
7843
7844~~~json
7845{
7846  "jsonrpc": "2.0"
7847  "method": "bdev_lvol_clone",
7848  "id": 1,
7849  "params": {
7850    "snapshot_name": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670",
7851    "clone_name": "CLONE1"
7852  }
7853}
7854~~~
7855
7856Example response:
7857
7858~~~json
7859{
7860  "jsonrpc": "2.0",
7861  "id": 1,
7862  "result": "8d87fccc-c278-49f0-9d4c-6237951aca09"
7863}
7864~~~
7865
7866### bdev_lvol_rename {#rpc_bdev_lvol_rename}
7867
7868Rename a logical volume. New name will rename only the alias of the logical volume.
7869
7870#### Parameters
7871
7872Name                    | Optional | Type        | Description
7873----------------------- | -------- | ----------- | -----------
7874old_name                | Required | string      | UUID or alias of the existing logical volume
7875new_name                | Required | string      | New logical volume name
7876
7877#### Example
7878
7879Example request:
7880
7881~~~json
7882{
7883  "jsonrpc": "2.0",
7884  "method": "bdev_lvol_rename",
7885  "id": 1,
7886  "params": {
7887    "old_name": "067df606-6dbc-4143-a499-0d05855cb3b8",
7888    "new_name": "LVOL2"
7889  }
7890}
7891~~~
7892
7893Example response:
7894
7895~~~json
7896{
7897  "jsonrpc": "2.0",
7898  "id": 1,
7899  "result": true
7900}
7901~~~
7902
7903### bdev_lvol_resize {#rpc_bdev_lvol_resize}
7904
7905Resize a logical volume.
7906
7907#### Parameters
7908
7909Name                    | Optional | Type        | Description
7910----------------------- | -------- | ----------- | -----------
7911name                    | Required | string      | UUID or alias of the logical volume to resize
7912size                    | Required | number      | Desired size of the logical volume in bytes
7913
7914#### Example
7915
7916Example request:
7917
7918~~~json
7919{
7920  "jsonrpc": "2.0",
7921  "method": "bdev_lvol_resize",
7922  "id": 1,
7923  "params": {
7924    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
7925    "size": 2097152
7926  }
7927}
7928~~~
7929
7930Example response:
7931
7932~~~json
7933{
7934  "jsonrpc": "2.0",
7935  "id": 1,
7936  "result": true
7937}
7938~~~
7939
7940### bdev_lvol_set_read_only{#rpc_bdev_lvol_set_read_only}
7941
7942Mark logical volume as read only.
7943
7944#### Parameters
7945
7946Name                    | Optional | Type        | Description
7947----------------------- | -------- | ----------- | -----------
7948name                    | Required | string      | UUID or alias of the logical volume to set as read only
7949
7950#### Example
7951
7952Example request:
7953
7954~~~json
7955{
7956  "jsonrpc": "2.0",
7957  "method": "bdev_lvol_set_read_only",
7958  "id": 1,
7959  "params": {
7960    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
7961  }
7962}
7963~~~
7964
7965Example response:
7966
7967~~~json
7968{
7969  "jsonrpc": "2.0",
7970  "id": 1,
7971  "result": true
7972}
7973~~~
7974
7975### bdev_lvol_delete {#rpc_bdev_lvol_delete}
7976
7977Destroy a logical volume.
7978
7979#### Parameters
7980
7981Name                    | Optional | Type        | Description
7982----------------------- | -------- | ----------- | -----------
7983name                    | Required | string      | UUID or alias of the logical volume to destroy
7984
7985#### Example
7986
7987Example request:
7988
7989~~~json
7990{
7991  "jsonrpc": "2.0",
7992  "method": "bdev_lvol_delete",
7993  "id": 1,
7994  "params": {
7995    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a"
7996  }
7997}
7998~~~
7999
8000Example response:
8001
8002~~~json
8003{
8004  "jsonrpc": "2.0",
8005  "id": 1,
8006  "result": true
8007}
8008~~~
8009
8010### bdev_lvol_inflate {#rpc_bdev_lvol_inflate}
8011
8012Inflate a logical volume. All unallocated clusters are allocated and copied from the parent or zero filled
8013if not allocated in the parent. Then all dependencies on the parent are removed.
8014
8015### Parameters
8016
8017Name                    | Optional | Type        | Description
8018----------------------- | -------- | ----------- | -----------
8019name                    | Required | string      | UUID or alias of the logical volume to inflate
8020
8021#### Example
8022
8023Example request:
8024
8025~~~json
8026{
8027  "jsonrpc": "2.0",
8028  "method": "bdev_lvol_inflate",
8029  "id": 1,
8030  "params": {
8031    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
8032  }
8033}
8034~~~
8035
8036Example response:
8037
8038~~~json
8039{
8040  "jsonrpc": "2.0",
8041  "id": 1,
8042  "result": true
8043}
8044~~~
8045
8046### bdev_lvol_decouple_parent {#rpc_bdev_lvol_decouple_parent}
8047
8048Decouple the parent of a logical volume. For unallocated clusters which is allocated in the parent, they are
8049allocated and copied from the parent, but for unallocated clusters which is thin provisioned in the parent,
8050they are kept thin provisioned. Then all dependencies on the parent are removed.
8051
8052#### Parameters
8053
8054Name                    | Optional | Type        | Description
8055----------------------- | -------- | ----------- | -----------
8056name                    | Required | string      | UUID or alias of the logical volume to decouple the parent of it
8057
8058#### Example
8059
8060Example request:
8061
8062~~~json
8063{
8064  "jsonrpc": "2.0",
8065  "method": "bdev_lvol_decouple_parent",
8066  "id": 1.
8067  "params": {
8068    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
8069  }
8070}
8071~~~
8072
8073Example response:
8074
8075~~~json
8076{
8077  "jsonrpc": "2.0",
8078  "id": 1,
8079  "result": true
8080}
8081~~~
8082
8083## RAID
8084
8085### bdev_raid_get_bdevs {#rpc_bdev_raid_get_bdevs}
8086
8087This is used to list all the raid bdev names based on the input category requested. Category should be one
8088of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether they are online or
8089configuring or offline. 'online' is the raid bdev which is registered with bdev layer. 'configuring' is
8090the raid bdev which does not have full configuration discovered yet. 'offline' is the raid bdev which is
8091not registered with bdev as of now and it has encountered any error or user has requested to offline
8092the raid bdev.
8093
8094#### Parameters
8095
8096Name                    | Optional | Type        | Description
8097----------------------- | -------- | ----------- | -----------
8098category                | Required | string      | all or online or configuring or offline
8099
8100#### Example
8101
8102Example request:
8103
8104~~~json
8105{
8106  "jsonrpc": "2.0",
8107  "method": "bdev_raid_get_bdevs",
8108  "id": 1,
8109  "params": {
8110    "category": "all"
8111  }
8112}
8113~~~
8114
8115Example response:
8116
8117~~~json
8118{
8119  "jsonrpc": "2.0",
8120  "id": 1,
8121  "result": [
8122    "Raid0"
8123  ]
8124}
8125~~~
8126
8127### bdev_raid_create {#rpc_bdev_raid_create}
8128
8129Constructs new RAID bdev.
8130
8131#### Parameters
8132
8133Name                    | Optional | Type        | Description
8134----------------------- | -------- | ----------- | -----------
8135name                    | Required | string      | RAID bdev name
8136strip_size_kb           | Required | number      | Strip size in KB
8137raid_level              | Required | string      | RAID level
8138base_bdevs              | Required | string      | Base bdevs name, whitespace separated list in quotes
8139
8140#### Example
8141
8142Example request:
8143
8144~~~json
8145{
8146  "jsonrpc": "2.0",
8147  "method": "bdev_raid_create",
8148  "id": 1,
8149  "params": {
8150    "name": "Raid0",
8151    "raid_level": "0",
8152    "base_bdevs": [
8153      "Malloc0",
8154      "Malloc1",
8155      "Malloc2",
8156      "Malloc3"
8157    ],
8158    "strip_size_kb": 4
8159  }
8160}
8161~~~
8162
8163Example response:
8164
8165~~~json
8166{
8167  "jsonrpc": "2.0",
8168  "id": 1,
8169  "result": true
8170}
8171~~~
8172
8173### bdev_raid_delete {#rpc_bdev_raid_delete}
8174
8175Removes RAID bdev.
8176
8177#### Parameters
8178
8179Name                    | Optional | Type        | Description
8180----------------------- | -------- | ----------- | -----------
8181name                    | Required | string      | RAID bdev name
8182
8183#### Example
8184
8185Example request:
8186
8187~~~json
8188{
8189  "jsonrpc": "2.0",
8190  "method": "bdev_raid_delete",
8191  "id": 1,
8192  "params": {
8193    "name": "Raid0"
8194  }
8195}
8196~~~
8197
8198Example response:
8199
8200~~~json
8201{
8202  "jsonrpc": "2.0",
8203  "id": 1,
8204  "result": true
8205}
8206~~~
8207
8208## SPLIT
8209
8210### bdev_split_create {#rpc_bdev_split_create}
8211
8212This is used to split an underlying block device and create several smaller equal-sized vbdevs.
8213
8214#### Parameters
8215
8216Name                    | Optional | Type        | Description
8217----------------------- | -------- | ----------- | -----------
8218base_bdev               | Required | string      | base bdev name
8219split_count             | Required | number      | number of splits
8220split_size_mb           | Optional | number      | size in MB to restrict the size
8221
8222#### Example
8223
8224Example request:
8225
8226~~~json
8227{
8228  "jsonrpc": "2.0",
8229  "method": "bdev_split_create",
8230  "id": 1,
8231  "params": {
8232    "base_bdev": "Malloc0",
8233    "split_count": 4
8234  }
8235}
8236~~~
8237
8238Example response:
8239
8240~~~json
8241{
8242  "jsonrpc": "2.0",
8243  "id": 1,
8244  "result": [
8245    "Malloc0p0",
8246    "Malloc0p1",
8247    "Malloc0p2",
8248    "Malloc0p3"
8249  ]
8250}
8251~~~
8252
8253### bdev_split_delete {#rpc_bdev_split_delete}
8254
8255This is used to remove the split vbdevs.
8256
8257#### Parameters
8258
8259Name                    | Optional | Type        | Description
8260----------------------- | -------- | ----------- | -----------
8261base_bdev               | Required | string      | base bdev name
8262
8263#### Example
8264
8265Example request:
8266
8267~~~json
8268{
8269  "jsonrpc": "2.0",
8270  "method": "bdev_split_delete",
8271  "id": 1,
8272  "params": {
8273    "base_bdev": "Malloc0"
8274  }
8275}
8276~~~
8277
8278Example response:
8279
8280~~~json
8281{
8282  "jsonrpc": "2.0",
8283  "id": 1,
8284  "result": true
8285}
8286~~~
8287
8288## Uring
8289
8290### bdev_uring_create {#rpc_bdev_uring_create}
8291
8292Create a bdev with io_uring backend.
8293
8294#### Parameters
8295
8296Name                    | Optional | Type        | Description
8297----------------------- | -------- | ----------- | -----------
8298filename                | Required | string      | path to device or file (ex: /dev/nvme0n1)
8299name                    | Required | string      | name of bdev
8300block_size              | Optional | number      | block size of device (If omitted, get the block size from the file)
8301
8302#### Example
8303
8304Example request:
8305
8306~~~json
8307{
8308  "jsonrpc": "2.0",
8309  "method": "bdev_uring_create",
8310  "id": 1,
8311  "params": {
8312    "name": "bdev_u0",
8313    "filename": "/dev/nvme0n1",
8314    "block_size": 512
8315  }
8316}
8317~~~
8318
8319Example response:
8320
8321~~~json
8322{
8323  "jsonrpc": "2.0",
8324  "id": 1,
8325  "result": "bdev_u0"
8326}
8327~~~
8328
8329### bdev_uring_delete {#rpc_bdev_uring_delete}
8330
8331Remove a uring bdev.
8332
8333#### Parameters
8334
8335Name                    | Optional | Type        | Description
8336----------------------- | -------- | ----------- | -----------
8337name                    | Required | string      | name of uring bdev to delete
8338
8339#### Example
8340
8341Example request:
8342
8343~~~json
8344{
8345  "jsonrpc": "2.0",
8346  "method": "bdev_uring_delete",
8347  "id": 1,
8348  "params": {
8349    "name": "bdev_u0"
8350  }
8351}
8352~~~
8353
8354Example response:
8355
8356~~~json
8357{
8358  "jsonrpc": "2.0",
8359  "id": 1,
8360  "result": true
8361}
8362~~~
8363
8364## OPAL
8365
8366### bdev_nvme_opal_init {#rpc_bdev_nvme_opal_init}
8367
8368This is used to initialize OPAL of a given NVMe ctrlr, including taking ownership and activating.
8369
8370#### Parameters
8371
8372Name                    | Optional | Type        | Description
8373----------------------- | -------- | ----------- | -----------
8374nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
8375password                | Required | string      | admin password of OPAL
8376
8377#### Example
8378
8379Example request:
8380
8381~~~json
8382{
8383  "jsonrpc": "2.0",
8384  "method": "bdev_nvme_opal_init",
8385  "id": 1,
8386  "params": {
8387    "nvme_ctrlr_name": "nvme0",
8388    "password": "*****"
8389  }
8390}
8391~~~
8392
8393Example response:
8394
8395~~~json
8396{
8397  "jsonrpc": "2.0",
8398  "id": 1,
8399  "result": true
8400}
8401~~~
8402
8403### bdev_nvme_opal_revert {#rpc_bdev_nvme_opal_revert}
8404
8405This is used to revert OPAL to its factory settings. Erase all user configuration and data.
8406
8407#### Parameters
8408
8409Name                    | Optional | Type        | Description
8410----------------------- | -------- | ----------- | -----------
8411nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
8412password                | Required | string      | admin password of OPAL
8413
8414#### Example
8415
8416Example request:
8417
8418~~~json
8419{
8420  "jsonrpc": "2.0",
8421  "method": "bdev_nvme_opal_revert",
8422  "id": 1,
8423  "params": {
8424    "nvme_ctrlr_name": "nvme0",
8425    "password": "*****"
8426  }
8427}
8428~~~
8429
8430Example response:
8431
8432~~~json
8433{
8434  "jsonrpc": "2.0",
8435  "id": 1,
8436  "result": true
8437}
8438~~~
8439
8440### bdev_opal_create {#rpc_bdev_opal_create}
8441
8442This is used to create an OPAL virtual bdev.
8443
8444#### Parameters
8445
8446Name                    | Optional | Type        | Description
8447----------------------- | -------- | ----------- | -----------
8448nvme_ctrlr_name         | Required | string      | name of nvme ctrlr that supports OPAL
8449nsid                    | Required | number      | namespace ID
8450locking_range_id        | Required | number      | OPAL locking range ID
8451range_start             | Required | number      | locking range start LBA
8452range_length            | Required | number      | locking range length
8453password                | Required | string      | admin password of OPAL
8454
8455#### Response
8456
8457The response is the name of created OPAL virtual bdev.
8458
8459#### Example
8460
8461Example request:
8462
8463~~~json
8464{
8465  "jsonrpc": "2.0",
8466  "method": "bdev_opal_create",
8467  "id": 1,
8468  "params": {
8469    "nvme_ctrlr_name": "nvme0",
8470    "nsid": 1,
8471    "locking_range_id": 1,
8472    "range_start": 0,
8473    "range_length": 4096,
8474    "password": "*****"
8475  }
8476}
8477~~~
8478
8479Example response:
8480
8481~~~json
8482{
8483  "jsonrpc": "2.0",
8484  "id": 1,
8485  "result": "nvme0n1r1"
8486}
8487~~~
8488
8489### bdev_opal_get_info {#rpc_bdev_opal_get_info}
8490
8491This is used to get information of a given OPAL bdev.
8492
8493#### Parameters
8494
8495Name                    | Optional | Type        | Description
8496----------------------- | -------- | ----------- | -----------
8497bdev_name               | Required | string      | name of OPAL vbdev
8498password                | Required | string      | admin password
8499
8500#### Response
8501
8502The response is the locking info of OPAL virtual bdev.
8503
8504#### Example
8505
8506Example request:
8507
8508~~~json
8509{
8510  "jsonrpc": "2.0",
8511  "method": "bdev_opal_get_info",
8512  "id": 1,
8513  "params": {
8514    "bdev_name": "nvme0n1r1",
8515    "password": "*****"
8516  }
8517}
8518~~~
8519
8520Example response:
8521
8522~~~json
8523{
8524  "jsonrpc": "2.0",
8525  "id": 1,
8526  "result": {
8527      "name": "nvme0n1r1",
8528      "range_start": 0,
8529      "range_length": 4096,
8530      "read_lock_enabled": true,
8531      "write_lock_enabled": true,
8532      "read_locked": false,
8533      "write_locked": false
8534    }
8535}
8536~~~
8537
8538### bdev_opal_delete {#rpc_bdev_opal_delete}
8539
8540This is used to delete OPAL vbdev.
8541
8542#### Parameters
8543
8544Name                    | Optional | Type        | Description
8545----------------------- | -------- | ----------- | -----------
8546bdev_name               | Required | string      | name of OPAL vbdev
8547password                | Required | string      | admin password
8548
8549#### Example
8550
8551Example request:
8552
8553~~~json
8554{
8555  "jsonrpc": "2.0",
8556  "method": "bdev_opal_delete",
8557  "id": 1,
8558  "params": {
8559    "bdev_name": "nvme0n1r1",
8560    "password": "*****"
8561  }
8562}
8563~~~
8564
8565Example response:
8566
8567~~~json
8568{
8569  "jsonrpc": "2.0",
8570  "id": 1,
8571  "result": true
8572}
8573~~~
8574
8575### bdev_opal_new_user {#rpc_bdev_opal_new_user}
8576
8577This enables a new user to the specified opal bdev so that the user can lock/unlock the bdev.
8578Recalling this for the same opal bdev, only the newest user will have the privilege.
8579
8580#### Parameters
8581
8582Name                    | Optional | Type        | Description
8583----------------------- | -------- | ----------- | -----------
8584bdev_name               | Required | string      | name of OPAL vbdev
8585admin_password          | Required | string      | admin password
8586user_id                 | Required | number      | user ID
8587user_password           | Required | string      | user password
8588
8589#### Example
8590
8591Example request:
8592
8593~~~json
8594{
8595  "jsonrpc": "2.0",
8596  "method": "bdev_opal_new_user",
8597  "id": 1,
8598  "params": {
8599    "bdev_name": "nvme0n1r1",
8600    "admin_password": "*****",
8601    "user_id": "1",
8602    "user_password": "********"
8603  }
8604}
8605~~~
8606
8607Example response:
8608
8609~~~json
8610{
8611  "jsonrpc": "2.0",
8612  "id": 1,
8613  "result": true
8614}
8615~~~
8616
8617### bdev_opal_set_lock_state {#rpc_bdev_opal_set_lock_state}
8618
8619This is used to lock/unlock specific opal bdev providing user ID and password.
8620
8621#### Parameters
8622
8623Name                    | Optional | Type        | Description
8624----------------------- | -------- | ----------- | -----------
8625bdev_name               | Required | string      | name of OPAL vbdev
8626user_id                 | Required | number      | user ID
8627password                | Required | string      | user password
8628lock_state              | Required | string      | lock state
8629
8630#### Example
8631
8632Example request:
8633
8634~~~json
8635{
8636  "jsonrpc": "2.0",
8637  "method": "bdev_opal_set_lock_state",
8638  "id": 1,
8639  "params": {
8640    "bdev_name": "nvme0n1r1",
8641    "user_id": "1",
8642    "user_password": "********",
8643    "lock_state": "rwlock"
8644  }
8645}
8646~~~
8647
8648Example response:
8649
8650~~~json
8651{
8652  "jsonrpc": "2.0",
8653  "id": 1,
8654  "result": true
8655}
8656~~~
8657
8658## Notifications
8659
8660### notify_get_types {#rpc_notify_get_types}
8661
8662Return list of all supported notification types.
8663
8664#### Parameters
8665
8666None
8667
8668#### Response
8669
8670The response is an array of strings - supported RPC notification types.
8671
8672#### Example
8673
8674Example request:
8675
8676~~~json
8677{
8678  "jsonrpc": "2.0",
8679  "method": "notify_get_types",
8680  "id": 1
8681}
8682~~~
8683
8684Example response:
8685
8686~~~json
8687{
8688  "id": 1,
8689  "result": [
8690    "bdev_register",
8691    "bdev_unregister"
8692  ],
8693  "jsonrpc": "2.0"
8694}
8695~~~
8696
8697### notify_get_notifications {#notify_get_notifications}
8698
8699Request notifications. Returns array of notifications that happend since the specified id (or first that is available).
8700
8701Notice: Notifications are kept in circular buffer with limited size. Older notifications might be inaccessible
8702due to being overwritten by new ones.
8703
8704#### Parameters
8705
8706Name                    | Optional | Type        | Description
8707----------------------- | -------- | ----------- | -----------
8708id                      | Optional | number      | First Event ID to fetch (default: first available).
8709max                     | Optional | number      | Maximum number of event to return (default: no limit).
8710
8711#### Response
8712
8713Response is an array of event objects.
8714
8715Name                    | Optional | Type        | Description
8716----------------------- | -------- | ----------- | -----------
8717id                      | Optional | number      | Event ID.
8718type                    | Optional | number      | Type of the event.
8719ctx                     | Optional | string      | Event context.
8720
8721#### Example
8722
8723Example request:
8724
8725~~~json
8726{
8727  "id": 1,
8728  "jsonrpc": "2.0",
8729  "method": "notify_get_notifications",
8730  "params": {
8731    "id": 1,
8732    "max": 10
8733  }
8734}
8735
8736~~~
8737
8738Example response:
8739
8740~~~json
8741{
8742  "jsonrpc": "2.0",
8743  "id": 1,
8744  "result": [
8745    {
8746      "ctx": "Malloc0",
8747      "type": "bdev_register",
8748      "id": 1
8749    },
8750    {
8751      "ctx": "Malloc2",
8752      "type": "bdev_register",
8753      "id": 2
8754    }
8755  ]
8756}
8757~~~
8758
8759## Linux Network Block Device (NBD) {#jsonrpc_components_nbd}
8760
8761SPDK supports exporting bdevs through Linux nbd. These devices then appear as standard Linux kernel block devices
8762and can be accessed using standard utilities like fdisk.
8763
8764In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.
8765
8766### nbd_start_disk {#rpc_nbd_start_disk}
8767
8768Start to export one SPDK bdev as NBD disk
8769
8770#### Parameters
8771
8772Name                    | Optional | Type        | Description
8773----------------------- | -------- | ----------- | -----------
8774bdev_name               | Required | string      | Bdev name to export
8775nbd_device              | Optional | string      | NBD device name to assign
8776
8777#### Response
8778
8779Path of exported NBD disk
8780
8781#### Example
8782
8783Example request:
8784
8785~~~json
8786{
8787 "params": {
8788    "nbd_device": "/dev/nbd1",
8789    "bdev_name": "Malloc1"
8790  },
8791  "jsonrpc": "2.0",
8792  "method": "nbd_start_disk",
8793  "id": 1
8794}
8795~~~
8796
8797Example response:
8798
8799~~~json
8800{
8801  "jsonrpc": "2.0",
8802  "id": 1,
8803  "result": "/dev/nbd1"
8804}
8805~~~
8806
8807### nbd_stop_disk {#rpc_nbd_stop_disk}
8808
8809Stop one NBD disk which is based on SPDK bdev.
8810
8811#### Parameters
8812
8813Name                    | Optional | Type        | Description
8814----------------------- | -------- | ----------- | -----------
8815nbd_device              | Required | string      | NBD device name to stop
8816
8817#### Example
8818
8819Example request:
8820
8821~~~json
8822{
8823 "params": {
8824    "nbd_device": "/dev/nbd1",
8825  },
8826  "jsonrpc": "2.0",
8827  "method": "nbd_stop_disk",
8828  "id": 1
8829}
8830~~~
8831
8832Example response:
8833
8834~~~json
8835{
8836  "jsonrpc": "2.0",
8837  "id": 1,
8838  "result": "true"
8839}
8840~~~
8841
8842### nbd_get_disks {#rpc_nbd_get_disks}
8843
8844Display all or specified NBD device list
8845
8846#### Parameters
8847
8848Name                    | Optional | Type        | Description
8849----------------------- | -------- | ----------- | -----------
8850nbd_device              | Optional | string      | NBD device name to display
8851
8852#### Response
8853
8854The response is an array of exported NBD devices and their corresponding SPDK bdev.
8855
8856#### Example
8857
8858Example request:
8859
8860~~~json
8861{
8862  "jsonrpc": "2.0",
8863  "method": "nbd_get_disks",
8864  "id": 1
8865}
8866~~~
8867
8868Example response:
8869
8870~~~json
8871{
8872  "jsonrpc": "2.0",
8873  "id": 1,
8874  "result":  [
8875    {
8876      "bdev_name": "Malloc0",
8877      "nbd_device": "/dev/nbd0"
8878    },
8879    {
8880      "bdev_name": "Malloc1",
8881      "nbd_device": "/dev/nbd1"
8882    }
8883  ]
8884}
8885~~~
8886
8887## Blobfs {#jsonrpc_components_blobfs}
8888
8889### blobfs_detect {#rpc_blobfs_detect}
8890
8891Detect whether a blobfs exists on bdev.
8892
8893#### Parameters
8894
8895Name                    | Optional | Type        | Description
8896----------------------- | -------- | ----------- | -----------
8897bdev_name               | Required | string      | Block device name to detect blobfs
8898
8899#### Response
8900
8901True if a blobfs exists on the bdev; False otherwise.
8902
8903#### Example
8904
8905Example request:
8906
8907~~~json
8908{
8909  "jsonrpc": "2.0",
8910  "id": 1,
8911  "method": "blobfs_detect",
8912  "params": {
8913    "bdev_name": "Malloc0"
8914  }
8915}
8916~~~
8917
8918Example response:
8919
8920~~~json
8921{
8922  "jsonrpc": "2.0",
8923  "id": 1,
8924  "result": "true"
8925}
8926~~~
8927
8928### blobfs_create {#rpc_blobfs_create}
8929
8930Build blobfs on bdev.
8931
8932#### Parameters
8933
8934Name                    | Optional | Type        | Description
8935----------------------- | -------- | ----------- | -----------
8936bdev_name               | Required | string      | Block device name to create blobfs
8937cluster_sz              | Optional | number      | Size of cluster in bytes. Must be multiple of 4KiB page size, default and minimal value is 1M.
8938
8939#### Example
8940
8941Example request:
8942
8943~~~json
8944{
8945  "jsonrpc": "2.0",
8946  "id": 1,
8947  "method": "blobfs_create",
8948  "params": {
8949    "bdev_name": "Malloc0",
8950    "cluster_sz": 1M
8951  }
8952}
8953~~~
8954
8955Example response:
8956
8957~~~json
8958{
8959  "jsonrpc": "2.0",
8960  "id": 1,
8961  "result": "true"
8962}
8963~~~
8964
8965### blobfs_mount {#rpc_blobfs_mount}
8966
8967Mount a blobfs on bdev to one host path through FUSE
8968
8969#### Parameters
8970
8971Name                    | Optional | Type        | Description
8972----------------------- | -------- | ----------- | -----------
8973bdev_name               | Required | string      | Block device name where the blobfs is
8974mountpoint              | Required | string      | Mountpoint path in host to mount blobfs
8975
8976#### Example
8977
8978Example request:
8979
8980~~~json
8981{
8982  "jsonrpc": "2.0",
8983  "id": 1,
8984  "method": ""blobfs_mount"",
8985  "params": {
8986    "bdev_name": "Malloc0",
8987    "mountpoint": "/mnt/"
8988  }
8989}
8990~~~
8991
8992Example response:
8993
8994~~~json
8995{
8996  "jsonrpc": "2.0",
8997  "id": 1,
8998  "result": "true"
8999}
9000~~~
9001
9002### blobfs_set_cache_size {#rpc_blobfs_set_cache_size}
9003
9004Set cache pool size for blobfs filesystems.  This RPC is only permitted when the cache pool is not already initialized.
9005
9006The cache pool is initialized when the first blobfs filesystem is initialized or loaded.  It is freed when the all
9007initialized or loaded filesystems are unloaded.
9008
9009#### Parameters
9010
9011Name                    | Optional | Type        | Description
9012----------------------- | -------- | ----------- | -----------
9013size_in_mb              | Required | number      | Cache size in megabytes
9014
9015#### Response
9016
9017True if cache size is set successfully; False if failed to set.
9018
9019#### Example
9020
9021Example request:
9022
9023~~~json
9024{
9025  "jsonrpc": "2.0",
9026  "id": 1,
9027  "method": "blobfs_set_cache_size",
9028  "params": {
9029    "size_in_mb": 512,
9030  }
9031}
9032~~~
9033
9034Example response:
9035
9036~~~json
9037{
9038  "jsonrpc": "2.0",
9039  "id": 1,
9040  "result": true
9041}
9042~~~
9043
9044## Socket layer {#jsonrpc_components_sock}
9045
9046### sock_impl_get_options {#rpc_sock_impl_get_options}
9047
9048Get parameters for the socket layer implementation.
9049
9050#### Parameters
9051
9052Name                    | Optional | Type        | Description
9053----------------------- | -------- | ----------- | -----------
9054impl_name               | Required | string      | Name of socket implementation, e.g. posix
9055
9056#### Response
9057
9058Response is an object with current socket layer options for requested implementation.
9059
9060#### Example
9061
9062Example request:
9063
9064~~~json
9065{
9066  "jsonrpc": "2.0",
9067  "method": "sock_impl_get_options",
9068  "id": 1,
9069  "params": {
9070    "impl_name": "posix"
9071  }
9072}
9073~~~
9074
9075Example response:
9076
9077~~~json
9078{
9079  "jsonrpc": "2.0",
9080  "id": 1,
9081  "result": {
9082    "recv_buf_size": 2097152,
9083    "send_buf_size": 2097152,
9084    "enable_recv_pipe": true,
9085    "enable_quickack": true,
9086    "enable_placement_id": 0,
9087    "enable_zerocopy_send_server": true,
9088    "enable_zerocopy_send_client": false
9089  }
9090}
9091~~~
9092
9093### sock_impl_set_options {#rpc_sock_impl_set_options}
9094
9095Set parameters for the socket layer implementation.
9096
9097#### Parameters
9098
9099Name                        | Optional | Type        | Description
9100--------------------------- | -------- | ----------- | -----------
9101impl_name                   | Required | string      | Name of socket implementation, e.g. posix
9102recv_buf_size               | Optional | number      | Size of socket receive buffer in bytes
9103send_buf_size               | Optional | number      | Size of socket send buffer in bytes
9104enable_recv_pipe            | Optional | boolean     | Enable or disable receive pipe
9105enable_quick_ack            | Optional | boolean     | Enable or disable quick ACK
9106enable_placement_id         | Optional | number      | Enable or disable placement_id. 0:disable,1:incoming_napi,2:incoming_cpu
9107enable_zerocopy_send_server | Optional | boolean     | Enable or disable zero copy on send for server sockets
9108enable_zerocopy_send_client | Optional | boolean     | Enable or disable zero copy on send for client sockets
9109
9110#### Response
9111
9112True if socket layer options were set successfully.
9113
9114#### Example
9115
9116Example request:
9117
9118~~~json
9119{
9120  "jsonrpc": "2.0",
9121  "method": "sock_impl_set_options",
9122  "id": 1,
9123  "params": {
9124    "impl_name": "posix",
9125    "recv_buf_size": 2097152,
9126    "send_buf_size": 2097152,
9127    "enable_recv_pipe": false,
9128    "enable_quick_ack": false,
9129    "enable_placement_id": 0,
9130    "enable_zerocopy_send_server": true,
9131    "enable_zerocopy_send_client": false
9132  }
9133}
9134~~~
9135
9136Example response:
9137
9138~~~json
9139{
9140  "jsonrpc": "2.0",
9141  "id": 1,
9142  "result": true
9143}
9144~~~
9145
9146### sock_set_default_impl {#rpc_sock_set_default_impl}
9147
9148Set the default sock implementation.
9149
9150#### Parameters
9151
9152Name                    | Optional | Type        | Description
9153----------------------- | -------- | ----------- | -----------
9154impl_name               | Required | string      | Name of socket implementation, e.g. posix
9155
9156#### Response
9157
9158True if the default socket layer configuration was set successfully.
9159
9160#### Example
9161
9162Example request:
9163
9164~~~json
9165{
9166  "jsonrpc": "2.0",
9167  "method": "sock_set_default_impl",
9168  "id": 1,
9169  "params": {
9170    "impl_name": "posix"
9171  }
9172}
9173~~~
9174
9175Example response:
9176
9177~~~json
9178{
9179  "jsonrpc": "2.0",
9180  "id": 1,
9181  "result": true
9182}
9183~~~
9184
9185## Miscellaneous RPC commands
9186
9187### bdev_nvme_send_cmd {#rpc_bdev_nvme_send_cmd}
9188
9189Send NVMe command directly to NVMe controller or namespace. Parameters and responses encoded by base64 urlsafe need further processing.
9190
9191Notice: bdev_nvme_send_cmd requires user to guarentee the correctness of NVMe command itself, and also optional parameters.
9192Illegal command contents or mismatching buffer size may result in unpredictable behavior.
9193
9194#### Parameters
9195
9196Name                    | Optional | Type        | Description
9197----------------------- | -------- | ----------- | -----------
9198name                    | Required | string      | Name of the operating NVMe controller
9199cmd_type                | Required | string      | Type of nvme cmd. Valid values are: admin, io
9200data_direction          | Required | string      | Direction of data transfer. Valid values are: c2h, h2c
9201cmdbuf                  | Required | string      | NVMe command encoded by base64 urlsafe
9202data                    | Optional | string      | Data transferring to controller from host, encoded by base64 urlsafe
9203metadata                | Optional | string      | Metadata transferring to controller from host, encoded by base64 urlsafe
9204data_len                | Optional | number      | Data length required to transfer from controller to host
9205metadata_len            | Optional | number      | Metadata length required to transfer from controller to host
9206timeout_ms              | Optional | number      | Command execution timeout value, in milliseconds
9207
9208#### Response
9209
9210Name                    | Type        | Description
9211----------------------- | ----------- | -----------
9212cpl                     | string      | NVMe completion queue entry, encoded by base64 urlsafe
9213data                    | string      | Data transferred from controller to host, encoded by base64 urlsafe
9214metadata                | string      | Metadata transferred from controller to host, encoded by base64 urlsafe
9215
9216#### Example
9217
9218Example request:
9219
9220~~~json
9221{
9222  "jsonrpc": "2.0",
9223  "method": "bdev_nvme_send_cmd",
9224  "id": 1,
9225  "params": {
9226    "name": "Nvme0",
9227    "cmd_type": "admin"
9228    "data_direction": "c2h",
9229    "cmdbuf": "BgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAsGUs9P5_AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
9230    "data_len": 60,
9231  }
9232}
9233~~~
9234
9235Example response:
9236
9237~~~json
9238{
9239  "jsonrpc": "2.0",
9240  "id": 1,
9241  "result":  {
9242    "cpl": "AAAAAAAAAAARAAAAWrmwABAA==",
9243    "data": "sIjg6AAAAACwiODoAAAAALCI4OgAAAAAAAYAAREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
9244  }
9245
9246}
9247~~~
9248
9249### enable_vmd {#rpc_enable_vmd}
9250
9251Enable VMD enumeration.
9252
9253#### Parameters
9254
9255This method has no parameters.
9256
9257#### Response
9258
9259Completion status of enumeration is returned as a boolean.
9260
9261### Example
9262
9263Example request:
9264
9265~~~json
9266{
9267  "jsonrpc": "2.0",
9268  "method": "enable_vmd",
9269  "id": 1
9270}
9271~~~
9272
9273Example response:
9274
9275~~~json
9276{
9277  "jsonrpc": "2.0",
9278  "id": 1,
9279  "result": true
9280}
9281~~~
9282
9283### spdk_get_version {#rpc_spdk_get_version}
9284
9285Get the version info of the running SPDK application.
9286
9287#### Parameters
9288
9289This method has no parameters.
9290
9291#### Response
9292
9293The response is the version number including major version number, minor version number, patch level number and suffix string.
9294
9295#### Example
9296
9297Example request:
9298~~
9299{
9300  "jsonrpc": "2.0",
9301  "id": 1,
9302  "method": "spdk_get_version"
9303}
9304~~
9305
9306Example response:
9307~~
9308{
9309  "jsonrpc": "2.0",
9310  "id": 1,
9311  "result":  {
9312    "version": "19.04-pre",
9313    "fields" : {
9314      "major": 19,
9315      "minor": 4,
9316      "patch": 0,
9317      "suffix": "-pre"
9318    }
9319  }
9320}
9321~~
9322
9323### framework_get_pci_devices
9324
9325List PCIe devices attached to an SPDK application and the contents of their config space.
9326
9327#### Parameters
9328
9329This method has no parameters.
9330
9331#### Response
9332
9333The response is an array of attached PCIe devices.
9334
9335#### Example
9336
9337Example request:
9338~~
9339{
9340  "jsonrpc": "2.0",
9341  "id": 1,
9342  "method": "framework_get_pci_devices"
9343}
9344~~
9345
9346Example response:
9347Note that the config space buffer was trimmed.
9348~~
9349{
9350  "jsonrpc": "2.0",
9351  "id": 1,
9352  "result": {
9353    [
9354      {
9355        "address": "0000:00:04.0",
9356        "config_space": "8680455807051000...0000000000000000"
9357      },
9358      {
9359        "address": "0000:00:03.0",
9360        "config_space": "8680455807051000...0000000000000000"
9361      }
9362    ]
9363  }
9364}
9365~~
9366
9367### bdev_nvme_add_error_injection {#rpc_bdev_nvme_add_error_injection}
9368
9369Add a NVMe command error injection for a bdev nvme controller.
9370
9371#### Parameters
9372
9373Name                    | Optional | Type        | Description
9374----------------------- | -------- | ----------- | -----------
9375name                    | Required | string      | Name of the operating NVMe controller
9376cmd_type                | Required | string      | Type of NVMe command. Valid values are: admin, io
9377opc                     | Required | number      | Opcode for which the error injection is applied
9378do_not_submit           | Optional | boolean     | Set to true if request should not be submitted to the controller (default false)
9379timeout_in_us           | Optional | number      | Wait specified microseconds when do_not_submit is true
9380err_count               | Optional | number      | Number of matching NVMe commands to inject errors
9381sct                     | Optional | number      | Status code type (default 0)
9382sc                      | Optional | number      | Status code (default 0)
9383
9384#### Response
9385
9386true on success
9387
9388#### Example
9389
9390Example request:
9391
9392~~~json
9393{
9394  "jsonrpc": "2.0",
9395  "method": "bdev_nvme_add_error_injection",
9396  "id": 1,
9397  "params": {
9398    "name": "HotInNvme0",
9399    "opc": 2,
9400    "cmd_type": "io",
9401    "err_count": 1111111,
9402    "sct": 11,
9403    "sc": 33
9404  }
9405}
9406
9407~~~
9408
9409Example response:
9410
9411~~~json
9412{
9413  "jsonrpc": "2.0",
9414  "id": 1,
9415  "result": true
9416}
9417
9418~~~
9419
9420### bdev_nvme_remove_error_injection {#rpc_bdev_nvme_remove_error_injection}
9421
9422Remove a NVMe command error injection.
9423
9424#### Parameters
9425
9426Name                    | Optional | Type        | Description
9427----------------------- | -------- | ----------- | -----------
9428name                    | Required | string      | Name of the operating NVMe controller
9429cmd_type                | Required | string      | Type of NVMe command. Valid values are: admin, io
9430opc                     | Required | number      | Opcode for which the error injection is applied
9431
9432#### Response
9433
9434true on success
9435
9436#### Example
9437
9438Example request:
9439
9440~~~json
9441{
9442  "jsonrpc": "2.0",
9443  "method": "bdev_nvme_remove_error_injection",
9444  "id": 1,
9445  "params": {
9446    "name": "HotInNvme0",
9447    "opc": 2,
9448    "cmd_type": "io"
9449  }
9450}
9451
9452
9453~~~
9454
9455Example response:
9456
9457~~~json
9458{
9459  "jsonrpc": "2.0",
9460  "id": 1,
9461  "result": true
9462}
9463
9464~~~
9465