xref: /spdk/doc/jsonrpc.md (revision ceefb46358f845d6c4e9f9e18d02ec20a7098ff7)
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 spdk.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    "accel_set_options",
445    "accel_set_driver",
446    "accel_crypto_key_create",
447    "accel_crypto_key_destroy",
448    "accel_crypto_keys_get",
449    "accel_assign_opc",
450    "accel_get_module_info",
451    "accel_get_opc_assignments",
452    "ioat_scan_accel_module",
453    "dsa_scan_accel_module",
454    "dpdk_cryptodev_scan_accel_module",
455    "dpdk_cryptodev_set_driver",
456    "dpdk_cryptodev_get_driver",
457    "mlx5_scan_accel_module",
458    "bdev_virtio_attach_controller",
459    "bdev_virtio_scsi_get_devices",
460    "bdev_virtio_detach_controller",
461    "bdev_virtio_blk_set_hotplug",
462    "bdev_aio_delete",
463    "bdev_aio_create",
464    "bdev_split_delete",
465    "bdev_split_create",
466    "bdev_error_inject_error",
467    "bdev_error_delete",
468    "bdev_error_create",
469    "bdev_passthru_create",
470    "bdev_passthru_delete"
471    "bdev_nvme_apply_firmware",
472    "bdev_nvme_get_transport_statistics",
473    "bdev_nvme_get_controller_health_info",
474    "bdev_nvme_detach_controller",
475    "bdev_nvme_attach_controller",
476    "bdev_null_create",
477    "bdev_malloc_delete",
478    "bdev_malloc_create",
479    "bdev_ftl_delete",
480    "bdev_ftl_unload",
481    "bdev_ftl_create",
482    "bdev_ftl_load",
483    "bdev_ftl_unmap",
484    "bdev_ftl_get_stats",
485    "bdev_lvol_get_lvstores",
486    "bdev_lvol_delete",
487    "bdev_lvol_resize",
488    "bdev_lvol_set_read_only",
489    "bdev_lvol_decouple_parent",
490    "bdev_lvol_inflate",
491    "bdev_lvol_rename",
492    "bdev_lvol_clone",
493    "bdev_lvol_snapshot",
494    "bdev_lvol_create",
495    "bdev_lvol_delete_lvstore",
496    "bdev_lvol_rename_lvstore",
497    "bdev_lvol_create_lvstore",
498    "bdev_daos_delete",
499    "bdev_daos_create",
500    "bdev_daos_resize"
501  ]
502}
503~~~
504
505### framework_get_subsystems {#rpc_framework_get_subsystems}
506
507Get an array of name and dependency relationship of SPDK subsystems in initialization order.
508
509#### Parameters
510
511None
512
513#### Response
514
515The response is an array of name and dependency relationship of SPDK subsystems in initialization order.
516
517#### Example
518
519Example request:
520
521~~~json
522{
523  "jsonrpc": "2.0",
524  "id": 1,
525  "method": "framework_get_subsystems"
526}
527~~~
528
529Example response:
530
531~~~json
532{
533  "jsonrpc": "2.0",
534  "id": 1,
535  "result": [
536    {
537      "subsystem": "accel",
538      "depends_on": []
539    },
540    {
541      "subsystem": "interface",
542      "depends_on": []
543    },
544    {
545      "subsystem": "net_framework",
546      "depends_on": [
547        "interface"
548      ]
549    },
550    {
551      "subsystem": "bdev",
552      "depends_on": [
553        "accel"
554      ]
555    },
556    {
557      "subsystem": "nbd",
558      "depends_on": [
559        "bdev"
560      ]
561    },
562    {
563      "subsystem": "nvmf",
564      "depends_on": [
565        "bdev"
566      ]
567    },
568    {
569      "subsystem": "scsi",
570      "depends_on": [
571        "bdev"
572      ]
573    },
574    {
575      "subsystem": "vhost",
576      "depends_on": [
577        "scsi"
578      ]
579    },
580    {
581      "subsystem": "iscsi",
582      "depends_on": [
583        "scsi"
584      ]
585    }
586  ]
587}
588~~~
589
590### framework_get_config {#rpc_framework_get_config}
591
592Get current configuration of the specified SPDK framework
593
594#### Parameters
595
596Name                    | Optional | Type        | Description
597----------------------- | -------- | ----------- | -----------
598name                    | Required | string      | SPDK subsystem name
599
600#### Response
601
602The response is current configuration of the specified SPDK subsystem.
603Null is returned if it is not retrievable by the framework_get_config method and empty array is returned if it is empty.
604
605#### Example
606
607Example request:
608
609~~~json
610{
611  "jsonrpc": "2.0",
612  "id": 1,
613  "method": "framework_get_config",
614  "params": {
615    "name": "bdev"
616  }
617}
618~~~
619
620Example response:
621
622~~~json
623{
624  "jsonrpc": "2.0",
625  "id": 1,
626  "result": [
627    {
628      "params": {
629        "base_bdev": "Malloc2",
630        "split_size_mb": 0,
631        "split_count": 2
632      },
633      "method": "bdev_split_create"
634    },
635    {
636      "params": {
637        "trtype": "PCIe",
638        "name": "Nvme1",
639        "traddr": "0000:01:00.0"
640      },
641      "method": "bdev_nvme_attach_controller"
642    },
643    {
644      "params": {
645        "trtype": "PCIe",
646        "name": "Nvme2",
647        "traddr": "0000:03:00.0"
648      },
649      "method": "bdev_nvme_attach_controller"
650    },
651    {
652      "params": {
653        "block_size": 512,
654        "num_blocks": 131072,
655        "name": "Malloc0",
656        "uuid": "913fc008-79a7-447f-b2c4-c73543638c31"
657      },
658      "method": "bdev_malloc_create"
659    },
660    {
661      "params": {
662        "block_size": 512,
663        "num_blocks": 131072,
664        "name": "Malloc1",
665        "uuid": "dd5b8f6e-b67a-4506-b606-7fff5a859920"
666      },
667      "method": "bdev_malloc_create"
668    }
669  ]
670}
671~~~
672
673### framework_get_reactors {#rpc_framework_get_reactors}
674
675Retrieve an array of all reactors.
676
677#### Parameters
678
679This method has no parameters.
680
681#### Response
682
683The response is an array of all reactors.
684
685#### Example
686
687Example request:
688
689~~~json
690{
691  "jsonrpc": "2.0",
692  "method": "framework_get_reactors",
693  "id": 1
694}
695~~~
696
697Example response:
698
699~~~json
700{
701  "jsonrpc": "2.0",
702  "id": 1,
703  "result": {
704    "tick_rate": 2400000000,
705    "reactors": [
706      {
707        "lcore": 0,
708        "busy": 41289723495,
709        "idle": 3624832946,
710        "lw_threads": [
711          {
712            "name": "app_thread",
713            "id", 1,
714            "cpumask": "1",
715            "elapsed": 44910853363
716          }
717        ]
718      }
719    ]
720  }
721}
722~~~
723
724### framework_set_scheduler {#rpc_framework_set_scheduler}
725
726Select thread scheduler that will be activated.
727This feature is considered as experimental.
728
729#### Parameters
730
731Name                    | Optional | Type        | Description
732----------------------- | -------- | ----------- | -----------
733name                    | Required | string      | Name of a scheduler
734period                  | Optional | number      | Scheduler period
735load_limit              | Optional | number      | Thread load limit in % (dynamic only)
736core_limit              | Optional | number      | Load limit on the core to be considered full (dynamic only)
737core_busy               | Optional | number      | Indicates at what load on core scheduler should move threads to a different core (dynamic only)
738
739#### Response
740
741Completion status of the operation is returned as a boolean.
742
743#### Example
744
745Example request:
746
747~~~json
748{
749  "jsonrpc": "2.0",
750  "method": "framework_set_scheduler",
751  "id": 1,
752  "params": {
753    "name": "static",
754    "period": "1000000"
755  }
756}
757~~~
758
759Example response:
760
761~~~json
762{
763  "jsonrpc": "2.0",
764  "id": 1,
765  "result": true
766}
767~~~
768
769### framework_get_scheduler {#rpc_framework_get_scheduler}
770
771Retrieve currently set scheduler name and period, along with current governor name.
772
773#### Parameters
774
775This method has no parameters.
776
777#### Response
778
779Name                    | Description
780------------------------| -----------
781scheduler_name          | Current scheduler name
782scheduler_period        | Currently set scheduler period in microseconds
783governor_name           | Governor name
784
785#### Example
786
787Example request:
788
789~~~json
790{
791  "jsonrpc": "2.0",
792  "method": "framework_set_scheduler",
793  "id": 1,
794}
795~~~
796
797Example response:
798
799~~~json
800{
801  "jsonrpc": "2.0",
802  "id": 1,
803  "result": {
804    "scheduler_name": "static",
805    "scheduler_period": 2800000000,
806    "governor_name": "default"
807  }
808}
809~~~
810
811### framework_enable_cpumask_locks
812
813Enable CPU core lock files to block multiple SPDK applications from running on the same cpumask.
814The CPU core locks are enabled by default, unless user specified `--disable-cpumask-locks` command
815line option when launching SPDK.
816
817This RPC may be called after locks have already been enabled, with no effect and no error response.
818
819#### Parameters
820
821This method has no parameters.
822
823#### Response
824
825true on success
826
827#### Example
828
829Example request:
830
831~~~json
832{
833  "jsonrpc": "2.0",
834  "id": 1,
835  "method": "framework_enable_cpumask_locks"
836}
837~~~
838
839Example response:
840
841~~~json
842{
843  "jsonrpc": "2.0",
844  "id": 1,
845  "result": true
846}
847~~~
848
849### framework_disable_cpumask_locks
850
851Disable CPU core lock files. The locks can also be disabled during startup, when
852user specifies `--disable-cpumask-locks` command line option during SPDK launch.
853
854This RPC may be called after locks have already been disabled, with no effect and no error
855response.
856
857#### Parameters
858
859This method has no parameters.
860
861#### Response
862
863true on success
864
865#### Example
866
867Example request:
868
869~~~json
870{
871  "jsonrpc": "2.0",
872  "id": 1,
873  "method": "framework_disable_cpumask_locks"
874}
875~~~
876
877Example response:
878
879~~~json
880{
881  "jsonrpc": "2.0",
882  "id": 1,
883  "result": true
884}
885~~~
886
887### thread_get_stats {#rpc_thread_get_stats}
888
889Retrieve current statistics of all the threads.
890
891#### Parameters
892
893This method has no parameters.
894
895#### Response
896
897The response is an array of objects containing threads statistics.
898
899#### Example
900
901Example request:
902
903~~~json
904{
905  "jsonrpc": "2.0",
906  "method": "thread_get_stats",
907  "id": 1
908}
909~~~
910
911Example response:
912
913~~~json
914{
915  "jsonrpc": "2.0",
916  "id": 1,
917  "result": {
918    "tick_rate": 2400000000,
919    "threads": [
920      {
921        "name": "app_thread",
922        "id": 1,
923	"cpumask": "1",
924        "busy": 139223208,
925        "idle": 8641080608,
926        "in_interrupt": false,
927        "active_pollers_count": 1,
928        "timed_pollers_count": 2,
929        "paused_pollers_count": 0
930      }
931    ]
932  }
933}
934~~~
935
936### thread_set_cpumask {#rpc_thread_set_cpumask}
937
938Set the cpumask of the thread to the specified value. The thread may be migrated
939to one of the specified CPUs.
940
941#### Parameters
942
943Name                    | Optional | Type        | Description
944----------------------- | -------- | ----------- | -----------
945id                      | Required | string      | Thread ID
946cpumask                 | Required | string      | Cpumask for this thread
947
948#### Response
949
950Completion status of the operation is returned as a boolean.
951
952#### Example
953
954Example request:
955
956~~~json
957{
958  "jsonrpc": "2.0",
959  "method": "thread_set_cpumask",
960  "id": 1,
961  "params": {
962    "id": "1",
963    "cpumask": "1"
964  }
965}
966~~~
967
968Example response:
969
970~~~json
971{
972  "jsonrpc": "2.0",
973  "id": 1,
974  "result": true
975}
976~~~
977
978### trace_enable_tpoint_group {#rpc_trace_enable_tpoint_group}
979
980Enable trace on a specific tpoint group. For example "bdev" for bdev trace group,
981"all" for all trace groups.
982
983#### Parameters
984
985Name                    | Optional | Type        | Description
986----------------------- | -------- | ----------- | -----------
987name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, scsi, iscsi_conn, ftl, all
988
989#### Example
990
991Example request:
992
993~~~json
994{
995  "jsonrpc": "2.0",
996  "method": "trace_enable_tpoint_group",
997  "id": 1,
998  "params": {
999    "name": "bdev"
1000  }
1001}
1002~~~
1003
1004Example response:
1005
1006~~~json
1007{
1008  "jsonrpc": "2.0",
1009  "id": 1,
1010  "result": true
1011}
1012~~~
1013
1014### trace_disable_tpoint_group {#rpc_trace_disable_tpoint_group}
1015
1016Disable trace on a specific tpoint group. For example "bdev" for bdev trace group,
1017"all" for all trace groups.
1018
1019#### Parameters
1020
1021Name                    | Optional | Type        | Description
1022----------------------- | -------- | ----------- | -----------
1023name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, all
1024
1025#### Example
1026
1027Example request:
1028
1029~~~json
1030{
1031  "jsonrpc": "2.0",
1032  "method": "trace_disable_tpoint_group",
1033  "id": 1,
1034  "params": {
1035    "name": "bdev"
1036  }
1037}
1038~~~
1039
1040Example response:
1041
1042~~~json
1043{
1044  "jsonrpc": "2.0",
1045  "id": 1,
1046  "result": true
1047}
1048~~~
1049
1050### trace_set_tpoint_mask {#rpc_trace_set_tpoint_mask}
1051
1052Enable tracepoint mask on a specific tpoint group. For example "bdev" for bdev trace group,
1053and 0x1 to enable the first tracepoint inside the group (BDEV_IO_START). This command will not
1054disable already active tracepoints or those not specified in the mask. For a full description
1055of all available trace groups, see
1056[tracepoint documentation](https://spdk.io/doc/nvmf_tgt_tracepoints.html).
1057
1058#### Parameters
1059
1060Name                    | Optional | Type        | Description
1061----------------------- | -------- | ----------- | -----------
1062name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, scsi, iscsi_conn, ftl
1063tpoint_mask             | Required | number      | mask to enable tracepoints inside a group
1064
1065#### Example
1066
1067Example request:
1068
1069~~~json
1070{
1071  "jsonrpc": "2.0",
1072  "method": "trace_set_tpoint_mask",
1073  "id": 1,
1074  "params": {
1075    "name": "bdev",
1076    "tpoint_mask": 0x1
1077  }
1078}
1079~~~
1080
1081Example response:
1082
1083~~~json
1084{
1085  "jsonrpc": "2.0",
1086  "id": 1,
1087  "result": true
1088}
1089~~~
1090
1091### trace_clear_tpoint_mask {#rpc_trace_clear_tpoint_mask}
1092
1093Disable tracepoint mask on a specific tpoint group. For example "bdev" for bdev trace group,
1094and 0x1 to disable the first tracepoint inside the group (BDEV_IO_START). For a full description
1095of all available trace groups, see
1096[tracepoint documentation](https://spdk.io/doc/nvmf_tgt_tracepoints.html).
1097
1098#### Parameters
1099
1100Name                    | Optional | Type        | Description
1101----------------------- | -------- | ----------- | -----------
1102name                    | Required | string      | bdev, nvmf_rdma, nvmf_tcp, blobfs, scsi, iscsi_conn, ftl
1103tpoint_mask             | Required | number      | mask to diesable tracepoints inside a group
1104
1105#### Example
1106
1107Example request:
1108
1109~~~json
1110{
1111  "jsonrpc": "2.0",
1112  "method": "trace_clear_tpoint_mask",
1113  "id": 1,
1114  "params": {
1115    "name": "bdev",
1116    "tpoint_mask": 0x1
1117  }
1118}
1119~~~
1120
1121Example response:
1122
1123~~~json
1124{
1125  "jsonrpc": "2.0",
1126  "id": 1,
1127  "result": true
1128}
1129~~~
1130
1131### trace_get_tpoint_group_mask {#rpc_trace_get_tpoint_group_mask}
1132
1133Display mask info for every group.
1134
1135#### Parameters
1136
1137No parameters required
1138
1139#### Example
1140
1141Example request:
1142
1143~~~json
1144{
1145  "jsonrpc": "2.0",
1146  "method": "trace_get_tpoint_group_mask",
1147  "id": 1
1148}
1149~~~
1150
1151Example response:
1152
1153~~~json
1154{
1155  "jsonrpc": "2.0",
1156  "id": 1,
1157  "result": {
1158    "tpoint_group_mask": "0x0",
1159  "iscsi_conn": {
1160    "enabled": false,
1161    "mask": "0x2"
1162  },
1163  "scsi": {
1164    "enabled": false,
1165    "mask": "0x4"
1166  },
1167  "bdev": {
1168    "enabled": false,
1169    "mask": "0x8"
1170  },
1171  "nvmf_tcp": {
1172    "enabled": false,
1173    "mask": "0x20"
1174  },
1175  "ftl": {
1176    "enabled": false,
1177    "mask": "0x40"
1178  },
1179  "blobfs": {
1180    "enabled": false,
1181    "mask": "0x80"
1182    }
1183  }
1184}
1185~~~
1186
1187### trace_get_info {#rpc_trace_get_info}
1188
1189Get name of shared memory file, list of the available trace point groups
1190and mask of the available trace points for each group
1191
1192#### Parameters
1193
1194No parameters required
1195
1196#### Example
1197
1198Example request:
1199
1200~~~json
1201{
1202  "jsonrpc": "2.0",
1203  "method": "trace_get_info",
1204  "id": 1
1205}
1206~~~
1207
1208Example response:
1209
1210~~~json
1211{
1212  "jsonrpc": "2.0",
1213  "id": 1,
1214  "result": {
1215    "tpoint_shm_path": "/dev/shm/spdk_tgt_trace.pid3071944",
1216    "tpoint_group_mask": "0x8",
1217    "iscsi_conn": {
1218      "mask": "0x2",
1219      "tpoint_mask": "0x0"
1220    },
1221    "scsi": {
1222      "mask": "0x4",
1223      "tpoint_mask": "0x0"
1224    },
1225    "bdev": {
1226      "mask": "0x8",
1227      "tpoint_mask": "0xffffffffffffffff"
1228    },
1229    "nvmf_tcp": {
1230      "mask": "0x20",
1231      "tpoint_mask": "0x0"
1232    },
1233    "blobfs": {
1234      "mask": "0x80",
1235      "tpoint_mask": "0x0"
1236    },
1237    "thread": {
1238      "mask": "0x400",
1239      "tpoint_mask": "0x0"
1240    },
1241    "nvme_pcie": {
1242      "mask": "0x800",
1243      "tpoint_mask": "0x0"
1244    },
1245    "nvme_tcp": {
1246      "mask": "0x2000",
1247      "tpoint_mask": "0x0"
1248    },
1249    "bdev_nvme": {
1250      "mask": "0x4000",
1251      "tpoint_mask": "0x0"
1252    }
1253  }
1254}
1255~~~
1256
1257### log_set_print_level {#rpc_log_set_print_level}
1258
1259Set the current level at which output will additionally be
1260sent to the current console.
1261
1262#### Parameters
1263
1264Name                    | Optional | Type        | Description
1265----------------------- | -------- | ----------- | -----------
1266level                   | Required | string      | ERROR, WARNING, NOTICE, INFO, DEBUG
1267
1268#### Example
1269
1270Example request:
1271
1272~~~json
1273{
1274  "jsonrpc": "2.0",
1275  "method": "log_set_print_level",
1276  "id": 1,
1277  "params": {
1278    "level": "ERROR"
1279  }
1280}
1281~~~
1282
1283Example response:
1284
1285~~~json
1286{
1287  "jsonrpc": "2.0",
1288  "id": 1,
1289  "result": true
1290}
1291~~~
1292
1293### log_get_print_level {#rpc_log_get_print_level}
1294
1295Get the current level at which output will additionally be
1296sent to the current console.
1297
1298#### Example
1299
1300Example request:
1301
1302~~~json
1303{
1304  "jsonrpc": "2.0",
1305  "method": "log_get_print_level",
1306  "id": 1,
1307}
1308~~~
1309
1310Example response:
1311
1312~~~json
1313{
1314  "jsonrpc": "2.0",
1315  "id": 1,
1316  "result": "NOTICE"
1317}
1318~~~
1319
1320### log_set_level {#rpc_log_set_level}
1321
1322Set the current logging level output by the `log` module.
1323
1324#### Parameters
1325
1326Name                    | Optional | Type        | Description
1327----------------------- | -------- | ----------- | -----------
1328level                   | Required | string      | ERROR, WARNING, NOTICE, INFO, DEBUG
1329
1330#### Example
1331
1332Example request:
1333
1334~~~json
1335{
1336  "jsonrpc": "2.0",
1337  "method": "log_set_level",
1338  "id": 1,
1339  "params": {
1340    "level": "ERROR"
1341  }
1342}
1343~~~
1344
1345Example response:
1346
1347~~~json
1348{
1349  "jsonrpc": "2.0",
1350  "id": 1,
1351  "result": true
1352}
1353~~~
1354
1355### log_get_level {#rpc_log_get_level}
1356
1357Get the current logging level output by the `log` module.
1358
1359#### Example
1360
1361Example request:
1362
1363~~~json
1364{
1365  "jsonrpc": "2.0",
1366  "method": "log_get_level",
1367  "id": 1,
1368}
1369~~~
1370
1371Example response:
1372
1373~~~json
1374{
1375  "jsonrpc": "2.0",
1376  "id": 1,
1377  "result": "NOTICE"
1378}
1379~~~
1380
1381### log_set_flag {#rpc_log_set_flag}
1382
1383Enable logging for specific portions of the application. The list of possible
1384log flags can be obtained using the `log_get_flags` RPC and may be different
1385for each application.
1386
1387#### Parameters
1388
1389Name                    | Optional | Type        | Description
1390----------------------- | -------- | ----------- | -----------
1391flag                    | Required | string      | A log flag, or 'all'
1392
1393#### Example
1394
1395Example request:
1396
1397~~~json
1398{
1399  "jsonrpc": "2.0",
1400  "method": "log_set_flag",
1401  "id": 1,
1402  "params": {
1403    "flag": "all"
1404  }
1405}
1406~~~
1407
1408Example response:
1409
1410~~~json
1411{
1412  "jsonrpc": "2.0",
1413  "id": 1,
1414  "result": true
1415}
1416~~~
1417
1418### log_clear_flag {#rpc_log_clear_flag}
1419
1420Disable logging for specific portions of the application. The list of possible
1421log flags can be obtained using the `log_get_flags` RPC and may be different
1422for each application.
1423
1424#### Parameters
1425
1426Name                    | Optional | Type        | Description
1427----------------------- | -------- | ----------- | -----------
1428flag                    | Required | string      | A log flag, or 'all'
1429
1430#### Example
1431
1432Example request:
1433
1434~~~json
1435{
1436  "jsonrpc": "2.0",
1437  "method": "log_clear_flag",
1438  "id": 1,
1439  "params": {
1440    "flag": "all"
1441  }
1442}
1443~~~
1444
1445Example response:
1446
1447~~~json
1448{
1449  "jsonrpc": "2.0",
1450  "id": 1,
1451  "result": true
1452}
1453~~~
1454
1455### log_get_flags {#rpc_log_get_flags}
1456
1457Get the list of valid flags for this application and whether
1458they are currently enabled.
1459
1460#### Example
1461
1462Example request:
1463
1464~~~json
1465{
1466  "jsonrpc": "2.0",
1467  "method": "log_get_flags",
1468  "id": 1,
1469}
1470~~~
1471
1472Example response:
1473
1474~~~json
1475{
1476  "jsonrpc": "2.0",
1477  "id": 1,
1478  "result": {
1479    "nvmf": true,
1480    "nvme": true,
1481    "aio": false,
1482    "bdev" false
1483  }
1484}
1485~~~
1486
1487### log_enable_timestamps {#rpc_log_enable_timestamps}
1488
1489Enable or disable timestamps.
1490
1491#### Parameters
1492
1493Name                    | Optional | Type        | Description
1494----------------------- | -------- | ----------- | -----------
1495enabled                 | Required | boolean     | on or off
1496
1497#### Example
1498
1499Example request:
1500
1501~~~json
1502{
1503  "jsonrpc": "2.0",
1504  "method": "log_enable_timestamps",
1505  "id": 1,
1506  "params": {
1507    "enabled": true
1508  }
1509}
1510~~~
1511
1512Example response:
1513
1514~~~json
1515{
1516  "jsonrpc": "2.0",
1517  "id": 1,
1518  "result": true
1519}
1520~~~
1521
1522### thread_get_pollers {#rpc_thread_get_pollers}
1523
1524Retrieve current pollers of all the threads.
1525
1526#### Parameters
1527
1528This method has no parameters.
1529
1530### Response
1531
1532The response is an array of objects containing pollers of all the threads.
1533
1534#### Example
1535
1536Example request:
1537
1538~~~json
1539{
1540  "jsonrpc": "2.0",
1541  "method": "thread_get_pollers",
1542  "id": 1
1543}
1544~~~
1545
1546Example response:
1547
1548~~~json
1549{
1550  "jsonrpc": "2.0",
1551  "id": 1,
1552  "result": {
1553    "tick_rate": 2500000000,
1554    "threads": [
1555      {
1556        "name": "app_thread",
1557        "id": 1,
1558        "active_pollers": [],
1559        "timed_pollers": [
1560          {
1561            "name": "spdk_rpc_subsystem_poll",
1562            "id": 1,
1563            "state": "waiting",
1564            "run_count": 12345,
1565            "busy_count": 10000,
1566            "period_ticks": 10000000
1567          }
1568        ],
1569        "paused_pollers": []
1570      }
1571    ]
1572  }
1573}
1574~~~
1575
1576### thread_get_io_channels {#rpc_thread_get_io_channels}
1577
1578Retrieve current IO channels of all the threads.
1579
1580#### Parameters
1581
1582This method has no parameters.
1583
1584#### Response
1585
1586The response is an array of objects containing IO channels of all the threads.
1587
1588#### Example
1589
1590Example request:
1591
1592~~~json
1593{
1594  "jsonrpc": "2.0",
1595  "method": "thread_get_io_channels",
1596  "id": 1
1597}
1598~~~
1599
1600Example response:
1601
1602~~~json
1603{
1604  "jsonrpc": "2.0",
1605  "id": 1,
1606  "result": {
1607    "tick_rate": 2500000000,
1608    "threads": [
1609      {
1610        "name": "app_thread",
1611        "io_channels": [
1612          {
1613            "name": "nvmf_tgt",
1614            "ref": 1
1615          }
1616        ]
1617      }
1618    ]
1619  }
1620}
1621~~~
1622
1623### env_dpdk_get_mem_stats {#rpc_env_dpdk_get_mem_stats}
1624
1625Write the dpdk memory stats to a file.
1626
1627#### Parameters
1628
1629This method has no parameters.
1630
1631#### Response
1632
1633The response is a pathname to a text file containing the memory stats.
1634
1635#### Example
1636
1637Example request:
1638
1639~~~json
1640{
1641  "jsonrpc": "2.0",
1642  "method": "env_dpdk_get_mem_stats",
1643  "id": 1
1644}
1645~~~
1646
1647Example response:
1648
1649~~~json
1650{
1651  "jsonrpc": "2.0",
1652  "id": 1,
1653  "result": {
1654    "filename": "/tmp/spdk_mem_dump.txt"
1655  }
1656}
1657~~~
1658
1659## Acceleration Framework Layer {#jsonrpc_components_accel_fw}
1660
1661### accel_get_module_info {#accel_get_module_info}
1662
1663Get a list of valid module names and their supported operations.
1664
1665#### Parameters
1666
1667None
1668
1669#### Example
1670
1671Example request:
1672
1673~~~json
1674{
1675  "jsonrpc": "2.0",
1676  "method": "accel_get_module_info",
1677  "id": 1
1678}
1679~~~
1680
1681Example response:
1682
1683~~~json
1684[
1685  {
1686    "module": "software",
1687    "supported ops": [
1688      "copy",
1689      "fill",
1690      "dualcast",
1691      "compare",
1692      "crc32c",
1693      "copy_crc32c",
1694      "compress",
1695      "decompress"
1696    ]
1697  },
1698  {
1699    "module": "dsa",
1700    "supported ops": [
1701      "copy",
1702      "fill",
1703      "dualcast",
1704      "compare",
1705      "crc32c",
1706      "copy_crc32c"
1707    ]
1708  }
1709]
1710~~~
1711
1712### accel_get_opc_assignments {#rpc_accel_get_opc_assignments}
1713
1714Get a list of opcode names and their assigned accel_fw modules.
1715
1716#### Parameters
1717
1718None
1719
1720#### Example
1721
1722Example request:
1723
1724~~~json
1725{
1726  "jsonrpc": "2.0",
1727  "method": "accel_get_opc_assignments",
1728  "id": 1
1729}
1730~~~
1731
1732Example response:
1733
1734~~~json
1735{
1736  "jsonrpc": "2.0",
1737  "id": 1,
1738  "result": [
1739    {
1740      "copy": "software",
1741      "fill": "software",
1742      "dualcast": "software",
1743      "compare": "software",
1744      "crc32c": "software",
1745      "copy_crc32c": "software",
1746      "compress": "software",
1747      "decompress": "software"
1748    }
1749  ]
1750}
1751~~~
1752
1753### accel_assign_opc {#rpc_accel_assign_opc}
1754
1755Manually assign an operation to a module.
1756
1757#### Parameters
1758
1759Name                    | Optional | Type        | Description
1760----------------------- | -------- | ----------- | -----------------
1761opname                  | Required | string      | name of operation
1762module                  | Required | string      | name of module
1763
1764#### Example
1765
1766Example request:
1767
1768~~~json
1769{
1770  "jsonrpc": "2.0",
1771  "method": "accel_assign_opc",
1772  "id": 1,
1773  "params": {
1774    "opname": "copy",
1775    "module": "software"
1776  }
1777}
1778~~~
1779
1780Example response:
1781
1782~~~json
1783{
1784  "jsonrpc": "2.0",
1785  "id": 1,
1786  "result": true
1787}
1788~~~
1789
1790### accel_crypto_key_create {#rpc_accel_crypto_key_create}
1791
1792Create a crypto key which will be used in accel framework
1793
1794#### Parameters
1795
1796Name       | Optional | Type        | Description
1797-----------|----------| ----------- | -----------------
1798cipher     | Required | string      | crypto cipher to use
1799key        | Required | string      | Key in **hex** form
1800key2       | Optional | string      | Optional 2nd part of the key or a tweak in **hex** form
1801name       | Required | string      | The key name
1802
1803#### Example
1804
1805Example request:
1806
1807~~~json
1808{
1809  "jsonrpc": "2.0",
1810  "method": "accel_crypto_key_create",
1811  "id": 1,
1812  "params": {
1813    "cipher": "AES_XTS",
1814    "key": "00112233445566778899001122334455",
1815    "key2": "00112233445566778899001122334455",
1816    "name": "super_key"
1817  }
1818}
1819~~~
1820
1821Example response:
1822
1823~~~json
1824{
1825  "jsonrpc": "2.0",
1826  "id": 1,
1827  "result": true
1828}
1829~~~
1830
1831### accel_crypto_key_destroy {#rpc_accel_crypto_key_destroy}
1832
1833Destroy a crypto key. The user is responsible for ensuring that the deleted key is not used by acceleration modules.
1834
1835#### Parameters
1836
1837Name       | Optional | Type        | Description
1838-----------|----------| ----------- | -----------------
1839name       | Required | string      | The key name
1840
1841#### Example
1842
1843Example request:
1844
1845~~~json
1846{
1847  "jsonrpc": "2.0",
1848  "method": "accel_crypto_key_destroy",
1849  "id": 1,
1850  "params": {
1851    "name": "super_key"
1852  }
1853}
1854~~~
1855
1856Example response:
1857
1858~~~json
1859{
1860  "jsonrpc": "2.0",
1861  "id": 1,
1862  "result": true
1863}
1864~~~
1865
1866### accel_crypto_keys_get {#rpc_accel_crypto_keys_get}
1867
1868Get information about existing crypto keys
1869
1870#### Parameters
1871
1872Name                    | Optional | Type        | Description
1873----------------------- |----------| ----------- | -----------------
1874key_name                | Optional | string      | If specified, return info about a specific key
1875
1876#### Example
1877
1878Example request:
1879
1880~~~json
1881{
1882  "jsonrpc": "2.0",
1883  "method": "accel_crypto_keys_get",
1884  "id": 1
1885}
1886~~~
1887
1888Example response:
1889
1890~~~json
1891{
1892  "jsonrpc": "2.0",
1893  "id": 1,
1894  "result": [
1895    {
1896      "name": "test_dek",
1897      "cipher": "AES_XTS",
1898      "key": "00112233445566778899001122334455",
1899      "key2": "11223344556677889900112233445500"
1900    },
1901    {
1902      "name": "test_dek2",
1903      "cipher": "AES_XTS",
1904      "key": "11223344556677889900112233445500",
1905      "key2": "22334455667788990011223344550011"
1906    }
1907  ]
1908}
1909~~~
1910
1911### accel_set_driver {#rpc_accel_set_driver}
1912
1913Select platform driver to execute operation chains.  Until a driver is selected, all operations are
1914executed through accel modules.
1915
1916#### Parameters
1917
1918Name                    | Optional | Type        | Description
1919----------------------- |----------| ----------- | -----------------
1920name                    | Required | string      | Name of the platform driver
1921
1922#### Example
1923
1924Example request:
1925
1926~~~json
1927{
1928  "jsonrpc": "2.0",
1929  "method": "accel_set_driver",
1930  "id": 1
1931  "params": {
1932    "name": "xeon"
1933  }
1934}
1935~~~
1936
1937Example response:
1938
1939~~~json
1940{
1941  "jsonrpc": "2.0",
1942  "id": 1,
1943  "result": true
1944}
1945~~~
1946
1947### accel_set_options {#rpc_accel_set_options}
1948
1949Set accel framework's options.
1950
1951#### Parameters
1952
1953Name                    | Optional | Type        | Description
1954----------------------- |----------| ----------- | -----------------
1955small_cache_size        | Optional | number      | Size of the small iobuf cache
1956large_cache_size        | Optional | number      | Size of the large iobuf cache
1957task_count              | Optional | number      | Maximum number of tasks per IO channel
1958sequence_count          | Optional | number      | Maximum number of sequences per IO channel
1959buf_count               | Optional | number      | Maximum number of accel buffers per IO channel
1960
1961#### Example
1962
1963Example request:
1964
1965~~~json
1966{
1967  "jsonrpc": "2.0",
1968  "method": "accel_set_options",
1969  "id": 1,
1970  "params": {
1971    "small_cache_size": 128,
1972    "large_cache_size": 32
1973  }
1974}
1975~~~
1976
1977Example response:
1978
1979~~~json
1980{
1981  "jsonrpc": "2.0",
1982  "id": 1,
1983  "result": true
1984}
1985~~~
1986
1987### accel_get_stats {#rpc_accel_get_stats}
1988
1989Retrieve accel framework's statistics.  Statistics for opcodes that have never been executed (i.e.
1990all their stats are at 0) aren't included in the `operations` array.
1991
1992#### Parameters
1993
1994None.
1995
1996#### Example
1997
1998Example request:
1999
2000~~~json
2001{
2002  "jsonrpc": "2.0",
2003  "method": "accel_get_stats",
2004  "id": 1
2005}
2006~~~
2007
2008Example response:
2009
2010~~~json
2011{
2012  "jsonrpc": "2.0",
2013  "id": 1,
2014  "result": {
2015    "sequence_executed": 256,
2016    "sequence_failed": 0,
2017    "operations": [
2018      {
2019        "opcode": "copy",
2020        "executed": 256,
2021        "failed": 0
2022      },
2023      {
2024        "opcode": "encrypt",
2025        "executed": 128,
2026        "failed": 0
2027      },
2028      {
2029        "opcode": "decrypt",
2030        "executed": 128,
2031        "failed": 0
2032      }
2033    ]
2034  }
2035}
2036~~~
2037
2038### compressdev_scan_accel_module {#rpc_compressdev_scan_accel_module}
2039
2040Set config and enable compressdev accel module offload.
2041Select the DPDK polled mode driver (pmd) for the accel compress module,
20420 = auto-select, 1= QAT only, 2 = mlx5_pci only.
2043
2044#### Parameters
2045
2046Name                    | Optional | Type        | Description
2047----------------------- | -------- | ----------- | -----------
2048pmd                     | Required | int         | pmd selection
2049
2050#### Example
2051
2052Example request:
2053
2054~~~json
2055{
2056  "params": {
2057    "pmd": 1
2058  },
2059  "jsonrpc": "2.0",
2060  "method": "compressdev_scan_accel_module",
2061  "id": 1
2062}
2063~~~
2064
2065Example response:
2066
2067~~~json
2068{
2069  "jsonrpc": "2.0",
2070  "id": 1,
2071  "result": true
2072}
2073~~~
2074
2075### dsa_scan_accel_module {#rpc_dsa_scan_accel_module}
2076
2077Set config and enable dsa accel module offload.
2078This feature is considered as experimental.
2079
2080#### Parameters
2081
2082Name                    | Optional | Type        | Description
2083----------------------- | -------- | ----------- | -----------
2084config_kernel_mode      | Optional | Boolean     | If set, will use kernel idxd driver.
2085
2086#### Example
2087
2088Example request:
2089
2090~~~json
2091{
2092  "params": {
2093    "config_kernel_mode": false
2094  },
2095  "jsonrpc": "2.0",
2096  "method": "dsa_scan_accel_module",
2097  "id": 1
2098}
2099~~~
2100
2101Example response:
2102
2103~~~json
2104{
2105  "jsonrpc": "2.0",
2106  "id": 1,
2107  "result": true
2108}
2109~~~
2110
2111### iaa_scan_accel_module {#rpc_iaa_scan_accel_module}
2112
2113Enable IAA accel module offload.
2114This feature is considered as experimental.
2115
2116#### Parameters
2117
2118None
2119
2120#### Example
2121
2122Example request:
2123
2124~~~json
2125{
2126  "jsonrpc": "2.0",
2127  "method": "iaa_scan_accel_module",
2128  "id": 1
2129}
2130~~~
2131
2132Example response:
2133
2134~~~json
2135{
2136  "jsonrpc": "2.0",
2137  "id": 1,
2138  "result": true
2139}
2140~~~
2141
2142### ioat_scan_accel_module {#rpc_ioat_scan_accel_module}
2143
2144Enable ioat accel module offload.
2145
2146#### Parameters
2147
2148None
2149
2150#### Example
2151
2152Example request:
2153
2154~~~json
2155{
2156  "jsonrpc": "2.0",
2157  "method": "ioat_scan_accel_module",
2158  "id": 1
2159}
2160~~~
2161
2162Example response:
2163
2164~~~json
2165{
2166  "jsonrpc": "2.0",
2167  "id": 1,
2168  "result": true
2169}
2170~~~
2171
2172### dpdk_cryptodev_scan_accel_module {#rpc_dpdk_cryptodev_scan_accel_module}
2173
2174Enable dpdk_cryptodev accel offload
2175
2176#### Parameters
2177
2178None
2179
2180#### Example
2181
2182Example request:
2183
2184~~~json
2185{
2186  "jsonrpc": "2.0",
2187  "method": "dpdk_cryptodev_scan_accel_module",
2188  "id": 1
2189}
2190~~~
2191
2192Example response:
2193
2194~~~json
2195{
2196  "jsonrpc": "2.0",
2197  "id": 1,
2198  "result": true
2199}
2200~~~
2201
2202### dpdk_cryptodev_set_driver {#rpc_dpdk_cryptodev_set_driver}
2203
2204Set the DPDK cryptodev driver
2205
2206#### Parameters
2207
2208Name                    | Optional | Type   | Description
2209----------------------- |----------|--------| -----------
2210crypto_pmd              | Required | string | The driver, can be one of crypto_aesni_mb, crypto_qat or mlx5_pci
2211
2212#### Example
2213
2214Example request:
2215
2216~~~json
2217{
2218  "jsonrpc": "2.0",
2219  "method": "dpdk_cryptodev_set_driver",
2220  "id": 1,
2221  "params": {
2222    "crypto_pmd": "crypto_aesni_mb"
2223  }
2224}
2225~~~
2226
2227Example response:
2228
2229~~~json
2230{
2231  "jsonrpc": "2.0",
2232  "id": 1,
2233  "result": true
2234}
2235~~~
2236
2237### dpdk_cryptodev_get_driver {#rpc_dpdk_cryptodev_get_driver}
2238
2239Get the DPDK cryptodev driver
2240
2241#### Parameters
2242
2243None
2244
2245#### Example
2246
2247Example request:
2248
2249~~~json
2250{
2251  "jsonrpc": "2.0",
2252  "method": "dpdk_cryptodev_get_driver",
2253  "id": 1
2254}
2255~~~
2256
2257Example response:
2258
2259~~~json
2260{
2261  "jsonrpc": "2.0",
2262  "id": 1,
2263  "result": "crypto_aesni_mb"
2264}
2265~~~
2266
2267### mlx5_scan_accel_module {#rpc_mlx5_scan_accel_module}
2268
2269Enable mlx5 accel offload
2270
2271#### Parameters
2272
2273Name                    | Optional | Type   | Description
2274----------------------- | -------- |--------| -----------
2275qp_size                 | Optional | number | qpair size
2276num_requests            | Optional | number | Size of the shared requests pool
2277
2278#### Example
2279
2280Example request:
2281
2282~~~json
2283{
2284  "jsonrpc": "2.0",
2285  "method": "mlx5_scan_accel_module",
2286  "id": 1,
2287  "params": {
2288    "qp_size": 256,
2289    "num_requests": 2047
2290  }
2291}
2292~~~
2293
2294Example response:
2295
2296~~~json
2297{
2298  "jsonrpc": "2.0",
2299  "id": 1,
2300  "result": true
2301}
2302~~~
2303
2304## Block Device Abstraction Layer {#jsonrpc_components_bdev}
2305
2306### bdev_set_options {#rpc_bdev_set_options}
2307
2308Set global parameters for the block device (bdev) subsystem.  This RPC may only be called
2309before SPDK subsystems have been initialized.
2310
2311#### Parameters
2312
2313Name                    | Optional | Type        | Description
2314----------------------- | -------- | ----------- | -----------
2315bdev_io_pool_size       | Optional | number      | Number of spdk_bdev_io structures in shared buffer pool
2316bdev_io_cache_size      | Optional | number      | Maximum number of spdk_bdev_io structures cached per thread
2317bdev_auto_examine       | Optional | boolean     | If set to false, the bdev layer will not examine every disks automatically
2318
2319#### Example
2320
2321Example request:
2322
2323~~~json
2324{
2325  "jsonrpc": "2.0",
2326  "id": 1,
2327  "method": "bdev_set_options",
2328  "params": {
2329    "bdev_io_pool_size": 65536,
2330    "bdev_io_cache_size": 256
2331  }
2332}
2333~~~
2334
2335Example response:
2336
2337~~~json
2338{
2339  "jsonrpc": "2.0",
2340  "id": 1,
2341  "result": true
2342}
2343~~~
2344
2345### bdev_get_bdevs {#rpc_bdev_get_bdevs}
2346
2347Get information about block devices (bdevs).
2348
2349#### Parameters
2350
2351The user may specify no parameters in order to list all block devices, or a block device may be
2352specified by name.  If a timeout is specified, the method will block until a bdev with a specified
2353name appears or the timeout expires.  By default, the timeout is zero, meaning the method returns
2354immediately whether the bdev exists or not.
2355
2356Name                    | Optional | Type        | Description
2357----------------------- | -------- | ----------- | -----------
2358name                    | Optional | string      | Block device name
2359timeout                 | Optional | number      | Time (ms) to wait for a bdev with specified name to appear
2360
2361#### Response
2362
2363The response is an array of objects containing information about the requested block devices.
2364
2365#### Example
2366
2367Example request:
2368
2369~~~json
2370{
2371  "jsonrpc": "2.0",
2372  "id": 1,
2373  "method": "bdev_get_bdevs",
2374  "params": {
2375    "name": "Malloc0"
2376  }
2377}
2378~~~
2379
2380Example response:
2381
2382~~~json
2383{
2384  "jsonrpc": "2.0",
2385  "id": 1,
2386  "result": [
2387    {
2388      "name": "Malloc0",
2389      "product_name": "Malloc disk",
2390      "block_size": 512,
2391      "num_blocks": 20480,
2392      "claimed": false,
2393      "zoned": false,
2394      "supported_io_types": {
2395        "read": true,
2396        "write": true,
2397        "unmap": true,
2398        "write_zeroes": true,
2399        "flush": true,
2400        "reset": true,
2401        "nvme_admin": false,
2402        "nvme_io": false
2403      },
2404      "driver_specific": {}
2405    }
2406  ]
2407}
2408~~~
2409
2410### bdev_examine {#rpc_bdev_examine}
2411
2412Request that the bdev layer examines the given bdev for metadata and creates
2413new bdevs if metadata is found. This is only necessary if `auto_examine` has
2414been set to false using `bdev_set_options`. By default, `auto_examine` is true
2415and bdev examination is automatic.
2416
2417#### Parameters
2418
2419Name                    | Optional | Type        | Description
2420----------------------- | -------- | ----------- | -----------
2421name                    | Required | string      | Block device name
2422
2423#### Response
2424
2425The response is an array of objects containing I/O statistics of the requested block devices.
2426
2427#### Example
2428
2429Example request:
2430
2431~~~json
2432{
2433  "jsonrpc": "2.0",
2434  "id": 1,
2435  "method": "bdev_examine",
2436  "params": {
2437    "name": "Nvme0n1"
2438  }
2439}
2440~~~
2441
2442Example response:
2443
2444~~~json
2445{
2446  "jsonrpc": "2.0",
2447  "id": 1,
2448  "result": true
2449}
2450~~~
2451
2452### bdev_wait_for_examine {#rpc_bdev_wait_for_examine}
2453
2454Report when all bdevs have been examined by every bdev module.
2455
2456#### Parameters
2457
2458None
2459
2460#### Response
2461
2462The response is sent when all bdev modules had a chance to examine every bdev.
2463
2464#### Example
2465
2466Example request:
2467
2468~~~json
2469{
2470  "jsonrpc": "2.0",
2471  "method": "bdev_wait_for_examine",
2472  "id": 1
2473}
2474~~~
2475
2476Example response:
2477
2478~~~json
2479{
2480  "jsonrpc": "2.0",
2481  "id": 1,
2482  "result": true
2483}
2484~~~
2485
2486### bdev_get_iostat {#rpc_bdev_get_iostat}
2487
2488Get I/O statistics of block devices (bdevs).
2489
2490#### Parameters
2491
2492The user may specify no parameters in order to list all block devices, or a block device may be
2493specified by name.
2494
2495Name                    | Optional | Type        | Description
2496----------------------- | -------- | ----------- | -----------
2497name                    | Optional | string      | Block device name
2498per_channel             | Optional | bool        | Display per channel data for specified block device.
2499
2500#### Response
2501
2502The response is an array of objects containing I/O statistics of the requested block devices.
2503
2504#### Example
2505
2506Example request:
2507
2508~~~json
2509{
2510  "jsonrpc": "2.0",
2511  "id": 1,
2512  "method": "bdev_get_iostat",
2513  "params": {
2514    "name": "Nvme0n1",
2515    "per_channel": false
2516  }
2517}
2518~~~
2519
2520Example response:
2521
2522~~~json
2523{
2524  "jsonrpc": "2.0",
2525  "id": 1,
2526  "result": {
2527    "tick_rate": 2200000000,
2528    "bdevs" : [
2529      {
2530        "name": "Nvme0n1",
2531        "bytes_read": 36864,
2532        "num_read_ops": 2,
2533        "bytes_written": 0,
2534        "num_write_ops": 0,
2535        "bytes_unmapped": 0,
2536        "num_unmap_ops": 0,
2537        "read_latency_ticks": 178904,
2538        "write_latency_ticks": 0,
2539        "unmap_latency_ticks": 0,
2540        "queue_depth_polling_period": 2,
2541        "queue_depth": 0,
2542        "io_time": 0,
2543        "weighted_io_time": 0
2544      }
2545    ]
2546  }
2547}
2548~~~
2549
2550### bdev_reset_iostat {#rpc_bdev_reset_iostat}
2551
2552Reset I/O statistics of block devices (bdevs). Note that if one consumer resets I/O statistics,
2553it affects all other consumers.
2554
2555#### Parameters
2556
2557The user may specify no parameters in order to reset I/O statistics for all block devices, or
2558a block device may be specified by name.
2559
2560Name                    | Optional | Type        | Description
2561----------------------- | -------- | ----------- | -----------
2562name                    | Optional | string      | Block device name
2563mode                    | Optional | string      | Mode to reset I/O statistics: all, maxmin (default: all)
2564
2565#### Example
2566
2567Example request:
2568
2569~~~json
2570{
2571  "jsonrpc": "2.0",
2572  "id": 1,
2573  "method": "bdev_reset_iostat",
2574  "params": {
2575    "name": "Nvme0n1"
2576  }
2577}
2578~~~
2579
2580Example response:
2581
2582~~~json
2583{
2584  "jsonrpc": "2.0",
2585  "id": 1,
2586  "result": true
2587}
2588~~~
2589
2590### bdev_enable_histogram {#rpc_bdev_enable_histogram}
2591
2592Control whether collecting data for histogram is enabled for specified bdev.
2593
2594#### Parameters
2595
2596Name                    | Optional | Type        | Description
2597----------------------- | -------- | ----------- | -----------
2598name                    | Required | string      | Block device name
2599enable                  | Required | boolean     | Enable or disable histogram on specified device
2600
2601#### Example
2602
2603Example request:
2604
2605~~~json
2606{
2607  "jsonrpc": "2.0",
2608  "id": 1,
2609  "method": "bdev_enable_histogram",
2610  "params": {
2611    "name": "Nvme0n1"
2612    "enable": true
2613  }
2614}
2615~~~
2616
2617Example response:
2618
2619~~~json
2620{
2621  "jsonrpc": "2.0",
2622  "id": 1,
2623  "result": true
2624}
2625~~~
2626
2627### bdev_get_histogram {#rpc_bdev_get_histogram}
2628
2629Get latency histogram for specified bdev.
2630
2631#### Parameters
2632
2633Name                    | Optional | Type        | Description
2634----------------------- | -------- | ----------- | -----------
2635name                    | Required | string      | Block device name
2636
2637#### Result
2638
2639Name                    | Description
2640------------------------| -----------
2641histogram               | Base64 encoded histogram
2642bucket_shift            | Granularity of the histogram buckets
2643tsc_rate                | Ticks per second
2644
2645#### Example
2646
2647Example request:
2648
2649~~~json
2650{
2651  "jsonrpc": "2.0",
2652  "id": 1,
2653  "method": "bdev_get_histogram",
2654  "params": {
2655    "name": "Nvme0n1"
2656  }
2657}
2658~~~
2659
2660Example response:
2661Note that histogram field is trimmed, actual encoded histogram length is ~80kb.
2662
2663~~~json
2664{
2665  "jsonrpc": "2.0",
2666  "id": 1,
2667  "result": {
2668    "histogram": "AAAAAAAAAAAAAA...AAAAAAAAA==",
2669    "tsc_rate": 2300000000,
2670    "bucket_shift": 7
2671  }
2672}
2673~~~
2674
2675### bdev_set_qos_limit {#rpc_bdev_set_qos_limit}
2676
2677Set the quality of service rate limit on a bdev.
2678
2679#### Parameters
2680
2681Name                    | Optional | Type        | Description
2682----------------------- | -------- | ----------- | -----------
2683name                    | Required | string      | Block device name
2684rw_ios_per_sec          | Optional | number      | Number of R/W I/Os per second to allow. 0 means unlimited.
2685rw_mbytes_per_sec       | Optional | number      | Number of R/W megabytes per second to allow. 0 means unlimited.
2686r_mbytes_per_sec        | Optional | number      | Number of Read megabytes per second to allow. 0 means unlimited.
2687w_mbytes_per_sec        | Optional | number      | Number of Write megabytes per second to allow. 0 means unlimited.
2688
2689#### Example
2690
2691Example request:
2692
2693~~~json
2694{
2695  "jsonrpc": "2.0",
2696  "id": 1,
2697  "method": "bdev_set_qos_limit",
2698  "params": {
2699    "name": "Malloc0"
2700    "rw_ios_per_sec": 20000
2701    "rw_mbytes_per_sec": 100
2702    "r_mbytes_per_sec": 50
2703    "w_mbytes_per_sec": 50
2704  }
2705}
2706~~~
2707
2708Example response:
2709
2710~~~json
2711{
2712  "jsonrpc": "2.0",
2713  "id": 1,
2714  "result": true
2715}
2716~~~
2717
2718### bdev_set_qd_sampling_period {#rpc_bdev_set_qd_sampling_period}
2719
2720Enable queue depth tracking on a specified bdev.
2721
2722#### Parameters
2723
2724Name                    | Optional | Type        | Description
2725----------------------- | -------- | ----------- | -----------
2726name                    | Required | string      | Block device name
2727period                  | Required | int         | period (in microseconds).If set to 0, polling will be disabled.
2728
2729#### Example
2730
2731Example request:
2732
2733~~~json
2734{
2735  "jsonrpc": "2.0",
2736  "method": "bdev_set_qd_sampling_period",
2737  "id": 1,
2738  "params": {
2739    "name": "Malloc0",
2740    "period": 20
2741  }
2742}
2743~~~
2744
2745Example response:
2746
2747~~~json
2748{
2749  "jsonrpc": "2.0",
2750  "id": 1,
2751  "result": true
2752}
2753~~~
2754
2755### bdev_compress_create {#rpc_bdev_compress_create}
2756
2757Create a new compress bdev on a given base bdev.
2758
2759#### Parameters
2760
2761Name                    | Optional | Type        | Description
2762----------------------- | -------- | ----------- | -----------
2763base_bdev_name          | Required | string      | Name of the base bdev
2764pm_path                 | Required | string      | Path to persistent memory
2765lb_size                 | Optional | int         | Compressed vol logical block size (512 or 4096)
2766
2767#### Result
2768
2769Name of newly created bdev.
2770
2771#### Example
2772
2773Example request:
2774
2775~~~json
2776{
2777  "params": {
2778    "base_bdev_name": "Nvme0n1",
2779    "pm_path": "/pm_files",
2780    "lb_size": 4096
2781  },
2782  "jsonrpc": "2.0",
2783  "method": "bdev_compress_create",
2784  "id": 1
2785}
2786~~~
2787
2788### bdev_compress_delete {#rpc_bdev_compress_delete}
2789
2790Delete a compressed bdev.
2791
2792#### Parameters
2793
2794Name                    | Optional | Type        | Description
2795----------------------- | -------- | ----------- | -----------
2796name                    | Required | string      | Name of the compress bdev
2797
2798#### Example
2799
2800Example request:
2801
2802~~~json
2803{
2804  "params": {
2805    "name": "COMP_Nvme0n1"
2806  },
2807  "jsonrpc": "2.0",
2808  "method": "bdev_compress_delete",
2809  "id": 1
2810}
2811~~~
2812
2813Example response:
2814
2815~~~json
2816{
2817  "jsonrpc": "2.0",
2818  "id": 1,
2819  "result": true
2820}
2821~~~
2822
2823### bdev_compress_get_orphans {#rpc_bdev_compress_get_orphans}
2824
2825Get a list of compressed volumes that are missing their pmem metadata.
2826
2827#### Parameters
2828
2829Name                    | Optional | Type        | Description
2830----------------------- | -------- | ----------- | -----------
2831name                    | Required | string      | Name of the compress bdev
2832
2833#### Example
2834
2835Example request:
2836
2837~~~json
2838{
2839  "params": {
2840    "name": "COMP_Nvme0n1"
2841  },
2842  "jsonrpc": "2.0",
2843  "method": "bdev_compress_get_orphans",
2844  "id": 1
2845}
2846~~~
2847
2848Example response:
2849
2850~~~json
2851{
2852  "jsonrpc": "2.0",
2853  "id": 1,
2854  "name": "COMP_Nvme0n1"
2855}
2856~~~
2857
2858### bdev_crypto_create {#rpc_bdev_crypto_create}
2859
2860Create a new crypto bdev on a given base bdev.
2861
2862#### Parameters
2863
2864Name                    | Optional | Type        | Description
2865----------------------- |----------| ----------- | -----------
2866base_bdev_name          | Required | string      | Name of the base bdev
2867name                    | Required | string      | Name of the crypto vbdev to create
2868crypto_pmd              | Optional | string      | Name of the crypto device driver. Obsolete, see accel_crypto_key_create
2869key                     | Optional | string      | Key in hex form. Obsolete, see accel_crypto_key_create
2870cipher                  | Optional | string      | Cipher to use, AES_CBC or AES_XTS (QAT and MLX5). Obsolete, see accel_crypto_key_create
2871key2                    | Optional | string      | 2nd key in hex form only required for cipher AET_XTS. Obsolete, see accel_crypto_key_create
2872key_name                | Optional | string      | Name of the key created with accel_crypto_key_create
2873module                  | Optional | string      | Name of the accel module which is used to create a key (if no key_name specified)
2874
2875Both key and key2 must be passed in the hexlified form. For example, 256bit AES key may look like this:
2876afd9477abf50254219ccb75965fbe39f23ebead5676e292582a0a67f66b88215
2877
2878#### Result
2879
2880Name of newly created bdev.
2881
2882#### Example
2883
2884Example request:
2885
2886~~~json
2887{
2888  "params": {
2889    "base_bdev_name": "Nvme0n1",
2890    "name": "my_crypto_bdev",
2891    "crypto_pmd": "crypto_aesni_mb",
2892    "key": "12345678901234561234567890123456",
2893    "cipher": "AES_CBC"
2894  },
2895  "jsonrpc": "2.0",
2896  "method": "bdev_crypto_create",
2897  "id": 1
2898}
2899~~~
2900
2901Example response:
2902
2903~~~json
2904{
2905
2906  "jsonrpc": "2.0",
2907  "id": 1,
2908  "result": "my_crypto_bdev"
2909}
2910~~~
2911
2912### bdev_crypto_delete {#rpc_bdev_crypto_delete}
2913
2914Delete a crypto bdev.
2915
2916#### Parameters
2917
2918Name                    | Optional | Type        | Description
2919----------------------- | -------- | ----------- | -----------
2920name                    | Required | string      | Name of the crypto bdev
2921
2922#### Example
2923
2924Example request:
2925
2926~~~json
2927{
2928  "params": {
2929    "name": "my_crypto_bdev"
2930  },
2931  "jsonrpc": "2.0",
2932  "method": "bdev_crypto_delete",
2933  "id": 1
2934}
2935~~~
2936
2937Example response:
2938
2939~~~json
2940{
2941  "jsonrpc": "2.0",
2942  "id": 1,
2943  "result": true
2944}
2945~~~
2946
2947### bdev_ocf_create {#rpc_bdev_ocf_create}
2948
2949Construct new OCF bdev.
2950Command accepts cache mode that is going to be used.
2951You can find more details about supported cache modes in the [OCF documentation](https://open-cas.github.io/cache_configuration.html#cache-mode)
2952
2953#### Parameters
2954
2955Name                    | Optional | Type        | Description
2956----------------------- | -------- | ----------- | -----------
2957name                    | Required | string      | Bdev name to use
2958mode                    | Required | string      | OCF cache mode: wb, wt, pt, wa, wi, wo
2959cache_line_size         | Optional | int         | OCF cache line size in KiB: 4, 8, 16, 32, 64
2960cache_bdev_name         | Required | string      | Name of underlying cache bdev
2961core_bdev_name          | Required | string      | Name of underlying core bdev
2962
2963#### Result
2964
2965Name of newly created bdev.
2966
2967#### Example
2968
2969Example request:
2970
2971~~~json
2972{
2973  "params": {
2974    "name": "ocf0",
2975    "mode": "wt",
2976    "cache_line_size": 64,
2977    "cache_bdev_name": "Nvme0n1",
2978    "core_bdev_name": "aio0"
2979  },
2980  "jsonrpc": "2.0",
2981  "method": "bdev_ocf_create",
2982  "id": 1
2983}
2984~~~
2985
2986Example response:
2987
2988~~~json
2989{
2990  "jsonrpc": "2.0",
2991  "id": 1,
2992  "result": "ocf0"
2993}
2994~~~
2995
2996### bdev_ocf_delete {#rpc_bdev_ocf_delete}
2997
2998Delete the OCF bdev
2999
3000#### Parameters
3001
3002Name                    | Optional | Type        | Description
3003----------------------- | -------- | ----------- | -----------
3004name                    | Required | string      | Bdev name
3005
3006#### Example
3007
3008Example request:
3009
3010~~~json
3011{
3012  "params": {
3013    "name": "ocf0"
3014  },
3015  "jsonrpc": "2.0",
3016  "method": "bdev_ocf_delete",
3017  "id": 1
3018}
3019~~~
3020
3021Example response:
3022
3023~~~json
3024{
3025  "jsonrpc": "2.0",
3026  "id": 1,
3027  "result": true
3028}
3029~~~
3030
3031### bdev_ocf_get_stats {#rpc_bdev_ocf_get_stats}
3032
3033Get statistics of chosen OCF block device.
3034
3035#### Parameters
3036
3037Name                    | Optional | Type        | Description
3038----------------------- | -------- | ----------- | -----------
3039name                    | Required | string      | Block device name
3040
3041#### Response
3042
3043Statistics as json object.
3044
3045#### Example
3046
3047Example request:
3048
3049~~~json
3050{
3051  "params": {
3052    "name": "ocf0"
3053  },
3054  "jsonrpc": "2.0",
3055  "method": "bdev_ocf_get_stats",
3056  "id": 1
3057}
3058~~~
3059
3060Example response:
3061
3062~~~json
3063{
3064  "jsonrpc": "2.0",
3065  "id": 1,
3066  "result": [
3067  "usage": {
3068    "clean": {
3069      "count": 76033,
3070      "units": "4KiB blocks",
3071      "percentage": "100.0"
3072    },
3073    "free": {
3074      "count": 767,
3075      "units": "4KiB blocks",
3076      "percentage": "0.9"
3077    },
3078    "occupancy": {
3079      "count": 76033,
3080      "units": "4KiB blocks",
3081      "percentage": "99.0"
3082    },
3083    "dirty": {
3084      "count": 0,
3085      "units": "4KiB blocks",
3086      "percentage": "0.0"
3087    }
3088  },
3089  "requests": {
3090    "rd_total": {
3091      "count": 2,
3092      "units": "Requests",
3093      "percentage": "0.0"
3094    },
3095    "wr_full_misses": {
3096      "count": 76280,
3097      "units": "Requests",
3098      "percentage": "35.6"
3099    },
3100    "rd_full_misses": {
3101      "count": 1,
3102      "units": "Requests",
3103      "percentage": "0.0"
3104    },
3105    "rd_partial_misses": {
3106      "count": 0,
3107      "units": "Requests",
3108      "percentage": "0.0"
3109    },
3110    "wr_total": {
3111      "count": 212416,
3112      "units": "Requests",
3113      "percentage": "99.2"
3114    },
3115    "wr_pt": {
3116      "count": 1535,
3117      "units": "Requests",
3118      "percentage": "0.7"
3119    },
3120    "wr_partial_misses": {
3121      "count": 0,
3122      "units": "Requests",
3123      "percentage": "0.0"
3124    },
3125    "serviced": {
3126      "count": 212418,
3127      "units": "Requests",
3128      "percentage": "99.2"
3129    },
3130    "rd_pt": {
3131      "count": 0,
3132      "units": "Requests",
3133      "percentage": "0.0"
3134    },
3135    "total": {
3136      "count": 213953,
3137      "units": "Requests",
3138      "percentage": "100.0"
3139    },
3140    "rd_hits": {
3141      "count": 1,
3142      "units": "Requests",
3143      "percentage": "0.0"
3144    },
3145    "wr_hits": {
3146      "count": 136136,
3147      "units": "Requests",
3148      "percentage": "63.6"
3149    }
3150  },
3151  "errors": {
3152    "total": {
3153      "count": 0,
3154      "units": "Requests",
3155      "percentage": "0.0"
3156    },
3157    "cache_obj_total": {
3158      "count": 0,
3159      "units": "Requests",
3160      "percentage": "0.0"
3161    },
3162    "core_obj_total": {
3163      "count": 0,
3164      "units": "Requests",
3165      "percentage": "0.0"
3166    },
3167    "cache_obj_rd": {
3168      "count": 0,
3169      "units": "Requests",
3170      "percentage": "0.0"
3171    },
3172    "core_obj_wr": {
3173      "count": 0,
3174      "units": "Requests",
3175      "percentage": "0.0"
3176    },
3177    "core_obj_rd": {
3178      "count": 0,
3179      "units": "Requests",
3180      "percentage": "0.0"
3181    },
3182    "cache_obj_wr": {
3183      "count": 0,
3184      "units": "Requests",
3185      "percentage": "0.0"
3186    }
3187  },
3188  "blocks": {
3189    "volume_rd": {
3190      "count": 9,
3191      "units": "4KiB blocks",
3192      "percentage": "0.0"
3193    },
3194    "volume_wr": {
3195      "count": 213951,
3196      "units": "4KiB blocks",
3197      "percentage": "99.9"
3198    },
3199    "cache_obj_total": {
3200      "count": 212425,
3201      "units": "4KiB blocks",
3202      "percentage": "100.0"
3203    },
3204    "core_obj_total": {
3205      "count": 213959,
3206      "units": "4KiB blocks",
3207      "percentage": "100.0"
3208    },
3209    "cache_obj_rd": {
3210      "count": 1,
3211      "units": "4KiB blocks",
3212      "percentage": "0.0"
3213    },
3214    "core_obj_wr": {
3215      "count": 213951,
3216      "units": "4KiB blocks",
3217      "percentage": "99.9"
3218    },
3219    "volume_total": {
3220      "count": 213960,
3221      "units": "4KiB blocks",
3222      "percentage": "100.0"
3223    },
3224    "core_obj_rd": {
3225      "count": 8,
3226      "units": "4KiB blocks",
3227      "percentage": "0.0"
3228    },
3229    "cache_obj_wr": {
3230      "count": 212424,
3231      "units": "4KiB blocks",
3232      "percentage": "99.9"
3233    }
3234  ]
3235}
3236~~~
3237
3238### bdev_ocf_reset_stats {#rpc_bdev_ocf_reset_stats}
3239
3240Reset statistics of chosen OCF block device.
3241
3242#### Parameters
3243
3244Name                    | Optional | Type        | Description
3245----------------------- | -------- | ----------- | -----------
3246name                    | Required | string      | Block device name
3247
3248#### Response
3249
3250Completion status of reset statistics operation returned as a boolean.
3251
3252#### Example
3253
3254Example request:
3255
3256~~~json
3257{
3258  "params": {
3259    "name": "ocf0"
3260  },
3261  "jsonrpc": "2.0",
3262  "method": "bdev_ocf_reset_stats",
3263  "id": 1
3264}
3265~~~
3266
3267Example response:
3268
3269~~~json
3270{
3271  "jsonrpc": "2.0",
3272  "id": 1,
3273  "result": true
3274}
3275~~~
3276
3277### bdev_ocf_get_bdevs {#rpc_bdev_ocf_get_bdevs}
3278
3279Get list of OCF devices including unregistered ones.
3280
3281#### Parameters
3282
3283Name                    | Optional | Type        | Description
3284----------------------- | -------- | ----------- | -----------
3285name                    | Optional | string      | Name of OCF vbdev or name of cache device or name of core device
3286
3287#### Response
3288
3289Array of OCF devices with their current status, along with core and cache bdevs.
3290
3291#### Example
3292
3293Example request:
3294
3295~~~json
3296{
3297  "jsonrpc": "2.0",
3298  "method": "bdev_ocf_get_bdevs",
3299  "id": 1
3300}
3301~~~
3302
3303Example response:
3304
3305~~~json
3306{
3307  "jsonrpc": "2.0",
3308  "id": 1,
3309  "result": [
3310    {
3311      "name": "PartCache",
3312      "started": false,
3313      "cache": {
3314        "name": "Malloc0",
3315        "attached": true
3316      },
3317      "core": {
3318        "name": "Malloc1",
3319        "attached": false
3320      }
3321    }
3322  ]
3323}
3324~~~
3325
3326### bdev_ocf_set_cache_mode {#rpc_bdev_ocf_set_cache_mode}
3327
3328Set new cache mode on OCF bdev.
3329
3330#### Parameters
3331
3332Name                    | Optional | Type        | Description
3333----------------------- | -------- | ----------- | -----------
3334name                    | Required | string      | Bdev name
3335mode                    | Required | string      | OCF cache mode: wb, wt, pt, wa, wi, wo
3336
3337#### Response
3338
3339New cache mode name.
3340
3341#### Example
3342
3343Example request:
3344
3345~~~json
3346{
3347  "params": {
3348    "name": "ocf0",
3349    "mode": "pt",
3350  },
3351  "jsonrpc": "2.0",
3352  "method": "bdev_ocf_set_cache_mode",
3353  "id": 1
3354}
3355~~~
3356
3357Example response:
3358
3359~~~json
3360{
3361  "jsonrpc": "2.0",
3362  "id": 1,
3363  "result": "pt"
3364}
3365~~~
3366
3367### bdev_ocf_set_seqcutoff {#rpc_bdev_ocf_set_seqcutoff}
3368
3369Set sequential cutoff parameters on all cores for the given OCF cache device.
3370A brief description of this functionality can be found in [OpenCAS documentation](https://open-cas.github.io/guide_tool_details.html#seq-cutoff).
3371
3372#### Parameters
3373
3374Name                    | Optional | Type        | Description
3375----------------------- | -------- | ----------- | -----------
3376name                    | Required | string      | Bdev name
3377policy                  | Required | string      | Sequential cutoff policy: always, full, never
3378threshold               | Optional | int         | Activation threshold in KiB
3379promotion_count         | Optional | int         | Promotion request count
3380
3381#### Example
3382
3383Example request:
3384
3385~~~json
3386{
3387  "params": {
3388    "name": "ocf0",
3389    "policy": "full",
3390    "threshold": 4,
3391    "promotion_count": 2
3392  },
3393  "jsonrpc": "2.0",
3394  "method": "bdev_ocf_set_seqcutoff",
3395  "id": 1
3396}
3397~~~
3398
3399Example response:
3400
3401~~~json
3402{
3403  "jsonrpc": "2.0",
3404  "id": 1,
3405  "result": true
3406}
3407~~~
3408
3409### bdev_ocf_flush_start {#rpc_bdev_ocf_flush_start}
3410
3411Start flushing OCF cache device.
3412
3413Automatic flushes of dirty data are managed by OCF cleaning policy settings.
3414In addition to that, all dirty data is flushed to core device when there is
3415an attempt to stop caching.
3416On the other hand, this RPC call gives a possibility to flush dirty data manually
3417when there is a need for it, e.g. to speed up the shutdown process when data
3418hasn't been flushed for a long time.
3419This RPC returns immediately, and flush is then being performed in the
3420background. To see the status of flushing operation use bdev_ocf_flush_status.
3421
3422#### Parameters
3423
3424Name                    | Optional | Type        | Description
3425----------------------- | -------- | ----------- | -----------
3426name                    | Required | string      | Bdev name
3427
3428#### Example
3429
3430Example request:
3431
3432~~~json
3433{
3434  "params": {
3435    "name": "ocf0"
3436  },
3437  "jsonrpc": "2.0",
3438  "method": "bdev_ocf_flush_start",
3439  "id": 1
3440}
3441~~~
3442
3443Example response:
3444
3445~~~json
3446{
3447  "jsonrpc": "2.0",
3448  "id": 1,
3449  "result": true
3450}
3451~~~
3452
3453### bdev_ocf_flush_status {#rpc_bdev_ocf_flush_status}
3454
3455Get flush status of OCF cache device.
3456
3457Automatic flushes of dirty data are managed by OCF cleaning policy settings.
3458In addition to that, all dirty data is flushed to core device when there is
3459an attempt to stop caching.
3460On the other hand, there is a possibility to flush dirty data manually
3461when there is a need for it, e.g. to speed up the shutdown process when data
3462hasn't been flushed for a long time.
3463This RPC reports if such manual flush is still in progress and if the operation
3464was successful. To start manual flush use bdev_ocf_flush_start.
3465
3466#### Parameters
3467
3468Name                    | Optional | Type        | Description
3469----------------------- | -------- | ----------- | -----------
3470name                    | Required | string      | Bdev name
3471
3472#### Response
3473
3474Status of OCF cache device flush.
3475
3476#### Example
3477
3478Example request:
3479
3480~~~json
3481{
3482  "params": {
3483    "name": "ocf0"
3484  },
3485  "jsonrpc": "2.0",
3486  "method": "bdev_ocf_flush_status",
3487  "id": 1
3488}
3489~~~
3490
3491Example response:
3492
3493~~~json
3494{
3495  "jsonrpc": "2.0",
3496  "id": 1,
3497  "result": {
3498    "in_progress": false,
3499    "status": 0
3500  }
3501}
3502~~~
3503
3504### bdev_malloc_create {#rpc_bdev_malloc_create}
3505
3506Construct @ref bdev_config_malloc
3507
3508The `dif_type` parameter can have 0, 1, 2, or 3, and controls the check of the guard tag and the reference tag.
3509If the `dif_type` is 1, 2, or 3, the malloc bdev compares the guard tag to the CRC-16 computed over the block data.
3510If the `dif_type` is 1 or 2, the malloc bdev compares the reference tag to the computed reference tag.
3511The computed reference tag for the first block of the I/O is the `init_ref_tag` of the DIF context, and
3512the computed reference tag is incremented for each subsequent block.
3513If the `dif_type` is 3, the malloc bdev does not check the reference tag.
3514The application tag is not checked by the malloc bdev because the current block device API does not expose
3515it to the upper layer yet.
3516
3517#### Parameters
3518
3519Name                    | Optional | Type        | Description
3520----------------------- | -------- | ----------- | -----------
3521name                    | Optional | string      | Bdev name to use
3522block_size              | Required | number      | Data block size in bytes -must be multiple of 512
3523num_blocks              | Required | number      | Number of blocks
3524uuid                    | Optional | string      | UUID of new bdev
3525optimal_io_boundary     | Optional | number      | Split on optimal IO boundary, in number of blocks, default 0
3526md_size                 | Optional | number      | Metadata size for this bdev (0, 8, 16, 32, 64, or 128). Default is 0.
3527md_interleave           | Optional | boolean     | Metadata location, interleaved if true, and separated if false. Default is false.
3528dif_type                | Optional | number      | Protection information type. Parameter --md-size needs to be set along --dif-type. Default=0 - no protection.
3529dif_is_head_of_md       | Optional | boolean     | Protection information is in the first 8 bytes of metadata. Default=false.
3530
3531#### Result
3532
3533Name of newly created bdev.
3534
3535#### Example
3536
3537Example request:
3538
3539~~~json
3540{
3541  "params": {
3542    "block_size": 4096,
3543    "num_blocks": 16384,
3544    "name": "Malloc0",
3545    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90",
3546    "optimal_io_boundary": 16
3547  },
3548  "jsonrpc": "2.0",
3549  "method": "bdev_malloc_create",
3550  "id": 1
3551}
3552~~~
3553
3554Example response:
3555
3556~~~json
3557{
3558  "jsonrpc": "2.0",
3559  "id": 1,
3560  "result": "Malloc0"
3561}
3562~~~
3563
3564### bdev_malloc_delete {#rpc_bdev_malloc_delete}
3565
3566Delete @ref bdev_config_malloc
3567
3568#### Parameters
3569
3570Name                    | Optional | Type        | Description
3571----------------------- | -------- | ----------- | -----------
3572name                    | Required | string      | Bdev name
3573
3574#### Example
3575
3576Example request:
3577
3578~~~json
3579{
3580  "params": {
3581    "name": "Malloc0"
3582  },
3583  "jsonrpc": "2.0",
3584  "method": "bdev_malloc_delete",
3585  "id": 1
3586}
3587~~~
3588
3589Example response:
3590
3591~~~json
3592{
3593  "jsonrpc": "2.0",
3594  "id": 1,
3595  "result": true
3596}
3597~~~
3598
3599### bdev_null_create {#rpc_bdev_null_create}
3600
3601Construct @ref bdev_config_null
3602
3603#### Parameters
3604
3605Name                    | Optional | Type        | Description
3606----------------------- | -------- | ----------- | -----------
3607name                    | Optional | string      | Bdev name to use
3608block_size              | Required | number      | Block size in bytes
3609num_blocks              | Required | number      | Number of blocks
3610uuid                    | Optional | string      | UUID of new bdev
3611md_size                 | Optional | number      | Metadata size for this bdev. Default=0.
3612dif_type                | Optional | number      | Protection information type. Parameter --md-size needs to be set along --dif-type. Default=0 - no protection.
3613dif_is_head_of_md       | Optional | boolean     | Protection information is in the first 8 bytes of metadata. Default=false.
3614
3615#### Result
3616
3617Name of newly created bdev.
3618
3619#### Example
3620
3621Example request:
3622
3623~~~json
3624{
3625  "params": {
3626    "block_size": 4104,
3627    "num_blocks": 16384,
3628    "name": "Null0",
3629    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90",
3630    "md_size": 8,
3631    "dif_type": 1,
3632    "dif_is_head_of_md": true
3633  },
3634  "jsonrpc": "2.0",
3635  "method": "bdev_null_create",
3636  "id": 1
3637}
3638~~~
3639
3640Example response:
3641
3642~~~json
3643{
3644  "jsonrpc": "2.0",
3645  "id": 1,
3646  "result": "Null0"
3647}
3648~~~
3649
3650### bdev_null_delete {#rpc_bdev_null_delete}
3651
3652Delete @ref bdev_config_null.
3653
3654#### Parameters
3655
3656Name                    | Optional | Type        | Description
3657----------------------- | -------- | ----------- | -----------
3658name                    | Required | string      | Bdev name
3659
3660#### Example
3661
3662Example request:
3663
3664~~~json
3665{
3666  "params": {
3667    "name": "Null0"
3668  },
3669  "jsonrpc": "2.0",
3670  "method": "bdev_null_delete",
3671  "id": 1
3672}
3673~~~
3674
3675Example response:
3676
3677~~~json
3678{
3679  "jsonrpc": "2.0",
3680  "id": 1,
3681  "result": true
3682}
3683~~~
3684
3685### bdev_null_resize {#rpc_bdev_null_resize}
3686
3687Resize @ref bdev_config_null.
3688
3689#### Parameters
3690
3691Name                    | Optional | Type        | Description
3692----------------------- | -------- | ----------- | -----------
3693name                    | Required | string      | Bdev name
3694new_size                | Required | number      | Bdev new capacity in MiB
3695
3696#### Example
3697
3698Example request:
3699
3700~~~json
3701{
3702  "params": {
3703    "name": "Null0",
3704    "new_size": 4096
3705  },
3706  "jsonrpc": "2.0",
3707  "method": "bdev_null_resize",
3708  "id": 1
3709}
3710~~~
3711
3712Example response:
3713
3714~~~json
3715{
3716  "jsonrpc": "2.0",
3717  "id": 1,
3718  "result": true
3719}
3720~~~
3721
3722### bdev_aio_create {#rpc_bdev_aio_create}
3723
3724Construct @ref bdev_config_aio.
3725
3726#### Parameters
3727
3728Name                    | Optional | Type        | Description
3729----------------------- | -------- | ----------- | -----------
3730name                    | Required | string      | Bdev name to use
3731filename                | Required | number      | Path to device or file
3732block_size              | Optional | number      | Block size in bytes
3733
3734#### Result
3735
3736Name of newly created bdev.
3737
3738#### Example
3739
3740Example request:
3741
3742~~~json
3743{
3744  "params": {
3745    "block_size": 4096,
3746    "name": "Aio0",
3747    "filename": "/tmp/aio_bdev_file"
3748  },
3749  "jsonrpc": "2.0",
3750  "method": "bdev_aio_create",
3751  "id": 1
3752}
3753~~~
3754
3755Example response:
3756
3757~~~json
3758{
3759  "jsonrpc": "2.0",
3760  "id": 1,
3761  "result": "Aio0"
3762}
3763~~~
3764
3765### bdev_aio_rescan {#rpc_bdev_aio_rescan}
3766
3767Rescan the size of @ref bdev_config_aio.
3768
3769#### Parameters
3770
3771Name                    | Optional | Type        | Description
3772----------------------- | -------- | ----------- | -----------
3773name                    | Required | string      | Bdev name
3774
3775#### Example
3776
3777Example request:
3778
3779~~~json
3780{
3781  "params": {
3782    "name": "Aio0"
3783  },
3784  "jsonrpc": "2.0",
3785  "method": "bdev_aio_rescan",
3786  "id": 1
3787}
3788~~~
3789
3790Example response:
3791
3792~~~json
3793{
3794  "jsonrpc": "2.0",
3795  "id": 1,
3796  "result": true
3797}
3798~~~
3799
3800### bdev_aio_delete {#rpc_bdev_aio_delete}
3801
3802Delete @ref bdev_config_aio.
3803
3804#### Parameters
3805
3806Name                    | Optional | Type        | Description
3807----------------------- | -------- | ----------- | -----------
3808name                    | Required | string      | Bdev name
3809
3810#### Example
3811
3812Example request:
3813
3814~~~json
3815{
3816  "params": {
3817    "name": "Aio0"
3818  },
3819  "jsonrpc": "2.0",
3820  "method": "bdev_aio_delete",
3821  "id": 1
3822}
3823~~~
3824
3825Example response:
3826
3827~~~json
3828{
3829  "jsonrpc": "2.0",
3830  "id": 1,
3831  "result": true
3832}
3833~~~
3834
3835### bdev_nvme_set_options {#rpc_bdev_nvme_set_options}
3836
3837Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized
3838or any bdev NVMe has been created.
3839
3840Parameters, ctrlr_loss_timeout_sec, reconnect_delay_sec, and fast_io_fail_timeout_sec, are for I/O error resiliency.
3841They can be overridden if they are given by the RPC bdev_nvme_attach_controller.
3842
3843#### Parameters
3844
3845Name                       | Optional | Type        | Description
3846-------------------------- | -------- | ----------- | -----------
3847action_on_timeout          | Optional | string      | Action to take on command time out: none, reset or abort
3848timeout_us                 | Optional | number      | Timeout for each command, in microseconds. If 0, don't track timeouts
3849timeout_admin_us           | Optional | number      | Timeout for each admin command, in microseconds. If 0, treat same as io timeouts ('timeout_us')
3850keep_alive_timeout_ms      | Optional | number      | Keep alive timeout period in milliseconds, default is 10s
3851retry_count                | Optional | number      | The number of attempts per I/O before an I/O fails. (Deprecated. Please use transport_retry_count instead.)
3852arbitration_burst          | Optional | number      | The value is expressed as a power of two, a value of 111b indicates no limit
3853low_priority_weight        | Optional | number      | The maximum number of commands that the controller may launch at one time from a low priority queue
3854medium_priority_weight     | Optional | number      | The maximum number of commands that the controller may launch at one time from a medium priority queue
3855high_priority_weight       | Optional | number      | The maximum number of commands that the controller may launch at one time from a high priority queue
3856nvme_adminq_poll_period_us | Optional | number      | How often the admin queue is polled for asynchronous events in microseconds
3857nvme_ioq_poll_period_us    | Optional | number      | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible).
3858io_queue_requests          | Optional | number      | The number of requests allocated for each NVMe I/O queue. Default: 512.
3859delay_cmd_submit           | Optional | boolean     | Enable delaying NVMe command submission to allow batching of multiple commands. Default: `true`.
3860transport_retry_count      | Optional | number      | The number of attempts per I/O in the transport layer before an I/O fails.
3861bdev_retry_count           | Optional | number      | The number of attempts per I/O in the bdev layer before an I/O fails. -1 means infinite retries.
3862transport_ack_timeout      | Optional | number      | Time to wait ack until retransmission for RDMA or connection close for TCP. Range 0-31 where 0 means use default.
3863ctrlr_loss_timeout_sec     | Optional | number      | Time to wait until ctrlr is reconnected before deleting ctrlr.  -1 means infinite reconnects. 0 means no reconnect.
3864reconnect_delay_sec        | Optional | number      | Time to delay a reconnect trial. 0 means no reconnect.
3865fast_io_fail_timeout_sec   | Optional | number      | Time to wait until ctrlr is reconnected before failing I/O to ctrlr. 0 means no such timeout.
3866disable_auto_failback      | Optional | boolean     | Disable automatic failback. The RPC bdev_nvme_set_preferred_path can be used to do manual failback.
3867generate_uuids             | Optional | boolean     | Enable generation of UUIDs for NVMe bdevs that do not provide this value themselves.
3868transport_tos              | Optional | number      | IPv4 Type of Service value. Only applicable for RDMA transport. Default: 0 (no TOS is applied).
3869nvme_error_stat            | Optional | boolean     | Enable collecting NVMe error counts.
3870rdma_srq_size              | Optional | number      | Set the size of a shared rdma receive queue. Default: 0 (disabled).
3871io_path_stat               | Optional | boolean     | Enable collecting I/O stat of each nvme bdev io path. Default: `false`.
3872
3873#### Example
3874
3875Example request:
3876
3877~~~json
3878request:
3879{
3880  "params": {
3881    "transport_retry_count": 5,
3882    "arbitration_burst": 3,
3883    "low_priority_weight": 8,
3884    "medium_priority_weight":8,
3885    "high_priority_weight": 8,
3886    "nvme_adminq_poll_period_us": 2000,
3887    "timeout_us": 10000000,
3888    "timeout_admin_us": 20000000,
3889    "keep_alive_timeout_ms": 600000,
3890    "action_on_timeout": "reset",
3891    "io_queue_requests" : 2048,
3892    "delay_cmd_submit": true
3893  },
3894  "jsonrpc": "2.0",
3895  "method": "bdev_nvme_set_options",
3896  "id": 1
3897}
3898~~~
3899
3900Example response:
3901
3902~~~json
3903{
3904  "jsonrpc": "2.0",
3905  "id": 1,
3906  "result": true
3907}
3908~~~
3909
3910### bdev_nvme_set_hotplug {#rpc_bdev_nvme_set_hotplug}
3911
3912Change settings of the NVMe hotplug feature. If enabled, PCIe NVMe bdevs will be automatically discovered on insertion
3913and deleted on removal.
3914
3915#### Parameters
3916
3917Name                    | Optional | Type        | Description
3918----------------------- | -------- | ----------- | -----------
3919enabled                 | Required | string      | True to enable, false to disable
3920period_us               | Optional | number      | How often to poll for hot-insert and hot-remove events. Values: 0 - reset/use default or 1 to 10000000.
3921
3922#### Example
3923
3924Example request:
3925
3926~~~json
3927request:
3928{
3929  "params": {
3930    "enabled": true,
3931    "period_us": 2000
3932  },
3933  "jsonrpc": "2.0",
3934  "method": "bdev_nvme_set_hotplug",
3935  "id": 1
3936}
3937~~~
3938
3939Example response:
3940
3941~~~json
3942{
3943  "jsonrpc": "2.0",
3944  "id": 1,
3945  "result": true
3946}
3947~~~
3948
3949### bdev_nvme_attach_controller {#rpc_bdev_nvme_attach_controller}
3950
3951Construct @ref bdev_config_nvme. This RPC can also be used to add additional paths to an existing controller to enable
3952multipathing. This is done by specifying the `name` parameter as an existing controller. When adding an additional
3953path, the hostnqn, hostsvcid, hostaddr, prchk_reftag, and prchk_guard_arguments must not be specified and are assumed
3954to have the same value as the existing path.
3955
3956The parameters, `ctrlr_loss_timeout_sec`, `reconnect_delay_sec`, and `fast_io_fail_timeout_sec`, are mutually dependent.
3957If `reconnect_delay_sec` is non-zero, `ctrlr_loss_timeout_sec` has to be -1 or not less than `reconnect_delay_sec`.
3958If `reconnect_delay_sec` is zero, `ctrlr_loss_timeout_sec` has to be zero.
3959If `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.
3960
3961#### Result
3962
3963Array of names of newly created bdevs.
3964
3965#### Parameters
3966
3967Name                       | Optional | Type        | Description
3968-------------------------- | -------- | ----------- | -----------
3969name                       | Required | string      | Name of the NVMe controller, prefix for each bdev name
3970trtype                     | Required | string      | NVMe-oF target trtype: rdma or pcie
3971traddr                     | Required | string      | NVMe-oF target address: ip or BDF
3972adrfam                     | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
3973trsvcid                    | Optional | string      | NVMe-oF target trsvcid: port number
3974subnqn                     | Optional | string      | NVMe-oF target subnqn
3975hostnqn                    | Optional | string      | NVMe-oF target hostnqn
3976hostaddr                   | Optional | string      | NVMe-oF host address: ip address
3977hostsvcid                  | Optional | string      | NVMe-oF host trsvcid: port number
3978prchk_reftag               | Optional | bool        | Enable checking of PI reference tag for I/O processing
3979prchk_guard                | Optional | bool        | Enable checking of PI guard for I/O processing
3980hdgst                      | Optional | bool        | Enable TCP header digest
3981ddgst                      | Optional | bool        | Enable TCP data digest
3982fabrics_connect_timeout_us | Optional | bool        | Timeout for fabrics connect (in microseconds)
3983multipath                  | Optional | string      | Multipathing behavior: disable, failover, multipath. Default is failover.
3984num_io_queues              | Optional | number      | The number of IO queues to request during initialization. Range: (0, UINT16_MAX + 1], Default is 1024.
3985ctrlr_loss_timeout_sec     | Optional | number      | Time to wait until ctrlr is reconnected before deleting ctrlr.  -1 means infinite reconnects. 0 means no reconnect.
3986reconnect_delay_sec        | Optional | number      | Time to delay a reconnect trial. 0 means no reconnect.
3987fast_io_fail_timeout_sec   | Optional | number      | Time to wait until ctrlr is reconnected before failing I/O to ctrlr. 0 means no such timeout.
3988psk                        | Optional | string      | PSK in hexadecimal digits, e.g. 1234567890ABCDEF (Enables SSL socket implementation for TCP)
3989max_bdevs                  | Optional | number      | The size of the name array for newly created bdevs. Default is 128.
3990
3991#### Example
3992
3993Example request:
3994
3995~~~json
3996{
3997  "params": {
3998    "trtype": "pcie",
3999    "name": "Nvme0",
4000    "traddr": "0000:0a:00.0"
4001  },
4002  "jsonrpc": "2.0",
4003  "method": "bdev_nvme_attach_controller",
4004  "id": 1
4005}
4006~~~
4007
4008Example response:
4009
4010~~~json
4011{
4012  "jsonrpc": "2.0",
4013  "id": 1,
4014  "result": [
4015    "Nvme0n1"
4016  ]
4017}
4018~~~
4019
4020### bdev_nvme_get_controllers {#rpc_bdev_nvme_get_controllers}
4021
4022Get information about NVMe controllers.
4023
4024#### Parameters
4025
4026The user may specify no parameters in order to list all NVMe controllers, or one NVMe controller may be
4027specified by name.
4028
4029Name                    | Optional | Type        | Description
4030----------------------- | -------- | ----------- | -----------
4031name                    | Optional | string      | NVMe controller name
4032
4033#### Response
4034
4035The response is an array of objects containing information about the requested NVMe controllers.
4036
4037#### Example
4038
4039Example request:
4040
4041~~~json
4042{
4043  "jsonrpc": "2.0",
4044  "id": 1,
4045  "method": "bdev_nvme_get_controllers",
4046  "params": {
4047    "name": "Nvme0"
4048  }
4049}
4050~~~
4051
4052Example response:
4053
4054~~~json
4055{
4056  "jsonrpc": "2.0",
4057  "id": 1,
4058  "result": [
4059    {
4060      "name": "Nvme0",
4061      "trid": {
4062        "trtype": "PCIe",
4063        "traddr": "0000:05:00.0"
4064      },
4065      "cntlid": 0
4066    }
4067  ]
4068}
4069~~~
4070
4071### bdev_nvme_detach_controller {#rpc_bdev_nvme_detach_controller}
4072
4073Detach NVMe controller and delete any associated bdevs. Optionally,
4074If all of the transport ID options are specified, only remove that
4075transport path from the specified controller. If that is the only
4076available path for the controller, this will also result in the
4077controller being detached and the associated bdevs being deleted.
4078
4079returns true if the controller and bdevs were successfully destroyed
4080or the address was properly removed, false otherwise.
4081
4082#### Parameters
4083
4084Name                    | Optional | Type        | Description
4085----------------------- | -------- | ----------- | -----------
4086name                    | Required | string      | Controller name
4087trtype                  | Optional | string      | NVMe-oF target trtype: rdma or tcp
4088traddr                  | Optional | string      | NVMe-oF target address: ip or BDF
4089adrfam                  | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
4090trsvcid                 | Optional | string      | NVMe-oF target trsvcid: port number
4091subnqn                  | Optional | string      | NVMe-oF target subnqn
4092hostaddr                | Optional | string      | NVMe-oF host address: ip
4093hostsvcid               | Optional | string      | NVMe-oF host svcid: port number
4094
4095#### Example
4096
4097Example requests:
4098
4099~~~json
4100{
4101  "params": {
4102    "name": "Nvme0"
4103  },
4104  "jsonrpc": "2.0",
4105  "method": "bdev_nvme_detach_controller",
4106  "id": 1
4107}
4108~~~
4109
4110Example response:
4111
4112~~~json
4113{
4114  "jsonrpc": "2.0",
4115  "id": 1,
4116  "result": true
4117}
4118~~~
4119
4120### bdev_nvme_reset_controller {#rpc_bdev_nvme_reset_controller}
4121
4122Reset NVMe controller.
4123
4124Returns true if the controller reset was successful, false otherwise.
4125
4126#### Parameters
4127
4128Name                    | Optional | Type        | Description
4129----------------------- | -------- | ----------- | -----------
4130name                    | Required | string      | NVMe controller name
4131
4132#### Example
4133
4134Example request:
4135
4136~~~json
4137{
4138  "jsonrpc": "2.0",
4139  "id": 1,
4140  "method": "bdev_nvme_reset_controller",
4141  "params": {
4142    "name": "Nvme0"
4143  }
4144}
4145~~~
4146
4147Example response:
4148
4149~~~json
4150{
4151  "jsonrpc": "2.0",
4152  "id": 1,
4153  "result": true
4154}
4155~~~
4156
4157### bdev_nvme_start_discovery {#rpc_bdev_nvme_start_discovery}
4158
4159Start a discovery service for the discovery subsystem of the specified transport ID.
4160
4161The discovery service will read the discovery log page for the specified
4162discovery subsystem, and automatically attach to any subsystems found in the
4163log page. When determining a controller name to use when attaching, it will use
4164the 'name' parameter as a prefix, followed by a unique integer for that discovery
4165service. If the discovery service identifies a subsystem that has been previously
4166attached but is listed with a different path, it will use the same controller name
4167as the previous entry, and connect as a multipath.
4168
4169When the discovery service sees that a subsystem entry has been removed
4170from the log page, it will automatically detach from that controller as well.
4171
4172The 'name' is also used to later stop the discovery service.
4173
4174#### Parameters
4175
4176Name                       | Optional | Type        | Description
4177-------------------------- | -------- | ----------- | -----------
4178name                       | Required | string      | Prefix for NVMe controllers
4179trtype                     | Required | string      | NVMe-oF target trtype: rdma or tcp
4180traddr                     | Required | string      | NVMe-oF target address: ip
4181adrfam                     | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6
4182trsvcid                    | Optional | string      | NVMe-oF target trsvcid: port number
4183hostnqn                    | Optional | string      | NVMe-oF target hostnqn
4184wait_for_attach            | Optional | bool        | Wait to complete until all discovered NVM subsystems are attached
4185attach_timeout_ms          | Optional | number      | Time to wait until the discovery and all discovered NVM subsystems are attached
4186ctrlr_loss_timeout_sec     | Optional | number      | Time to wait until ctrlr is reconnected before deleting ctrlr.  -1 means infinite reconnects. 0 means no reconnect.
4187reconnect_delay_sec        | Optional | number      | Time to delay a reconnect trial. 0 means no reconnect.
4188fast_io_fail_timeout_sec   | Optional | number      | Time to wait until ctrlr is reconnected before failing I/O to ctrlr. 0 means no such timeout.
4189
4190#### Example
4191
4192Example request:
4193
4194~~~json
4195{
4196  "jsonrpc": "2.0",
4197  "method": "bdev_nvme_start_discovery",
4198  "id": 1,
4199  "params": {
4200    "name": "nvme_auto",
4201    "trtype": "tcp",
4202    "traddr": "127.0.0.1",
4203    "hostnqn": "nqn.2021-12.io.spdk:host1",
4204    "adrfam": "ipv4",
4205    "trsvcid": "4420"
4206  }
4207}
4208~~~
4209
4210Example response:
4211
4212~~~json
4213{
4214  "jsonrpc": "2.0",
4215  "id": 1,
4216  "result": true
4217}
4218~~~
4219
4220### bdev_nvme_stop_discovery {#rpc_bdev_nvme_stop_discovery}
4221
4222Stop a discovery service. This includes detaching any controllers that were
4223discovered via the service that is being stopped.
4224
4225#### Parameters
4226
4227Name                       | Optional | Type        | Description
4228-------------------------- | -------- | ----------- | -----------
4229name                       | Required | string      | Name of service to stop
4230
4231#### Example
4232
4233Example request:
4234
4235~~~json
4236{
4237  "jsonrpc": "2.0",
4238  "method": "bdev_nvme_stop_discovery",
4239  "id": 1,
4240  "params": {
4241    "name": "nvme_auto"
4242  }
4243}
4244~~~
4245
4246Example response:
4247
4248~~~json
4249{
4250  "jsonrpc": "2.0",
4251  "id": 1,
4252  "result": true
4253}
4254~~~
4255
4256### bdev_nvme_get_discovery_info {#rpc_bdev_nvme_get_discovery_info}
4257
4258Get information about the discovery service.
4259
4260#### Example
4261
4262Example request:
4263~~~json
4264{
4265  "jsonrpc": "2.0",
4266  "method": "bdev_nvme_get_discovery_info",
4267  "id": 1
4268}
4269~~~
4270
4271Example response:
4272
4273~~~json
4274{
4275  "jsonrpc": "2.0",
4276  "id": 1,
4277  "result": [
4278    {
4279      "name": "nvme-disc",
4280      "trid": {
4281        "trtype": "TCP",
4282        "adrfam": "IPv4",
4283        "traddr": "127.0.0.1",
4284        "trsvcid": "8009",
4285        "subnqn": "nqn.2014-08.org.nvmexpress.discovery"
4286      },
4287      "referrals": []
4288    }
4289  ]
4290}
4291~~~
4292
4293### bdev_nvme_get_io_paths {#rpc_bdev_nvme_get_io_paths}
4294
4295Display all or the specified NVMe bdev's active I/O paths.
4296
4297#### Parameters
4298
4299Name                    | Optional | Type        | Description
4300----------------------- | -------- | ----------- | -----------
4301name                    | Optional | string      | Name of the NVMe bdev
4302
4303#### Example
4304
4305Example request:
4306
4307~~~json
4308{
4309  "jsonrpc": "2.0",
4310  "method": "bdev_nvme_get_io_paths",
4311  "id": 1,
4312  "params": {
4313    "name": "Nvme0n1"
4314  }
4315}
4316~~~
4317
4318Example response:
4319
4320~~~json
4321{
4322  "jsonrpc": "2.0",
4323  "id": 1,
4324  "result": {
4325    "poll_groups": [
4326      {
4327        "thread": "app_thread",
4328        "io_paths": [
4329          {
4330            "bdev_name": "Nvme0n1",
4331            "cntlid": 0,
4332            "current": true,
4333            "connected": true,
4334            "accessible": true,
4335            "transport": {
4336              "trtype": "RDMA",
4337              "traddr": "1.2.3.4",
4338              "trsvcid": "4420",
4339              "adrfam": "IPv4"
4340            }
4341          }
4342        ]
4343      }
4344    ]
4345  }
4346}
4347~~~
4348
4349### bdev_nvme_set_preferred_path {#rpc_bdev_nvme_set_preferred_path}
4350
4351Set the preferred I/O path for an NVMe bdev in multipath mode.
4352
4353NOTE: This RPC does not support NVMe bdevs in failover mode.
4354
4355#### Parameters
4356
4357Name                    | Optional | Type        | Description
4358----------------------- | -------- | ----------- | -----------
4359name                    | Required | string      | Name of the NVMe bdev
4360cntlid                  | Required | number      | NVMe-oF controller ID
4361
4362#### Example
4363
4364Example request:
4365
4366~~~json
4367{
4368  "jsonrpc": "2.0",
4369  "method": "bdev_nvme_set_preferred_path",
4370  "id": 1,
4371  "params": {
4372    "name": "Nvme0n1",
4373    "cntlid": 0
4374  }
4375}
4376~~~
4377
4378Example response:
4379
4380~~~json
4381{
4382  "jsonrpc": "2.0",
4383  "id": 1,
4384  "result": true
4385}
4386~~~
4387
4388### bdev_nvme_set_multipath_policy {#rpc_bdev_nvme_set_multipath_policy}
4389
4390Set multipath policy of the NVMe bdev in multipath mode or set multipath
4391selector for active-active multipath policy.
4392
4393#### Parameters
4394
4395Name                    | Optional | Type        | Description
4396----------------------- | -------- | ----------- | -----------
4397name                    | Required | string      | Name of the NVMe bdev
4398policy                  | Required | string      | Multipath policy: active_active or active_passive
4399selector                | Optional | string      | Multipath selector: round_robin or queue_depth, used in active-active mode. Default is round_robin
4400rr_min_io               | Optional | number      | Number of I/Os routed to current io path before switching to another for round-robin selector. The min value is 1.
4401
4402#### Example
4403
4404Example request:
4405
4406~~~json
4407{
4408  "jsonrpc": "2.0",
4409  "method": "bdev_nvme_set_multipath_policy",
4410  "id": 1,
4411  "params": {
4412    "name": "Nvme0n1",
4413    "policy": "active_passive"
4414  }
4415}
4416~~~
4417
4418Example response:
4419
4420~~~json
4421{
4422  "jsonrpc": "2.0",
4423  "id": 1,
4424  "result": true
4425}
4426~~~
4427
4428### bdev_nvme_get_path_iostat {#rpc_bdev_nvme_get_path_iostat}
4429
4430Get I/O statistics for IO paths of the block device. Call RPC bdev_nvme_set_options to set enable_io_path_stat
4431true before using this RPC.
4432
4433#### Parameters
4434
4435Name                    | Optional | Type        | Description
4436----------------------- | -------- | ----------- | -----------
4437name                    | Required | string      | Name of the NVMe bdev
4438
4439#### Example
4440
4441Example request:
4442
4443~~~json
4444{
4445  "jsonrpc": "2.0",
4446  "method": "bdev_nvme_get_path_iostat",
4447  "id": 1,
4448  "params": {
4449    "name": "NVMe0n1"
4450  }
4451}
4452~~~
4453
4454Example response:
4455
4456~~~json
4457{
4458  "jsonrpc": "2.0",
4459  "id": 1,
4460  "result": {
4461    "name": "NVMe0n1",
4462    "stats": [
4463      {
4464        "trid": {
4465          "trtype": "TCP",
4466          "adrfam": "IPv4",
4467          "traddr": "10.169.204.201",
4468          "trsvcid": "4420",
4469          "subnqn": "nqn.2016-06.io.spdk:cnode1"
4470        },
4471        "stat": {
4472          "bytes_read": 676691968,
4473          "num_read_ops": 165201,
4474          "bytes_written": 0,
4475          "num_write_ops": 0,
4476          "bytes_unmapped": 0,
4477          "num_unmap_ops": 0,
4478          "max_read_latency_ticks": 521487,
4479          "min_read_latency_ticks": 0,
4480          "write_latency_ticks": 0,
4481          "max_write_latency_ticks": 0,
4482          "min_write_latency_ticks": 0,
4483          "unmap_latency_ticks": 0,
4484          "max_unmap_latency_ticks": 0,
4485          "min_unmap_latency_ticks": 0,
4486          "copy_latency_ticks": 0,
4487          "max_copy_latency_ticks": 0,
4488          "min_copy_latency_ticks": 0
4489        }
4490      },
4491      {
4492        "trid": {
4493          "trtype": "TCP",
4494          "adrfam": "IPv4",
4495          "traddr": "8.8.8.6",
4496          "trsvcid": "4420",
4497          "subnqn": "nqn.2016-06.io.spdk:cnode1"
4498        },
4499        "stat": {
4500          "bytes_read": 677138432,
4501          "num_read_ops": 165317,
4502          "bytes_written": 0,
4503          "num_write_ops": 0,
4504          "bytes_unmapped": 0,
4505          "num_unmap_ops": 0,
4506          "max_read_latency_ticks": 108525,
4507          "min_read_latency_ticks": 0,
4508          "write_latency_ticks": 0,
4509          "max_write_latency_ticks": 0,
4510          "min_write_latency_ticks": 0,
4511          "unmap_latency_ticks": 0,
4512          "max_unmap_latency_ticks": 0,
4513          "min_unmap_latency_ticks": 0,
4514          "copy_latency_ticks": 0,
4515          "max_copy_latency_ticks": 0,
4516          "min_copy_latency_ticks": 0
4517        }
4518      }
4519    ]
4520  }
4521}
4522~~~
4523
4524### bdev_nvme_cuse_register {#rpc_bdev_nvme_cuse_register}
4525
4526Register CUSE device on NVMe controller.
4527This feature is considered as experimental.
4528
4529#### Parameters
4530
4531Name                    | Optional | Type        | Description
4532----------------------- | -------- | ----------- | -----------
4533name                    | Required | string      | Name of the NVMe controller
4534dev_path                | Required | string      | Path to the CUSE controller device, e.g. spdk/nvme0
4535
4536#### Example
4537
4538Example request:
4539
4540~~~json
4541{
4542  "params": {
4543    "dev_path": "spdk/nvme0",
4544    "name": "Nvme0"
4545  },
4546  "jsonrpc": "2.0",
4547  "method": "bdev_nvme_cuse_register",
4548  "id": 1
4549}
4550~~~
4551
4552Example response:
4553
4554~~~json
4555{
4556  "jsonrpc": "2.0",
4557  "id": 1,
4558  "result": true
4559}
4560~~~
4561
4562### bdev_nvme_cuse_unregister {#rpc_bdev_nvme_cuse_unregister}
4563
4564Unregister CUSE device on NVMe controller.
4565This feature is considered as experimental.
4566
4567#### Parameters
4568
4569Name                    | Optional | Type        | Description
4570----------------------- | -------- | ----------- | -----------
4571name                    | Required | string      | Name of the NVMe controller
4572
4573#### Example
4574
4575Example request:
4576
4577~~~json
4578{
4579  "params": {
4580    "name": "Nvme0"
4581  },
4582  "jsonrpc": "2.0",
4583  "method": "bdev_nvme_cuse_unregister",
4584  "id": 1
4585}
4586~~~
4587
4588Example response:
4589
4590~~~json
4591{
4592  "jsonrpc": "2.0",
4593  "id": 1,
4594  "result": true
4595}
4596~~~
4597
4598### bdev_zone_block_create {#rpc_bdev_zone_block_create}
4599
4600Creates a virtual zone device on top of existing non-zoned bdev.
4601
4602#### Parameters
4603
4604Name                    | Optional | Type        | Description
4605----------------------- | -------- | ----------- | -----------
4606name                    | Required | string      | Name of the Zone device
4607base_bdev               | Required | string      | Name of the Base bdev
4608zone_capacity           | Required | number      | Zone capacity in blocks
4609optimal_open_zones      | Required | number      | Number of zones required to reach optimal write speed
4610
4611#### Example
4612
4613Example request:
4614
4615~~~json
4616{
4617  "jsonrpc": "2.0",
4618  "method": "bdev_zone_block_create",
4619  "id": 1,
4620  "params": {
4621    "name": "zone1",
4622    "base_bdev": "NVMe0n1",
4623    "zone_capacity": 4096,
4624    "optimal_open_zones": 32
4625  }
4626}
4627~~~
4628
4629Example response:
4630
4631~~~json
4632{
4633  "jsonrpc": "2.0",
4634  "id": 1,
4635  "result": "zone1"
4636}
4637~~~
4638
4639### bdev_zone_block_delete {#rpc_bdev_zone_block_delete}
4640
4641Deletes a virtual zone device.
4642
4643#### Parameters
4644
4645Name                    | Optional | Type        | Description
4646----------------------- | -------- | ----------- | -----------
4647name                    | Required | string      | Name of the Zone device
4648
4649#### Example
4650
4651Example request:
4652
4653~~~json
4654{
4655  "jsonrpc": "2.0",
4656  "method": "bdev_zone_block_delete",
4657  "id": 1,
4658  "params": {
4659    "name": "zone1"
4660  }
4661}
4662~~~
4663
4664Example response:
4665
4666~~~json
4667{
4668  "jsonrpc": "2.0",
4669  "id": 1,
4670  "result": true
4671}
4672~~~
4673
4674### bdev_nvme_apply_firmware {#rpc_bdev_nvme_apply_firmware}
4675
4676Download and commit firmware to NVMe device.
4677
4678#### Parameters
4679
4680Name                    | Optional | Type        | Description
4681----------------------- | -------- | ----------- | -----------
4682filename                | Required | string      | filename of the firmware to download
4683bdev_name               | Required | string      | Name of the NVMe block device
4684
4685#### Example
4686
4687Example request:
4688
4689~~~json
4690{
4691  "jsonrpc": "2.0",
4692  "method": "bdev_nvme_apply_firmware",
4693  "id": 1,
4694  "params": {
4695    "filename": "firmware_file",
4696    "bdev_name": "NVMe0n1"
4697  }
4698}
4699~~~
4700
4701### bdev_nvme_get_transport_statistics {#rpc_bdev_nvme_get_transport_statistics}
4702
4703Get bdev_nvme poll group transport statistics.
4704
4705#### Parameters
4706
4707This RPC method accepts no parameters
4708
4709#### Response
4710
4711The response is an array of objects containing information about transport statistics per NVME poll group.
4712
4713#### Example
4714
4715Example request:
4716
4717~~~json
4718{
4719  "jsonrpc": "2.0",
4720  "id": 1,
4721  "method": "bdev_nvme_get_transport_statistics",
4722}
4723~~~
4724
4725Example response:
4726
4727~~~json
4728{
4729  "jsonrpc": "2.0",
4730  "id": 1,
4731	"result": {
4732	  "poll_groups": [
4733		{
4734		  "thread": "nvmf_tgt_poll_group_0",
4735		  "transports": [
4736			{
4737			  "trname": "RDMA",
4738			  "devices": [
4739				{
4740				  "dev_name": "mlx5_1",
4741				  "polls": 137492169,
4742				  "idle_polls": 137492169,
4743				  "completions": 0,
4744				  "queued_requests": 0,
4745				  "total_send_wrs": 0,
4746				  "send_sq_doorbell_updates": 0,
4747				  "total_recv_wrs": 0,
4748				  "recv_sq_doorbell_updates": 0
4749				},
4750				{
4751				  "dev_name": "mlx5_0",
4752				  "polls": 137985185,
4753				  "idle_polls": 137492169,
4754				  "completions": 1474593,
4755				  "queued_requests": 0,
4756				  "total_send_wrs": 1474593,
4757				  "send_sq_doorbell_updates": 426147,
4758				  "total_recv_wrs": 1474721,
4759				  "recv_sq_doorbell_updates": 348445
4760				}
4761			  ]
4762			},
4763			{
4764			  "trname": "PCIE",
4765			  "polls": 435419831,
4766			  "idle_polls": 434901004,
4767			  "completions": 1485543,
4768			  "cq_doorbell_updates": 518827,
4769			  "queued_requests": 0,
4770			  "submitted_requests": 1485543,
4771			  "sq_doorbell_updates": 516081
4772			}
4773		  ]
4774		},
4775		{
4776		  "thread": "nvmf_tgt_poll_group_1",
4777		  "transports": [
4778			{
4779			  "trname": "RDMA",
4780			  "devices": [
4781				{
4782				  "dev_name": "mlx5_1",
4783				  "polls": 140245630,
4784				  "idle_polls": 140245630,
4785				  "completions": 0,
4786				  "queued_requests": 0,
4787				  "total_send_wrs": 0,
4788				  "send_sq_doorbell_updates": 0,
4789				  "total_recv_wrs": 0,
4790				  "recv_sq_doorbell_updates": 0
4791				},
4792				{
4793				  "dev_name": "mlx5_0",
4794				  "polls": 140751844,
4795				  "idle_polls": 140245630,
4796				  "completions": 1489298,
4797				  "queued_requests": 0,
4798				  "total_send_wrs": 1489298,
4799				  "send_sq_doorbell_updates": 433510,
4800				  "total_recv_wrs": 1489426,
4801				  "recv_sq_doorbell_updates": 357956
4802				}
4803			  ]
4804			},
4805			{
4806			  "trname": "PCIE",
4807			  "polls": 429044294,
4808			  "idle_polls": 428525658,
4809			  "completions": 1478730,
4810			  "cq_doorbell_updates": 518636,
4811			  "queued_requests": 0,
4812			  "submitted_requests": 1478730,
4813			  "sq_doorbell_updates": 511658
4814			}
4815		  ]
4816		}
4817	  ]
4818	}
4819}
4820~~~
4821
4822### bdev_nvme_get_controller_health_info {#rpc_bdev_nvme_get_controller_health_info}
4823
4824Display health log of the required NVMe bdev device.
4825
4826#### Parameters
4827
4828Name                    | Optional | Type        | Description
4829----------------------- | -------- | ----------- | -----------
4830name                    | Required | string      | Name of the NVMe bdev controller
4831
4832#### Response
4833
4834The response is the object containing information about health log of the NVMe controller.
4835
4836#### Example
4837
4838Example request:
4839
4840~~~json
4841{
4842  "jsonrpc": "2.0",
4843  "method": "bdev_nvme_get_controller_health_info",
4844  "id": 1,
4845  "params": {
4846    "name": "Nvme0"
4847  }
4848}
4849~~~
4850
4851Example response:
4852
4853~~~json
4854{
4855  "model_number": "INTEL SSDPE2KX020T8",
4856  "serial_number": "BTLJ72430ARH2P0BGN",
4857  "firmware_revision": "VDV10110",
4858  "traddr": "0000:08:00.0",
4859  "temperature_celsius": 32,
4860  "available_spare_percentage": 99,
4861  "available_spare_threshold_percentage": 10,
4862  "percentage_used": 2,
4863  "data_units_read": 1013408619,
4864  "data_units_written": 346792685,
4865  "host_read_commands": 30457773282,
4866  "host_write_commands": 18949677715,
4867  "controller_busy_time": 4979,
4868  "power_cycles": 49,
4869  "power_on_hours": 31118,
4870  "unsafe_shutdowns": 18,
4871  "media_errors": 17,
4872  "num_err_log_entries": 19,
4873  "warning_temperature_time_minutes": 0,
4874  "critical_composite_temperature_time_minutes": 0
4875}
4876~~~
4877
4878### bdev_rbd_register_cluster {#rpc_bdev_rbd_register_cluster}
4879
4880This method is available only if SPDK was build with Ceph RBD support.
4881
4882#### Parameters
4883
4884Name                    | Optional | Type        | Description
4885----------------------- | -------- | ----------- | -----------
4886name                    | Required | string      | Registered Rados cluster object name
4887user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
4888config_param            | Optional | string map  | Explicit librados configuration
4889config_file             | Optional | string      | File path of libraodos configuration file
4890key_file                | Optional | string      | File path of libraodos key file
4891
4892This RPC registers a Rados Cluster object handle which is only known
4893to rbd module, it uses user_id + config_param or user_id + config_file +
4894key_file or user_id + config_param + config_file + key_file to identify
4895a Rados cluster object.
4896
4897When accessing the Ceph cluster as some user other than "admin" (the
4898default), the "user_id" has to be set.
4899
4900The configuration items and secret key can be specified by setting config_param,
4901config_file and key_file, all of them, or none of them. If only config_param is
4902passed, all key/value pairs are passed to rados_conf_set to configure cluster access.
4903In practice, "mon_host" (= list of monitor address+port) and "key" (= the secret key
4904stored in Ceph keyrings) are enough. If config_file and key_file are specified, they must
4905exist with all relevant settings for accessing the Ceph cluster. If config_param, config_file
4906and key_file are specified, get the key/value pairs from config_file first and set to
4907rados_conf_set function, then set pairs in config_param and keyring in key_file. If nothing
4908is specified, it will get configuration file and key file from the default location
4909/etc/ceph/ceph.conf and /etc/ceph/ceph.client.user_id.keyring.
4910
4911#### Result
4912
4913Name of newly created Rados cluster object.
4914
4915#### Example
4916
4917Example request:
4918
4919~~
4920{
4921  "params": {
4922    "name": "rbd_cluster",
4923    "user_id": cinder,
4924    "config_file": "/root/ceph_conf/ceph.conf",
4925    "key_file": "/root/ceph_conf/ceph.client.cinder.keyring"
4926  },
4927  "jsonrpc": "2.0",
4928  "method": "bdev_rbd_register_cluster",
4929  "id": 1
4930}
4931~~
4932
4933Example response:
4934
4935~~
4936response:
4937{
4938  "jsonrpc": "2.0",
4939  "id": 1,
4940  "result": "rbd_cluster"
4941}
4942~~
4943
4944### bdev_rbd_unregister_cluster {#rpc_bdev_rbd_unregister_cluster}
4945
4946This method is available only if SPDK was build with Ceph RBD support.
4947If there is still rbd bdev using this cluster, the unregisteration operation
4948will fail.
4949
4950#### Result
4951
4952`true` if Rados cluster object with provided name was deleted or `false` otherwise.
4953
4954#### Parameters
4955
4956Name                    | Optional | Type        | Description
4957----------------------- | -------- | ----------- | -------------------------
4958name                    | Required | string      | Rados cluster object name
4959
4960#### Example
4961
4962Example request:
4963
4964~~
4965{
4966  "params": {
4967    "name": "rbd_cluster"
4968  },
4969  "jsonrpc": "2.0",
4970  "method": "bdev_rbd_unregister_cluster",
4971  "id": 1
4972}
4973~~
4974
4975Example response:
4976
4977~~
4978{
4979  "jsonrpc": "2.0",
4980  "id": 1,
4981  "result": true
4982}
4983~~
4984
4985### bdev_rbd_get_clusters_info {#rpc_bdev_rbd_get_clusters_info}
4986
4987This method is available only if SPDK was build with Ceph RBD support.
4988
4989#### Result
4990
4991Returns the cluster info of the Rados Cluster name if provided. Otherwise, it
4992returns the cluster info of every registered Raods Cluster name.
4993
4994#### Parameters
4995
4996Name                    | Optional | Type        | Description
4997----------------------- | -------- | ----------- | -------------------------
4998name                    | Optional | string      | Rados cluster object name
4999
5000#### Example
5001
5002Example request:
5003
5004~~
5005{
5006  "params": {
5007    "name": "rbd_cluster"
5008  },
5009  "jsonrpc": "2.0",
5010  "method": "bdev_rbd_get_clusters_info",
5011  "id": 1
5012}
5013~~
5014
5015Example response:
5016
5017~~
5018{
5019  "jsonrpc": "2.0",
5020  "cluster_name": "rbd_cluster"
5021}
5022~~
5023
5024### bdev_rbd_create {#rpc_bdev_rbd_create}
5025
5026Create @ref bdev_config_rbd bdev
5027
5028This method is available only if SPDK was build with Ceph RBD support.
5029
5030#### Parameters
5031
5032Name                    | Optional | Type        | Description
5033----------------------- | -------- | ----------- | -----------
5034name                    | Optional | string      | Bdev name
5035user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
5036pool_name               | Required | string      | Pool name
5037rbd_name                | Required | string      | Image name
5038block_size              | Required | number      | Block size
5039config                  | Optional | string map  | Explicit librados configuration
5040cluster_name            | Optional | string      | Rados cluster object name created in this module.
5041uuid                    | Optional | string      | UUID of new bdev
5042
5043If no config is specified, Ceph configuration files must exist with
5044all relevant settings for accessing the pool. If a config map is
5045passed, the configuration files are ignored and instead all key/value
5046pairs are passed to rados_conf_set to configure cluster access. In
5047practice, "mon_host" (= list of monitor address+port) and "key" (= the
5048secret key stored in Ceph keyrings) are enough.
5049
5050When accessing the image as some user other than "admin" (the
5051default), the "user_id" has to be set.
5052
5053If provided with cluster_name option, it will use the Rados cluster object
5054referenced by the name (created by bdev_rbd_register_cluster RPC) and ignores
5055"user_id + config" combination to create its own Rados cluster. In this scenario,
5056all the bdevs will share the same cluster with one connection of Ceph in librbd module.
5057Performance tuning on the I/O workload could be done by estimating how many io_contxt
5058threads and messager threads in Ceph side and how many cores would be reasonable to provide
5059for SPDK to get up to your projections.
5060
5061#### Result
5062
5063Name of newly created bdev.
5064
5065#### Example
5066
5067Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`:
5068
5069~~~json
5070{
5071  "params": {
5072    "pool_name": "rbd",
5073    "rbd_name": "foo",
5074    "config": {
5075      "mon_host": "192.168.7.1:6789,192.168.7.2:6789",
5076      "key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ==",
5077    }
5078    "block_size": 4096,
5079    "uuid": "76210ea4-7920-40a0-a07b-8992a7443c76"
5080  },
5081  "jsonrpc": "2.0",
5082  "method": "bdev_rbd_create",
5083  "id": 1
5084}
5085~~~
5086
5087Example response:
5088
5089~~~json
5090response:
5091{
5092  "jsonrpc": "2.0",
5093  "id": 1,
5094  "result": "Ceph0"
5095}
5096~~~
5097
5098Example request with `cluster_name`:
5099
5100~~
5101{
5102  "params": {
5103    "pool_name": "rbd",
5104    "rbd_name": "foo",
5105    "block_size": 4096,
5106    "cluster_name": "rbd_cluster"
5107  },
5108  "jsonrpc": "2.0",
5109  "method": "bdev_rbd_create",
5110  "id": 1
5111}
5112~~
5113
5114Example response:
5115
5116~~
5117response:
5118{
5119  "jsonrpc": "2.0",
5120  "id": 1,
5121  "result": "Ceph0"
5122}
5123~~
5124
5125### bdev_rbd_delete {#rpc_bdev_rbd_delete}
5126
5127Delete @ref bdev_config_rbd bdev
5128
5129This method is available only if SPDK was build with Ceph RBD support.
5130
5131#### Result
5132
5133`true` if bdev with provided name was deleted or `false` otherwise.
5134
5135#### Parameters
5136
5137Name                    | Optional | Type        | Description
5138----------------------- | -------- | ----------- | -----------
5139name                    | Required | string      | Bdev name
5140
5141#### Example
5142
5143Example request:
5144
5145~~~json
5146{
5147  "params": {
5148    "name": "Rbd0"
5149  },
5150  "jsonrpc": "2.0",
5151  "method": "bdev_rbd_delete",
5152  "id": 1
5153}
5154~~~
5155
5156Example response:
5157
5158~~~json
5159{
5160  "jsonrpc": "2.0",
5161  "id": 1,
5162  "result": true
5163}
5164~~~
5165
5166### bdev_rbd_resize {#rpc_bdev_rbd_resize}
5167
5168Resize @ref bdev_config_rbd bdev
5169
5170This method is available only if SPDK was build with Ceph RBD support.
5171
5172#### Result
5173
5174`true` if bdev with provided name was resized or `false` otherwise.
5175
5176#### Parameters
5177
5178Name                    | Optional | Type        | Description
5179----------------------- | -------- | ----------- | -----------
5180name                    | Required | string      | Bdev name
5181new_size                | Required | int         | New bdev size for resize operation in MiB
5182
5183#### Example
5184
5185Example request:
5186
5187~~~json
5188{
5189  "params": {
5190    "name": "Rbd0"
5191    "new_size": "4096"
5192  },
5193  "jsonrpc": "2.0",
5194  "method": "bdev_rbd_resize",
5195  "id": 1
5196}
5197~~~
5198
5199Example response:
5200
5201~~~json
5202{
5203  "jsonrpc": "2.0",
5204  "id": 1,
5205  "result": true
5206}
5207~~~
5208
5209### bdev_delay_create {#rpc_bdev_delay_create}
5210
5211Create delay bdev. This bdev type redirects all IO to it's base bdev and inserts a delay on the completion
5212path to create an artificial drive latency. All latency values supplied to this bdev should be in microseconds.
5213
5214#### Parameters
5215
5216Name                    | Optional | Type        | Description
5217----------------------- | -------- | ----------- | -----------
5218name                    | Required | string      | Bdev name
5219base_bdev_name          | Required | string      | Base bdev name
5220avg_read_latency        | Required | number      | average read latency (us)
5221p99_read_latency        | Required | number      | p99 read latency (us)
5222avg_write_latency       | Required | number      | average write latency (us)
5223p99_write_latency       | Required | number      | p99 write latency (us)
5224
5225#### Result
5226
5227Name of newly created bdev.
5228
5229#### Example
5230
5231Example request:
5232
5233~~~json
5234{
5235  "params": {
5236    "base_bdev_name": "Null0",
5237    "name": "Delay0",
5238    "avg_read_latency": "15",
5239    "p99_read_latency": "50",
5240    "avg_write_latency": "40",
5241    "p99_write_latency": "110",
5242  },
5243  "jsonrpc": "2.0",
5244  "method": "bdev_delay_create",
5245  "id": 1
5246}
5247~~~
5248
5249Example response:
5250
5251~~~json
5252{
5253  "jsonrpc": "2.0",
5254  "id": 1,
5255  "result": "Delay0"
5256}
5257~~~
5258
5259### bdev_delay_delete {#rpc_bdev_delay_delete}
5260
5261Delete delay bdev.
5262
5263#### Parameters
5264
5265Name                    | Optional | Type        | Description
5266----------------------- | -------- | ----------- | -----------
5267name                    | Required | string      | Bdev name
5268
5269#### Example
5270
5271Example request:
5272
5273~~~json
5274{
5275  "params": {
5276    "name": "Delay0"
5277  },
5278  "jsonrpc": "2.0",
5279  "method": "bdev_delay_delete",
5280  "id": 1
5281}
5282
5283~~~
5284
5285Example response:
5286
5287~~~json
5288{
5289  "jsonrpc": "2.0",
5290  "id": 1,
5291  "result": true
5292}
5293~~~
5294
5295### bdev_delay_update_latency {#rpc_bdev_delay_update_latency}
5296
5297Update a target latency value associated with a given delay bdev. Any currently
5298outstanding I/O will be completed with the old latency.
5299
5300#### Parameters
5301
5302Name                    | Optional | Type        | Description
5303----------------------- | -------- | ----------- | -----------
5304delay_bdev_name         | Required | string      | Name of the delay bdev
5305latency_type            | Required | string      | One of: avg_read, avg_write, p99_read, p99_write
5306latency_us              | Required | number      | The new latency value in microseconds
5307
5308#### Result
5309
5310Name of newly created bdev.
5311
5312#### Example
5313
5314Example request:
5315
5316~~~json
5317{
5318  "params": {
5319    "delay_bdev_name": "Delay0",
5320    "latency_type": "avg_read",
5321    "latency_us": "100",
5322  },
5323  "jsonrpc": "2.0",
5324  "method": "bdev_delay_update_latency",
5325  "id": 1
5326}
5327~~~
5328
5329Example response:
5330
5331~~~json
5332{
5333  "result": "true"
5334}
5335~~~
5336
5337### bdev_error_create {#rpc_bdev_error_create}
5338
5339Construct error bdev.
5340
5341#### Parameters
5342
5343Name                    | Optional | Type        | Description
5344----------------------- | -------- | ----------- | -----------
5345base_name               | Required | string      | Base bdev name
5346uuid                    | Optional | string      | UUID for this bdev
5347
5348#### Example
5349
5350Example request:
5351
5352~~~json
5353{
5354  "params": {
5355    "base_name": "Malloc0"
5356  },
5357  "jsonrpc": "2.0",
5358  "method": "bdev_error_create",
5359  "id": 1
5360}
5361~~~
5362
5363Example response:
5364
5365~~~json
5366{
5367  "jsonrpc": "2.0",
5368  "id": 1,
5369  "result": true
5370}
5371~~~
5372
5373### bdev_error_delete {#rpc_bdev_error_delete}
5374
5375Delete error bdev
5376
5377#### Result
5378
5379`true` if bdev with provided name was deleted or `false` otherwise.
5380
5381#### Parameters
5382
5383Name                    | Optional | Type        | Description
5384----------------------- | -------- | ----------- | -----------
5385name                    | Required | string      | Error bdev name
5386
5387#### Example
5388
5389Example request:
5390
5391~~~json
5392{
5393  "params": {
5394    "name": "EE_Malloc0"
5395  },
5396  "jsonrpc": "2.0",
5397  "method": "bdev_error_delete",
5398  "id": 1
5399}
5400~~~
5401
5402Example response:
5403
5404~~~json
5405{
5406  "jsonrpc": "2.0",
5407  "id": 1,
5408  "result": true
5409}
5410~~~
5411
5412### bdev_error_inject_error {#rpc_bdev_error_inject_error}
5413
5414Inject an error via an error bdev. Create an error bdev on base bdev first. Default 'num'
5415value is 1 and if 'num' is set to zero, the specified injection is disabled.
5416
5417#### Parameters
5418
5419Name                    | Optional | Type        | Description
5420----------------------- | -------- | ----------- | -----------
5421name                    | Required | string      | Name of the error injection bdev
5422io_type                 | Required | string      | io type 'clear' 'read' 'write' 'unmap' 'flush' 'all'
5423error_type              | Required | string      | error type 'failure' 'pending' 'corrupt_data'
5424num                     | Optional | int         | the number of commands you want to fail.(default:1)
5425corrupt_offset          | Optional | int         | the offset in bytes to xor with corrupt_value
5426corrupt_value           | Optional | int         | the value for xor (1-255, 0 is invalid)
5427
5428#### Example
5429
5430Example request:
5431
5432~~~json
5433{
5434  "jsonrpc": "2.0",
5435  "method": "bdev_error_inject_error",
5436  "id": 1,
5437  "params": {
5438    "name": "EE_Malloc0",
5439    "io_type": "write",
5440    "error_type": "pending",
5441    "num": 1
5442  }
5443}
5444~~~
5445
5446Example response:
5447
5448~~~json
5449{
5450  "jsonrpc": "2.0",
5451  "id": 1,
5452  "result": true
5453}
5454~~~
5455
5456### bdev_iscsi_set_options {#rpc_bdev_iscsi_set_options}
5457
5458This RPC can be called at any time, but the new value will only take effect for new iSCSI bdevs.
5459
5460#### Parameters
5461
5462Name                       | Optional | Type        | Description
5463-------------------------- | -------- | ----------- | -----------
5464timeout_sec                | Optional | number      | Timeout for command, in seconds, if 0, don't track timeout
5465
5466#### Example
5467
5468Example request:
5469
5470~~~json
5471request:
5472{
5473  "params": {
5474    "timeout_sec": 30
5475  },
5476  "jsonrpc": "2.0",
5477  "method": "bdev_iscsi_set_options",
5478  "id": 1
5479}
5480~~~
5481
5482Example response:
5483
5484~~~json
5485{
5486  "jsonrpc": "2.0",
5487  "id": 1,
5488  "result": true
5489}
5490~~~
5491
5492### bdev_iscsi_create {#rpc_bdev_iscsi_create}
5493
5494Connect to iSCSI target and create bdev backed by this connection.
5495
5496This method is available only if SPDK was build with iSCSI initiator support.
5497
5498#### Parameters
5499
5500Name                    | Optional | Type        | Description
5501----------------------- | -------- | ----------- | -----------
5502name                    | Required | string      | Bdev name
5503initiator_iqn           | Required | string      | IQN name used during connection
5504url                     | Required | string      | iSCSI resource URI
5505
5506#### Result
5507
5508Name of newly created bdev.
5509
5510#### Example
5511
5512Example request:
5513
5514~~~json
5515{
5516  "params": {
5517    "url": "iscsi://127.0.0.1/iqn.2016-06.io.spdk:disk1/0",
5518    "initiator_iqn": "iqn.2016-06.io.spdk:init",
5519    "name": "iSCSI0"
5520  },
5521  "jsonrpc": "2.0",
5522  "method": "bdev_iscsi_create",
5523  "id": 1
5524}
5525~~~
5526
5527Example response:
5528
5529~~~json
5530{
5531  "jsonrpc": "2.0",
5532  "id": 1,
5533  "result": "iSCSI0"
5534}
5535~~~
5536
5537### bdev_iscsi_delete {#rpc_bdev_iscsi_delete}
5538
5539Delete iSCSI bdev and terminate connection to target.
5540
5541This method is available only if SPDK was built with iSCSI initiator support.
5542
5543#### Parameters
5544
5545Name                    | Optional | Type        | Description
5546----------------------- | -------- | ----------- | -----------
5547name                    | Required | string      | Bdev name
5548
5549#### Example
5550
5551Example request:
5552
5553~~~json
5554{
5555  "params": {
5556    "name": "iSCSI0"
5557  },
5558  "jsonrpc": "2.0",
5559  "method": "bdev_iscsi_delete",
5560  "id": 1
5561}
5562~~~
5563
5564Example response:
5565
5566~~~json
5567{
5568  "jsonrpc": "2.0",
5569  "id": 1,
5570  "result": true
5571}
5572~~~
5573
5574### bdev_ftl_create {#rpc_bdev_ftl_create}
5575
5576Create FTL bdev.
5577
5578This RPC is subject to change.
5579
5580#### Parameters
5581
5582Name                    | Optional | Type        | Description
5583----------------------- | -------- | ----------- | -----------
5584name                    | Required | string      | Bdev name
5585base_bdev               | Required | string      | Name of the base device
5586cache                   | Required | string      | Name of the cache device
5587uuid                    | Optional | string      | UUID of restored bdev (not applicable when creating new instance)
5588core_mask               | Optional | string      | CPU core(s) possible for placement of the ftl core thread, application main thread by default
5589overprovisioning        | Optional | int         | Percentage of base device used for relocation, 20% by default
5590fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data on target application shutdown and rely on shared memory during next load
5591
5592#### Result
5593
5594Name of newly created bdev.
5595
5596#### Example
5597
5598Example request:
5599
5600~~~json
5601{
5602  "params": {
5603    "name": "ftl0",
5604    "base_bdev": "nvme0n1",
5605    "cache": "nvme1n1",
5606    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3",
5607    "core_mask": "[0]",
5608    "overprovisioning": 10
5609  },
5610  "jsonrpc": "2.0",
5611  "method": "bdev_ftl_create",
5612  "id": 1
5613}
5614~~~
5615
5616Example response:
5617
5618~~~json
5619{
5620  "jsonrpc": "2.0",
5621  "id": 1,
5622  "result": {
5623      "name" : "ftl0"
5624      "uuid" : "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
5625  }
5626}
5627~~~
5628
5629### bdev_ftl_load {#rpc_bdev_ftl_load}
5630
5631Loads FTL bdev.
5632
5633This RPC is subject to change.
5634
5635#### Parameters
5636
5637Name                    | Optional | Type        | Description
5638----------------------- | -------- | ----------- | -----------
5639name                    | Required | string      | Bdev name
5640base_bdev               | Required | string      | Name of the base device
5641cache                   | Required | string      | Name of the cache device
5642uuid                    | Required | string      | UUID of restored bdev
5643core_mask               | Optional | string      | CPU core(s) possible for placement of the ftl core thread, application main thread by default
5644overprovisioning        | Optional | int         | Percentage of base device used for relocation, 20% by default
5645fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data on target application shutdown and rely on shared memory during next load
5646
5647#### Result
5648
5649Name of loaded bdev.
5650
5651#### Example
5652
5653Example request:
5654
5655~~~json
5656{
5657  "params": {
5658    "name": "ftl0",
5659    "base_bdev": "nvme0n1",
5660    "cache": "nvme1n1",
5661    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3",
5662    "core_mask": "[0]",
5663    "overprovisioning": 10
5664  },
5665  "jsonrpc": "2.0",
5666  "method": "bdev_ftl_load",
5667  "id": 1
5668}
5669~~~
5670
5671Example response:
5672
5673~~~json
5674{
5675  "jsonrpc": "2.0",
5676  "id": 1,
5677  "result": {
5678      "name" : "ftl0"
5679      "uuid" : "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
5680  }
5681}
5682~~~
5683
5684### bdev_ftl_delete {#rpc_bdev_ftl_delete}
5685
5686Delete FTL bdev.
5687
5688This RPC is subject to change.
5689
5690#### Parameters
5691
5692Name                    | Optional | Type        | Description
5693----------------------- | -------- | ----------- | -----------
5694name                    | Required | string      | Bdev name
5695fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data during deletion and rely on shared memory during next load
5696
5697#### Example
5698
5699Example request:
5700
5701~~~json
5702{
5703  "params": {
5704    "name": "ftl0"
5705  },
5706  "jsonrpc": "2.0",
5707  "method": "bdev_ftl_delete",
5708  "id": 1
5709}
5710~~~
5711
5712Example response:
5713
5714~~~json
5715{
5716  "jsonrpc": "2.0",
5717  "id": 1,
5718  "result": true
5719}
5720~~~
5721
5722### bdev_ftl_unload {#rpc_bdev_ftl_unload}
5723
5724Unloads FTL bdev.
5725
5726This RPC is subject to change.
5727
5728#### Parameters
5729
5730Name                    | Optional | Type        | Description
5731----------------------- | -------- | ----------- | -----------
5732name                    | Required | string      | Bdev name
5733fast_shutdown           | Optional | bool        | When set FTL will minimize persisted data during deletion and rely on shared memory during next load
5734
5735#### Example
5736
5737Example request:
5738
5739~~~json
5740{
5741  "params": {
5742    "name": "ftl0"
5743  },
5744  "jsonrpc": "2.0",
5745  "method": "bdev_ftl_unload",
5746  "id": 1
5747}
5748~~~
5749
5750Example response:
5751
5752~~~json
5753{
5754  "jsonrpc": "2.0",
5755  "id": 1,
5756  "result": true
5757}
5758~~~
5759
5760### bdev_ftl_unmap {#rpc_bdev_ftl_unmap}
5761
5762Unmap range of LBAs.
5763
5764This RPC is subject to change.
5765
5766#### Parameters
5767
5768Name                    | Optional | Type        | Description
5769----------------------- | -------- | ----------- | -----------
5770name                    | Required | string      | Bdev name
5771lba                     | Required | number      | start lba, aligned to 1024
5772num_blocks              | Required | number      | number of blocks, aligned to 1024
5773
5774#### Example
5775
5776Example request:
5777
5778~~~json
5779{
5780  "params": {
5781    "name": "ftl0"
5782    "lba": "0"
5783    "num_blocks": "1024"
5784  },
5785  "jsonrpc": "2.0",
5786  "method": "bdev_ftl_unmap",
5787  "id": 1
5788}
5789~~~
5790
5791Example response:
5792
5793~~~json
5794{
5795  "jsonrpc": "2.0",
5796  "id": 1,
5797  "result": true
5798}
5799~~~
5800
5801### bdev_ftl_get_stats {#rpc_bdev_ftl_get_stats}
5802
5803Get IO statistics for FTL bdev
5804
5805This RPC is subject to change.
5806
5807#### Parameters
5808
5809Name                    | Optional | Type        | Description
5810----------------------- | -------- | ----------- | -----------
5811name                    | Required | string      | Bdev name
5812
5813#### Response
5814
5815The response is an object containing IO statistics for an FTL instance, split into multiple subobjects:
5816
5817- `user` - contains information about number of IOs, and errors for any incoming requests,
5818- `cmp` - information about IO for the compaction process,
5819- `gc` - information about IO for the garbage collection process,
5820- `md_base` - internal metadata requests to the base FTL device,
5821- `md_nv_cache` - internal metadata requests to the cache device,
5822- `l2p` - requests done on the L2P cache region.
5823
5824Each subobject contains the following information:
5825
5826- `ios` - describes the total number of IOs requested,
5827- `blocks` - the total number of requested blocks,
5828- `errors` - describes the number of detected errors for a given operation, with the following distinctions:
5829  - `media` - media errors,
5830  - `crc` - mismatch in calculated CRC versus saved checksum in the metadata,
5831  - `other` - any other errors.
5832
5833#### Example
5834
5835Example request:
5836
5837~~~json
5838{
5839  "params": {
5840    "name": "ftl0"
5841  },
5842  "jsonrpc": "2.0",
5843  "method": "bdev_ftl_get_stats",
5844  "id": 1
5845}
5846~~~
5847
5848Example response:
5849
5850~~~json
5851{
5852  "jsonrpc": "2.0",
5853  "id": 1,
5854  "result": {
5855      "name": "ftl0",
5856      "user": {
5857        "read": {
5858          "ios": 0,
5859          "blocks": 0,
5860          "errors": {
5861            "media": 0,
5862            "crc": 0,
5863            "other": 0
5864          }
5865        },
5866        "write": {
5867          "ios": 318707,
5868          "blocks": 318707,
5869          "errors": {
5870            "media": 0,
5871            "other": 0
5872          }
5873        }
5874      },
5875      "cmp": {
5876        "read": {
5877          "ios": 0,
5878          "blocks": 0,
5879          "errors": {
5880            "media": 0,
5881            "crc": 0,
5882            "other": 0
5883          }
5884        },
5885        "write": {
5886          "ios": 0,
5887          "blocks": 0,
5888          "errors": {
5889            "media": 0,
5890            "other": 0
5891          }
5892        }
5893      },
5894      "gc": {
5895        "read": {
5896          "ios": 0,
5897          "blocks": 0,
5898          "errors": {
5899            "media": 0,
5900            "crc": 0,
5901            "other": 0
5902          }
5903        },
5904        "write": {
5905          "ios": 0,
5906          "blocks": 0,
5907          "errors": {
5908            "media": 0,
5909            "other": 0
5910          }
5911        }
5912      },
5913      "md_base": {
5914        "read": {
5915          "ios": 0,
5916          "blocks": 0,
5917          "errors": {
5918            "media": 0,
5919            "crc": 0,
5920            "other": 0
5921          }
5922        },
5923        "write": {
5924          "ios": 1,
5925          "blocks": 32,
5926          "errors": {
5927            "media": 0,
5928            "other": 0
5929          }
5930        }
5931      },
5932      "md_nv_cache": {
5933        "read": {
5934          "ios": 0,
5935          "blocks": 0,
5936          "errors": {
5937            "media": 0,
5938            "crc": 0,
5939            "other": 0
5940          }
5941        },
5942        "write": {
5943          "ios": 1064,
5944          "blocks": 1073896,
5945          "errors": {
5946            "media": 0,
5947            "other": 0
5948          }
5949        }
5950      },
5951      "l2p": {
5952        "read": {
5953          "ios": 240659,
5954          "blocks": 240659,
5955          "errors": {
5956            "media": 0,
5957            "crc": 0,
5958            "other": 0
5959          }
5960        },
5961        "write": {
5962          "ios": 235745,
5963          "blocks": 235745,
5964          "errors": {
5965            "media": 0,
5966            "other": 0
5967          }
5968        }
5969      }
5970    }
5971}
5972~~~
5973
5974### bdev_passthru_create {#rpc_bdev_passthru_create}
5975
5976Create passthru bdev. This bdev type redirects all IO to it's base bdev. It has no other purpose than being an example
5977and a starting point in development of new bdev type.
5978
5979#### Parameters
5980
5981Name                    | Optional | Type        | Description
5982----------------------- | -------- | ----------- | -----------
5983name                    | Required | string      | Bdev name
5984base_bdev_name          | Required | string      | Base bdev name
5985
5986#### Result
5987
5988Name of newly created bdev.
5989
5990#### Example
5991
5992Example request:
5993
5994~~~json
5995{
5996  "params": {
5997    "base_bdev_name": "Malloc0",
5998    "name": "Passsthru0"
5999  },
6000  "jsonrpc": "2.0",
6001  "method": "bdev_passthru_create",
6002  "id": 1
6003}
6004~~~
6005
6006Example response:
6007
6008~~~json
6009{
6010  "jsonrpc": "2.0",
6011  "id": 1,
6012  "result": "Passsthru0"
6013}
6014~~~
6015
6016### bdev_passthru_delete {#rpc_bdev_passthru_delete}
6017
6018Delete passthru bdev.
6019
6020#### Parameters
6021
6022Name                    | Optional | Type        | Description
6023----------------------- | -------- | ----------- | -----------
6024name                    | Required | string      | Bdev name
6025
6026#### Example
6027
6028Example request:
6029
6030~~~json
6031{
6032  "params": {
6033    "name": "Passsthru0"
6034  },
6035  "jsonrpc": "2.0",
6036  "method": "bdev_passthru_delete",
6037  "id": 1
6038}
6039
6040~~~
6041
6042Example response:
6043
6044~~~json
6045{
6046  "jsonrpc": "2.0",
6047  "id": 1,
6048  "result": true
6049}
6050~~~
6051
6052### bdev_xnvme_create {#rpc_bdev_xnvme_create}
6053
6054Create xnvme bdev. This bdev type redirects all IO to its underlying backend.
6055
6056#### Parameters
6057
6058Name                    | Optional | Type        | Description
6059----------------------- | -------- | ----------- | -----------
6060name                    | Required | string      | name of xNVMe bdev to create
6061filename                | Required | string      | path to device or file (ex: /dev/nvme0n1)
6062io_mechanism            | Required | string      | IO mechanism to use (ex: libaio, io_uring, io_uring_cmd, etc.)
6063conserve_cpu            | Optional | boolean     | Whether or not to conserve CPU when polling (default: false)
6064
6065#### Result
6066
6067Name of newly created bdev.
6068
6069#### Example
6070
6071Example request:
6072
6073~~~json
6074{
6075  "jsonrpc": "2.0",
6076  "method": "bdev_xnvme_create",
6077  "id": 1,
6078  "params": {
6079    "name": "bdev_ng0n1",
6080    "filename": "/dev/ng0n1",
6081    "io_mechanism": "io_uring_cmd",
6082    "conserve_cpu": false,
6083  }
6084}
6085~~~
6086
6087Example response:
6088
6089~~~json
6090{
6091  "jsonrpc": "2.0",
6092  "id": 1,
6093  "result": "bdev_ng0n1"
6094}
6095~~~
6096
6097### bdev_xnvme_delete {#rpc_bdev_xnvme_delete}
6098
6099Delete xnvme bdev.
6100
6101#### Parameters
6102
6103Name                    | Optional | Type        | Description
6104----------------------- | -------- | ----------- | -----------
6105name                    | Required | string      | name of xnvme bdev to delete
6106
6107#### Example
6108
6109Example request:
6110
6111~~~json
6112{
6113  "params": {
6114    "name": "bdev_ng0n1"
6115  },
6116  "jsonrpc": "2.0",
6117  "method": "bdev_xnvme_delete",
6118  "id": 1
6119}
6120
6121~~~
6122
6123Example response:
6124
6125~~~json
6126{
6127  "jsonrpc": "2.0",
6128  "id": 1,
6129  "result": true
6130}
6131~~~
6132
6133### bdev_virtio_attach_controller {#rpc_bdev_virtio_attach_controller}
6134
6135Create new initiator @ref bdev_config_virtio_scsi or @ref bdev_config_virtio_blk and expose all found bdevs.
6136
6137#### Parameters
6138
6139Name                    | Optional | Type        | Description
6140----------------------- | -------- | ----------- | -----------
6141name                    | Required | string      | Virtio SCSI base bdev name or Virtio Blk bdev name
6142trtype                  | Required | string      | Virtio target trtype: pci or user
6143traddr                  | Required | string      | target address: BDF or UNIX socket file path
6144dev_type                | Required | string      | Virtio device type: blk or scsi
6145vq_count                | Optional | number      | Number of queues this controller will utilize (default: 1)
6146vq_size                 | Optional | number      | Size of each queue. Must be power of 2. (default: 512)
6147
6148In case of Virtio SCSI the `name` parameter will be base name for new created bdevs. For Virtio Blk `name` will be the
6149name of created bdev.
6150
6151`vq_count` and `vq_size` parameters are valid only if `trtype` is `user`.
6152
6153#### Result
6154
6155Array of names of newly created bdevs.
6156
6157#### Example
6158
6159Example request:
6160
6161~~~json
6162{
6163  "params": {
6164    "name": "VirtioScsi0",
6165    "trtype": "user",
6166    "vq_size": 128,
6167    "dev_type": "scsi",
6168    "traddr": "/tmp/VhostScsi0",
6169    "vq_count": 4
6170  },
6171  "jsonrpc": "2.0",
6172  "method": "bdev_virtio_attach_controller",
6173  "id": 1
6174}
6175~~~
6176
6177Example response:
6178
6179~~~json
6180{
6181  "jsonrpc": "2.0",
6182  "id": 1,
6183  "result": ["VirtioScsi0t2", "VirtioScsi0t4"]
6184}
6185~~~
6186
6187### bdev_virtio_scsi_get_devices {#rpc_bdev_virtio_scsi_get_devices}
6188
6189Show information about all available Virtio SCSI devices.
6190
6191#### Parameters
6192
6193This method has no parameters.
6194
6195#### Result
6196
6197Array of Virtio SCSI information objects.
6198
6199#### Example
6200
6201Example request:
6202
6203~~~json
6204{
6205  "jsonrpc": "2.0",
6206  "method": "bdev_virtio_scsi_get_devices",
6207  "id": 1
6208}
6209~~~
6210
6211Example response:
6212
6213~~~json
6214{
6215  "jsonrpc": "2.0",
6216  "id": 1,
6217  "result": [
6218    {
6219      "name": "VirtioScsi0",
6220      "virtio": {
6221          "vq_size": 128,
6222          "vq_count": 4,
6223          "type": "user",
6224          "socket": "/tmp/VhostScsi0"
6225      }
6226    }
6227  ]
6228}
6229~~~
6230
6231### bdev_virtio_detach_controller {#rpc_bdev_virtio_detach_controller}
6232
6233Remove a Virtio device. This command can be used to remove any type of virtio device.
6234
6235#### Parameters
6236
6237Name                    | Optional | Type        | Description
6238----------------------- | -------- | ----------- | -----------
6239name                    | Required | string      | Virtio name
6240
6241#### Example
6242
6243Example request:
6244
6245~~~json
6246{
6247  "params": {
6248    "name": "VirtioUser0"
6249  },
6250  "jsonrpc": "2.0",
6251  "method": "bdev_virtio_detach_controller",
6252  "id": 1
6253}
6254
6255~~~
6256
6257Example response:
6258
6259~~~json
6260{
6261  "jsonrpc": "2.0",
6262  "id": 1,
6263  "result": true
6264}
6265~~~
6266
6267### bdev_virtio_blk_set_hotplug {#rpc_bdev_virtio_blk_set_hotplug}
6268
6269Enable/Disable the virtio blk hotplug monitor or change the monitor period time
6270
6271#### Parameters
6272
6273Name                    | Optional | Type        | Description
6274----------------------- | -------- | ----------- | -----------
6275enable                  | Required | bool        | Enable or disable the virtio blk hotplug monitor
6276period-us               | Optional | number      | The period time of the monitor
6277
6278When the enable is true then the period-us is optional. If user don't set the period time then use the default
6279value. When the enable is false then the period-us is not required.
6280
6281#### Result
6282
6283True the rpc is successful otherwise false
6284
6285#### Example
6286
6287Example request:
6288
6289~~~json
6290{
6291  "params": {
6292    "enable": "true",
6293    "period-us": "1000000"
6294  },
6295  "jsonrpc": "2.0",
6296  "method": "bdev_virtio_blk_set_hotplug",
6297  "id": 1
6298}
6299~~~
6300
6301Example response:
6302
6303~~~json
6304{
6305  "jsonrpc": "2.0",
6306  "id": 1,
6307  "result": true
6308}
6309~~~
6310
6311## iSCSI Target {#jsonrpc_components_iscsi_tgt}
6312
6313### iscsi_set_options method {#rpc_iscsi_set_options}
6314
6315Set global parameters for iSCSI targets.
6316
6317This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once.
6318
6319#### Parameters
6320
6321Name                            | Optional | Type    | Description
6322------------------------------- | -------- | ------- | -----------
6323auth_file                       | Optional | string  | Path to CHAP shared secret file (default: "")
6324node_base                       | Optional | string  | Prefix of the name of iSCSI target node (default: "iqn.2016-06.io.spdk")
6325nop_timeout                     | Optional | number  | Timeout in seconds to nop-in request to the initiator (default: 60)
6326nop_in_interval                 | Optional | number  | Time interval in secs between nop-in requests by the target (default: 30)
6327disable_chap                    | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
6328require_chap                    | Optional | boolean | CHAP for discovery session should be required (default: `false`)
6329mutual_chap                     | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
6330chap_group                      | Optional | number  | CHAP group ID for discovery session (default: 0)
6331max_sessions                    | Optional | number  | Maximum number of sessions in the host (default: 128)
6332max_queue_depth                 | Optional | number  | Maximum number of outstanding I/Os per queue (default: 64)
6333max_connections_per_session     | Optional | number  | Session specific parameter, MaxConnections (default: 2)
6334default_time2wait               | Optional | number  | Session specific parameter, DefaultTime2Wait (default: 2)
6335default_time2retain             | Optional | number  | Session specific parameter, DefaultTime2Retain (default: 20)
6336first_burst_length              | Optional | number  | Session specific parameter, FirstBurstLength (default: 8192)
6337immediate_data                  | Optional | boolean | Session specific parameter, ImmediateData (default: `true`)
6338error_recovery_level            | Optional | number  | Session specific parameter, ErrorRecoveryLevel (default: 0)
6339allow_duplicated_isid           | Optional | boolean | Allow duplicated initiator session ID (default: `false`)
6340max_large_datain_per_connection | Optional | number  | Max number of outstanding split read I/Os per connection (default: 64)
6341max_r2t_per_connection          | Optional | number  | Max number of outstanding R2Ts per connection (default: 4)
6342pdu_pool_size                   | Optional | number  | Number of PDUs in the pool (default: approximately 2 * max_sessions * (max_queue_depth + max_connections_per_session))
6343immediate_data_pool_size        | Optional | number  | Number of immediate data buffers in the pool (default: 128 * max_sessions)
6344data_out_pool_size              | Optional | number  | Number of data out buffers in the pool (default: 16 * max_sessions)
6345
6346To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.
6347
6348Parameters `disable_chap` and `require_chap` are mutually exclusive. Parameters `no_discovery_auth`, `req_discovery_auth`,
6349`req_discovery_auth_mutual`, and `discovery_auth_group` are still available instead of `disable_chap`, `require_chap`,
6350`mutual_chap`, and `chap_group`, respectivey but will be removed in future releases.
6351
6352#### Example
6353
6354Example request:
6355
6356~~~json
6357{
6358  "params": {
6359    "allow_duplicated_isid": true,
6360    "default_time2retain": 60,
6361    "first_burst_length": 8192,
6362    "immediate_data": true,
6363    "node_base": "iqn.2016-06.io.spdk",
6364    "max_sessions": 128,
6365    "nop_timeout": 30,
6366    "nop_in_interval": 30,
6367    "auth_file": "/usr/local/etc/spdk/auth.conf",
6368    "disable_chap": true,
6369    "default_time2wait": 2
6370  },
6371  "jsonrpc": "2.0",
6372  "method": "iscsi_set_options",
6373  "id": 1
6374}
6375~~~
6376
6377Example response:
6378
6379~~~json
6380{
6381  "jsonrpc": "2.0",
6382  "id": 1,
6383  "result": true
6384}
6385~~~
6386
6387### iscsi_get_options method {#rpc_iscsi_get_options}
6388
6389Show global parameters of iSCSI targets.
6390
6391#### Parameters
6392
6393This method has no parameters.
6394
6395#### Example
6396
6397Example request:
6398
6399~~~json
6400request:
6401{
6402  "jsonrpc": "2.0",
6403  "method": "iscsi_get_options",
6404  "id": 1
6405}
6406~~~
6407
6408Example response:
6409
6410~~~json
6411{
6412  "jsonrpc": "2.0",
6413  "id": 1,
6414  "result": {
6415    "allow_duplicated_isid": true,
6416    "default_time2retain": 60,
6417    "first_burst_length": 8192,
6418    "immediate_data": true,
6419    "node_base": "iqn.2016-06.io.spdk",
6420    "mutual_chap": false,
6421    "nop_in_interval": 30,
6422    "chap_group": 0,
6423    "max_connections_per_session": 2,
6424    "max_queue_depth": 64,
6425    "nop_timeout": 30,
6426    "max_sessions": 128,
6427    "error_recovery_level": 0,
6428    "auth_file": "/usr/local/etc/spdk/auth.conf",
6429    "disable_chap": true,
6430    "default_time2wait": 2,
6431    "require_chap": false,
6432    "max_large_datain_per_connection": 64,
6433    "max_r2t_per_connection": 4
6434  }
6435}
6436~~~
6437
6438### scsi_get_devices {#rpc_scsi_get_devices}
6439
6440Display SCSI devices
6441
6442#### Parameters
6443
6444This method has no parameters.
6445
6446#### Example
6447
6448Example request:
6449
6450~~~json
6451{
6452  "jsonrpc": "2.0",
6453  "method": "scsi_get_devices",
6454  "id": 1
6455}
6456~~~
6457
6458Example response:
6459
6460~~~json
6461{
6462  "jsonrpc": "2.0",
6463  "id": 1,
6464  "result": [
6465    {
6466      "id": 0,
6467      "device_name": "iqn.2016-06.io.spdk:Target3"
6468    }
6469  ]
6470}
6471~~~
6472
6473### iscsi_set_discovery_auth method {#rpc_iscsi_set_discovery_auth}
6474
6475Set CHAP authentication for sessions dynamically.
6476
6477#### Parameters
6478
6479Name                        | Optional | Type    | Description
6480--------------------------- | -------- | --------| -----------
6481disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
6482require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
6483mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
6484chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
6485
6486Parameters `disable_chap` and `require_chap` are mutually exclusive.
6487
6488#### Example
6489
6490Example request:
6491
6492~~~json
6493request:
6494{
6495  "params": {
6496    "chap_group": 1,
6497    "require_chap": true,
6498    "mutual_chap": true
6499  },
6500  "jsonrpc": "2.0",
6501  "method": "iscsi_set_discovery_auth",
6502  "id": 1
6503}
6504~~~
6505
6506Example response:
6507
6508~~~json
6509{
6510  "jsonrpc": "2.0",
6511  "id": 1,
6512  "result": true
6513}
6514~~~
6515
6516### iscsi_create_auth_group method {#rpc_iscsi_create_auth_group}
6517
6518Create an authentication group for CHAP authentication.
6519
6520#### Parameters
6521
6522Name                        | Optional | Type    | Description
6523--------------------------- | -------- | --------| -----------
6524tag                         | Required | number  | Authentication group tag (unique, integer > 0)
6525secrets                     | Optional | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
6526
6527#### secret {#rpc_iscsi_create_auth_group_secret}
6528
6529Name                        | Optional | Type    | Description
6530--------------------------- | ---------| --------| -----------
6531user                        | Required | string  | Unidirectional CHAP name
6532secret                      | Required | string  | Unidirectional CHAP secret
6533muser                       | Optional | string  | Bidirectional CHAP name
6534msecret                     | Optional | string  | Bidirectional CHAP secret
6535
6536#### Example
6537
6538Example request:
6539
6540~~~json
6541{
6542  "params": {
6543    "secrets": [
6544      {
6545        "muser": "mu1",
6546        "secret": "s1",
6547        "user": "u1",
6548        "msecret": "ms1"
6549      }
6550    ],
6551    "tag": 2
6552  },
6553  "jsonrpc": "2.0",
6554  "method": "iscsi_create_auth_group",
6555  "id": 1
6556}
6557~~~
6558
6559Example response:
6560
6561~~~json
6562{
6563  "jsonrpc": "2.0",
6564  "id": 1,
6565  "result": true
6566}
6567~~~
6568
6569### iscsi_delete_auth_group method {#rpc_iscsi_delete_auth_group}
6570
6571Delete an existing authentication group for CHAP authentication.
6572
6573#### Parameters
6574
6575Name                        | Optional | Type    | Description
6576--------------------------- | -------- | --------| -----------
6577tag                         | Required | number  | Authentication group tag (unique, integer > 0)
6578
6579#### Example
6580
6581Example request:
6582
6583~~~json
6584{
6585  "params": {
6586    "tag": 2
6587  },
6588  "jsonrpc": "2.0",
6589  "method": "iscsi_delete_auth_group",
6590  "id": 1
6591}
6592~~~
6593
6594Example response:
6595
6596~~~json
6597{
6598  "jsonrpc": "2.0",
6599  "id": 1,
6600  "result": true
6601}
6602~~~
6603
6604### iscsi_get_auth_groups {#rpc_iscsi_get_auth_groups}
6605
6606Show information about all existing authentication group for CHAP authentication.
6607
6608#### Parameters
6609
6610This method has no parameters.
6611
6612#### Result
6613
6614Array of objects describing authentication group.
6615
6616Name                        | Type    | Description
6617--------------------------- | --------| -----------
6618tag                         | number  | Authentication group tag
6619secrets                     | array   | Array of @ref rpc_iscsi_create_auth_group_secret objects
6620
6621#### Example
6622
6623Example request:
6624
6625~~~json
6626{
6627  "jsonrpc": "2.0",
6628  "method": "iscsi_get_auth_groups",
6629  "id": 1
6630}
6631~~~
6632
6633Example response:
6634
6635~~~json
6636{
6637  "jsonrpc": "2.0",
6638  "id": 1,
6639  "result": [
6640    {
6641      "secrets": [
6642        {
6643          "muser": "mu1",
6644          "secret": "s1",
6645          "user": "u1",
6646          "msecret": "ms1"
6647        }
6648      ],
6649      "tag": 1
6650    },
6651    {
6652      "secrets": [
6653        {
6654          "secret": "s2",
6655          "user": "u2"
6656        }
6657      ],
6658      "tag": 2
6659    }
6660  ]
6661}
6662~~~
6663
6664### iscsi_auth_group_add_secret {#rpc_iscsi_auth_group_add_secret}
6665
6666Add a secret to an existing authentication group for CHAP authentication.
6667
6668#### Parameters
6669
6670Name                        | Optional | Type    | Description
6671--------------------------- | -------- | --------| -----------
6672tag                         | Required | number  | Authentication group tag (unique, integer > 0)
6673user                        | Required | string  | Unidirectional CHAP name
6674secret                      | Required | string  | Unidirectional CHAP secret
6675muser                       | Optional | string  | Bidirectional CHAP name
6676msecret                     | Optional | string  | Bidirectional CHAP secret
6677
6678#### Example
6679
6680Example request:
6681
6682~~~json
6683{
6684  "params": {
6685    "muser": "mu3",
6686    "secret": "s3",
6687    "tag": 2,
6688    "user": "u3",
6689    "msecret": "ms3"
6690  },
6691  "jsonrpc": "2.0",
6692  "method": "iscsi_auth_group_add_secret",
6693  "id": 1
6694}
6695~~~json
6696
6697Example response:
6698
6699~~~json
6700{
6701  "jsonrpc": "2.0",
6702  "id": 1,
6703  "result": true
6704}
6705~~~
6706
6707### iscsi_auth_group_remove_secret {#rpc_iscsi_auth_group_remove_secret}
6708
6709Remove a secret from an existing authentication group for CHAP authentication.
6710
6711#### Parameters
6712
6713Name                        | Optional | Type    | Description
6714--------------------------- | -------- | --------| -----------
6715tag                         | Required | number  | Authentication group tag (unique, integer > 0)
6716user                        | Required | string  | Unidirectional CHAP name
6717
6718#### Example
6719
6720Example request:
6721
6722~~~json
6723{
6724  "params": {
6725    "tag": 2,
6726    "user": "u3"
6727  },
6728  "jsonrpc": "2.0",
6729  "method": "iscsi_auth_group_remove_secret",
6730  "id": 1
6731}
6732~~~
6733
6734Example response:
6735
6736~~~json
6737{
6738  "jsonrpc": "2.0",
6739  "id": 1,
6740  "result": true
6741}
6742~~~
6743
6744### iscsi_get_initiator_groups method {#rpc_iscsi_get_initiator_groups}
6745
6746Show information about all available initiator groups.
6747
6748#### Parameters
6749
6750This method has no parameters.
6751
6752#### Result
6753
6754Array of objects describing initiator groups.
6755
6756Name                        | Type    | Description
6757--------------------------- | --------| -----------
6758tag                         | number  | Initiator group tag
6759initiators                  | array   | Array of initiator hostnames or IP addresses
6760netmasks                    | array   | Array of initiator netmasks
6761
6762#### Example
6763
6764Example request:
6765
6766~~~json
6767{
6768  "jsonrpc": "2.0",
6769  "method": "iscsi_get_initiator_groups",
6770  "id": 1
6771}
6772~~~
6773
6774Example response:
6775
6776~~~json
6777{
6778  "jsonrpc": "2.0",
6779  "id": 1,
6780  "result": [
6781    {
6782      "initiators": [
6783        "iqn.2016-06.io.spdk:host1",
6784        "iqn.2016-06.io.spdk:host2"
6785      ],
6786      "tag": 1,
6787      "netmasks": [
6788        "192.168.1.0/24"
6789      ]
6790    }
6791  ]
6792}
6793~~~
6794
6795### iscsi_create_initiator_group method {#rpc_iscsi_create_initiator_group}
6796
6797Add an initiator group.
6798
6799#### Parameters
6800
6801Name                        | Optional | Type    | Description
6802--------------------------- | -------- | --------| -----------
6803tag                         | Required | number  | Initiator group tag (unique, integer > 0)
6804initiators                  | Required | array   | Not empty array of initiator hostnames or IP addresses
6805netmasks                    | Required | array   | Not empty array of initiator netmasks
6806
6807#### Example
6808
6809Example request:
6810
6811~~~json
6812{
6813  "params": {
6814    "initiators": [
6815      "iqn.2016-06.io.spdk:host1",
6816      "iqn.2016-06.io.spdk:host2"
6817    ],
6818    "tag": 1,
6819    "netmasks": [
6820      "192.168.1.0/24"
6821    ]
6822  },
6823  "jsonrpc": "2.0",
6824  "method": "iscsi_create_initiator_group",
6825  "id": 1
6826}
6827~~~
6828
6829Example response:
6830
6831~~~json
6832response:
6833{
6834  "jsonrpc": "2.0",
6835  "id": 1,
6836  "result": true
6837}
6838~~~
6839
6840### iscsi_delete_initiator_group method {#rpc_iscsi_delete_initiator_group}
6841
6842Delete an existing initiator group.
6843
6844#### Parameters
6845
6846Name                        | Optional | Type    | Description
6847--------------------------- | -------- | --------| -----------
6848tag                         | Required | number  | Initiator group tag (unique, integer > 0)
6849
6850#### Example
6851
6852Example request:
6853
6854~~~json
6855{
6856  "params": {
6857    "tag": 1
6858  },
6859  "jsonrpc": "2.0",
6860  "method": "iscsi_delete_initiator_group",
6861  "id": 1
6862}
6863~~~
6864
6865Example response:
6866
6867~~~json
6868{
6869  "jsonrpc": "2.0",
6870  "id": 1,
6871  "result": true
6872}
6873~~~
6874
6875### iscsi_initiator_group_add_initiators method {#rpc_iscsi_initiator_group_add_initiators}
6876
6877Add initiators to an existing initiator group.
6878
6879#### Parameters
6880
6881Name                        | Optional | Type    | Description
6882--------------------------- | -------- | --------| -----------
6883tag                         | Required | number  | Existing initiator group tag.
6884initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
6885netmasks                    | Optional | array   | Array of initiator netmasks
6886
6887#### Example
6888
6889Example request:
6890
6891~~~json
6892request:
6893{
6894  "params": {
6895    "initiators": [
6896      "iqn.2016-06.io.spdk:host3"
6897    ],
6898    "tag": 1,
6899    "netmasks": [
6900      "255.255.255.1"
6901    ]
6902  },
6903  "jsonrpc": "2.0",
6904  "method": "iscsi_initiator_group_add_initiators",
6905  "id": 1
6906}
6907~~~
6908
6909Example response:
6910
6911~~~json
6912response:
6913{
6914  "jsonrpc": "2.0",
6915  "id": 1,
6916  "result": true
6917}
6918~~~
6919
6920### iscsi_initiator_group_remove_initiators method {#rpc_iscsi_initiator_group_remove_initiators}
6921
6922Remove initiators from an initiator group.
6923
6924#### Parameters
6925
6926Name                        | Optional | Type    | Description
6927--------------------------- | -------- | --------| -----------
6928tag                         | Required | number  | Existing initiator group tag.
6929initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
6930netmasks                    | Optional | array   | Array of initiator netmasks
6931
6932#### Example
6933
6934Example request:
6935
6936~~~json
6937request:
6938{
6939  "params": {
6940    "initiators": [
6941      "iqn.2016-06.io.spdk:host3"
6942    ],
6943    "tag": 1,
6944    "netmasks": [
6945      "255.255.255.1"
6946    ]
6947  },
6948  "jsonrpc": "2.0",
6949  "method": "iscsi_initiator_group_remove_initiators",
6950  "id": 1
6951}
6952~~~
6953
6954Example response:
6955
6956~~~json
6957response:
6958{
6959  "jsonrpc": "2.0",
6960  "id": 1,
6961  "result": true
6962}
6963~~~
6964
6965### iscsi_get_target_nodes method {#rpc_iscsi_get_target_nodes}
6966
6967Show information about all available iSCSI target nodes.
6968
6969#### Parameters
6970
6971This method has no parameters.
6972
6973#### Result
6974
6975Array of objects describing target node.
6976
6977Name                        | Type    | Description
6978--------------------------- | --------| -----------
6979name                        | string  | Target node name (ASCII)
6980alias_name                  | string  | Target node alias name (ASCII)
6981pg_ig_maps                  | array   | Array of Portal_Group_Tag:Initiator_Group_Tag mappings
6982luns                        | array   | Array of Bdev names to LUN ID mappings
6983queue_depth                 | number  | Target queue depth
6984disable_chap                | boolean | CHAP authentication should be disabled for this target
6985require_chap                | boolean | CHAP authentication should be required for this target
6986mutual_chap                 | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
6987chap_group                  | number  | Authentication group ID for this target node
6988header_digest               | boolean | Header Digest should be required for this target node
6989data_digest                 | boolean | Data Digest should be required for this target node
6990
6991#### Example
6992
6993Example request:
6994
6995~~~json
6996{
6997  "jsonrpc": "2.0",
6998  "method": "iscsi_get_target_nodes",
6999  "id": 1
7000}
7001~~~
7002
7003Example response:
7004
7005~~~json
7006{
7007  "jsonrpc": "2.0",
7008  "id": 1,
7009  "result": [
7010    {
7011      "luns": [
7012        {
7013          "lun_id": 0,
7014          "bdev_name": "Nvme0n1"
7015        }
7016      ],
7017      "mutual_chap": false,
7018      "name": "iqn.2016-06.io.spdk:target1",
7019      "alias_name": "iscsi-target1-alias",
7020      "require_chap": false,
7021      "chap_group": 0,
7022      "pg_ig_maps": [
7023        {
7024          "ig_tag": 1,
7025          "pg_tag": 1
7026        }
7027      ],
7028      "data_digest": false,
7029      "disable_chap": false,
7030      "header_digest": false,
7031      "queue_depth": 64
7032    }
7033  ]
7034}
7035~~~
7036
7037### iscsi_create_target_node method {#rpc_iscsi_create_target_node}
7038
7039Add an iSCSI target node.
7040
7041#### Parameters
7042
7043Name                        | Optional | Type    | Description
7044--------------------------- | -------- | --------| -----------
7045name                        | Required | string  | Target node name (ASCII)
7046alias_name                  | Required | string  | Target node alias name (ASCII)
7047pg_ig_maps                  | Required | array   | Array of (Portal_Group_Tag:Initiator_Group_Tag) mappings
7048luns                        | Required | array   | Array of Bdev names to LUN ID mappings
7049queue_depth                 | Required | number  | Target queue depth
7050disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
7051require_chap                | Optional | boolean | CHAP authentication should be required for this target
7052mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
7053chap_group                  | Optional | number  | Authentication group ID for this target node
7054header_digest               | Optional | boolean | Header Digest should be required for this target node
7055data_digest                 | Optional | boolean | Data Digest should be required for this target node
7056
7057Parameters `disable_chap` and `require_chap` are mutually exclusive.
7058
7059#### Example
7060
7061Example request:
7062
7063~~~json
7064{
7065  "params": {
7066    "luns": [
7067      {
7068        "lun_id": 0,
7069        "bdev_name": "Nvme0n1"
7070      }
7071    ],
7072    "mutual_chap": true,
7073    "name": "target2",
7074    "alias_name": "iscsi-target2-alias",
7075    "pg_ig_maps": [
7076      {
7077        "ig_tag": 1,
7078        "pg_tag": 1
7079      },
7080      {
7081        "ig_tag": 2,
7082        "pg_tag": 2
7083      }
7084    ],
7085    "data_digest": true,
7086    "disable_chap": true,
7087    "header_digest": true,
7088    "queue_depth": 24
7089  },
7090  "jsonrpc": "2.0",
7091  "method": "iscsi_create_target_node",
7092  "id": 1
7093}
7094~~~
7095
7096Example response:
7097
7098~~~json
7099{
7100  "jsonrpc": "2.0",
7101  "id": 1,
7102  "result": true
7103}
7104~~~
7105
7106### iscsi_target_node_set_auth method {#rpc_iscsi_target_node_set_auth}
7107
7108Set CHAP authentication to an existing iSCSI target node.
7109
7110#### Parameters
7111
7112Name                        | Optional | Type    | Description
7113--------------------------- | -------- | --------| -----------
7114name                        | Required | string  | Target node name (ASCII)
7115disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
7116require_chap                | Optional | boolean | CHAP authentication should be required for this target
7117mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
7118chap_group                  | Optional | number  | Authentication group ID for this target node
7119
7120Parameters `disable_chap` and `require_chap` are mutually exclusive.
7121
7122#### Example
7123
7124Example request:
7125
7126~~~json
7127{
7128  "params": {
7129    "chap_group": 1,
7130    "require_chap": true,
7131    "name": "iqn.2016-06.io.spdk:target1",
7132    "mutual_chap": true
7133  },
7134  "jsonrpc": "2.0",
7135  "method": "iscsi_target_node_set_auth",
7136  "id": 1
7137}
7138~~~
7139
7140Example response:
7141
7142~~~json
7143{
7144  "jsonrpc": "2.0",
7145  "id": 1,
7146  "result": true
7147}
7148~~~
7149
7150### iscsi_target_node_add_pg_ig_maps method {#rpc_iscsi_target_node_add_pg_ig_maps}
7151
7152Add initiator group to portal group mappings to an existing iSCSI target node.
7153
7154#### Parameters
7155
7156Name                        | Optional | Type    | Description
7157--------------------------- | -------- | --------| -----------
7158name                        | Required | string  | Target node name (ASCII)
7159pg_ig_maps                  | Required | array   | Not empty array of initiator to portal group mappings objects
7160
7161Portal to Initiator group mappings object:
7162
7163Name                        | Optional | Type    | Description
7164--------------------------- | -------- | --------| -----------
7165ig_tag                      | Required | number  | Existing initiator group tag
7166pg_tag                      | Required | number  | Existing portal group tag
7167
7168#### Example
7169
7170Example request:
7171
7172~~~json
7173{
7174  "params": {
7175    "pg_ig_maps": [
7176      {
7177        "ig_tag": 1,
7178        "pg_tag": 1
7179      },
7180      {
7181        "ig_tag": 2,
7182        "pg_tag": 2
7183      },
7184      {
7185        "ig_tag": 3,
7186        "pg_tag": 3
7187      }
7188    ],
7189    "name": "iqn.2016-06.io.spdk:target3"
7190  },
7191  "jsonrpc": "2.0",
7192  "method": "iscsi_target_node_add_pg_ig_maps",
7193  "id": 1
7194}
7195~~~
7196
7197Example response:
7198
7199~~~json
7200{
7201  "jsonrpc": "2.0",
7202  "id": 1,
7203  "result": true
7204}
7205~~~
7206
7207### iscsi_target_node_remove_pg_ig_maps method {#rpc_iscsi_target_node_remove_pg_ig_maps}
7208
7209Delete initiator group to portal group mappings from an existing iSCSI target node.
7210
7211#### Parameters
7212
7213Name                        | Optional | Type    | Description
7214--------------------------- | -------- | --------| -----------
7215name                        | Required | string  | Target node name (ASCII)
7216pg_ig_maps                  | Required | array   | Not empty array of Portal to Initiator group mappings objects
7217
7218Portal to Initiator group mappings object:
7219
7220Name                        | Optional | Type    | Description
7221--------------------------- | -------- | --------| -----------
7222ig_tag                      | Required | number  | Existing initiator group tag
7223pg_tag                      | Required | number  | Existing portal group tag
7224
7225#### Example
7226
7227Example request:
7228
7229~~~json
7230{
7231  "params": {
7232    "pg_ig_maps": [
7233      {
7234        "ig_tag": 1,
7235        "pg_tag": 1
7236      },
7237      {
7238        "ig_tag": 2,
7239        "pg_tag": 2
7240      },
7241      {
7242        "ig_tag": 3,
7243        "pg_tag": 3
7244      }
7245    ],
7246    "name": "iqn.2016-06.io.spdk:target3"
7247  },
7248  "jsonrpc": "2.0",
7249  "method": "iscsi_target_node_remove_pg_ig_maps",
7250  "id": 1
7251}
7252~~~
7253
7254Example response:
7255
7256~~~json
7257{
7258  "jsonrpc": "2.0",
7259  "id": 1,
7260  "result": true
7261}
7262~~~
7263
7264### iscsi_delete_target_node method {#rpc_iscsi_delete_target_node}
7265
7266Delete an iSCSI target node.
7267
7268#### Parameters
7269
7270Name                        | Optional | Type    | Description
7271--------------------------- | -------- | --------| -----------
7272name                        | Required | string  | Target node name (ASCII)
7273
7274#### Example
7275
7276Example request:
7277
7278~~~json
7279{
7280  "params": {
7281    "name": "iqn.2016-06.io.spdk:target1"
7282  },
7283  "jsonrpc": "2.0",
7284  "method": "iscsi_delete_target_node",
7285  "id": 1
7286}
7287~~~
7288
7289Example response:
7290
7291~~~json
7292{
7293  "jsonrpc": "2.0",
7294  "id": 1,
7295  "result": true
7296}
7297~~~
7298
7299### iscsi_get_portal_groups method {#rpc_iscsi_get_portal_groups}
7300
7301Show information about all available portal groups.
7302
7303#### Parameters
7304
7305This method has no parameters.
7306
7307#### Example
7308
7309Example request:
7310
7311~~~json
7312request:
7313{
7314  "jsonrpc": "2.0",
7315  "method": "iscsi_get_portal_groups",
7316  "id": 1
7317}
7318~~~
7319
7320Example response:
7321
7322~~~json
7323{
7324  "jsonrpc": "2.0",
7325  "id": 1,
7326  "result": [
7327    {
7328      "portals": [
7329        {
7330          "host": "127.0.0.1",
7331          "port": "3260"
7332        }
7333      ],
7334      "tag": 1,
7335      "private": false
7336    }
7337  ]
7338}
7339~~~
7340
7341### iscsi_create_portal_group method {#rpc_iscsi_create_portal_group}
7342
7343Add a portal group.
7344
7345#### Parameters
7346
7347Name                        | Optional | Type    | Description
7348--------------------------- | -------- | --------| -----------
7349tag                         | Required | number  | Portal group tag
7350portals                     | Required | array   | Not empty array of portals
7351private                     | Optional | boolean | When true, portals in this group are not returned by a discovery session. Used for login redirection. (default: `false`)
7352wait                        | Optional | boolean | When true, do not listen on portals until it is started explicitly. (default: `false`)
7353
7354Portal object
7355
7356Name                        | Optional | Type    | Description
7357--------------------------- | -------- | --------| -----------
7358host                        | Required | string  | Hostname or IP address
7359port                        | Required | string  | Port number
7360
7361#### Example
7362
7363Example request:
7364
7365~~~json
7366{
7367  "params": {
7368    "portals": [
7369      {
7370        "host": "127.0.0.1",
7371        "port": "3260"
7372      }
7373    ],
7374    "tag": 1
7375  },
7376  "jsonrpc": "2.0",
7377  "method": "iscsi_create_portal_group",
7378  "id": 1
7379}
7380~~~
7381
7382Example response:
7383
7384~~~json
7385{
7386  "jsonrpc": "2.0",
7387  "id": 1,
7388  "result": true
7389}
7390~~~
7391
7392### iscsi_start_portal_group method {#rpc_iscsi_start_portal_group}
7393
7394Start listening on portals if the portal group is not started yet, or do nothing
7395if the portal group already started. Return a success response for both cases.
7396
7397#### Parameters
7398
7399Name                        | Optional | Type    | Description
7400--------------------------- | -------- | --------| -----------
7401tag                         | Required | number  | Existing portal group tag
7402
7403#### Example
7404
7405Example request:
7406
7407~~~json
7408{
7409  "params": {
7410    "tag": 1
7411  },
7412  "jsonrpc": "2.0",
7413  "method": "iscsi_start_portal_group",
7414  "id": 1
7415}
7416~~~
7417
7418Example response:
7419
7420~~~json
7421{
7422  "jsonrpc": "2.0",
7423  "id": 1,
7424  "result": true
7425}
7426~~~
7427
7428### iscsi_delete_portal_group method {#rpc_iscsi_delete_portal_group}
7429
7430Delete an existing portal group.
7431
7432#### Parameters
7433
7434Name                        | Optional | Type    | Description
7435--------------------------- | -------- | --------| -----------
7436tag                         | Required | number  | Existing portal group tag
7437
7438#### Example
7439
7440Example request:
7441
7442~~~json
7443{
7444  "params": {
7445    "tag": 1
7446  },
7447  "jsonrpc": "2.0",
7448  "method": "iscsi_delete_portal_group",
7449  "id": 1
7450}
7451~~~
7452
7453Example response:
7454
7455~~~json
7456{
7457  "jsonrpc": "2.0",
7458  "id": 1,
7459  "result": true
7460}
7461~~~
7462
7463### iscsi_portal_group_set_auth method {#rpc_iscsi_portal_group_set_auth}
7464
7465Set CHAP authentication for discovery sessions specific for the existing iSCSI portal group.
7466This RPC overwrites the setting by the global parameters for the iSCSI portal group.
7467
7468#### Parameters
7469
7470Name                        | Optional | Type    | Description
7471--------------------------- | -------- | --------| -----------
7472disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
7473require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
7474mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
7475chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
7476
7477Parameters `disable_chap` and `require_chap` are mutually exclusive.
7478
7479#### Example
7480
7481Example request:
7482
7483~~~json
7484request:
7485{
7486  "params": {
7487    "tag": 1,
7488    "chap_group": 1,
7489    "require_chap": true,
7490    "mutual_chap": true
7491  },
7492  "jsonrpc": "2.0",
7493  "method": "iscsi_portal_group_set_auth",
7494  "id": 1
7495}
7496~~~
7497
7498Example response:
7499
7500~~~json
7501{
7502  "jsonrpc": "2.0",
7503  "id": 1,
7504  "result": true
7505}
7506~~~
7507
7508### iscsi_get_connections method {#rpc_iscsi_get_connections}
7509
7510Show information about all active connections.
7511
7512#### Parameters
7513
7514This method has no parameters.
7515
7516#### Results
7517
7518Array of objects describing iSCSI connection.
7519
7520Name                        | Type    | Description
7521--------------------------- | --------| -----------
7522id                          | number  | Index (used for TTT - Target Transfer Tag)
7523cid                         | number  | CID (Connection ID)
7524tsih                        | number  | TSIH (Target Session Identifying Handle)
7525lcore_id                    | number  | Core number on which the iSCSI connection runs
7526initiator_addr              | string  | Initiator address
7527target_addr                 | string  | Target address
7528target_node_name            | string  | Target node name (ASCII) without prefix
7529
7530#### Example
7531
7532Example request:
7533
7534~~~json
7535{
7536  "jsonrpc": "2.0",
7537  "method": "iscsi_get_connections",
7538  "id": 1
7539}
7540~~~
7541
7542Example response:
7543
7544~~~json
7545{
7546  "jsonrpc": "2.0",
7547  "id": 1,
7548  "result": [
7549    {
7550      "tsih": 4,
7551      "cid": 0,
7552      "target_node_name": "target1",
7553      "lcore_id": 0,
7554      "initiator_addr": "10.0.0.2",
7555      "target_addr": "10.0.0.1",
7556      "id": 0
7557    }
7558  ]
7559}
7560~~~
7561
7562### iscsi_target_node_add_lun method {#rpc_iscsi_target_node_add_lun}
7563
7564Add an LUN to an existing iSCSI target node.
7565
7566#### Parameters
7567
7568Name                        | Optional | Type    | Description
7569--------------------------- | -------- | --------| -----------
7570name                        | Required | string  | Target node name (ASCII)
7571bdev_name                   | Required | string  | bdev name to be added as a LUN
7572lun_id                      | Optional | number  | LUN ID (default: first free ID)
7573
7574#### Example
7575
7576Example request:
7577
7578~~~json
7579{
7580  "params": {
7581    "lun_id": 2,
7582    "name": "iqn.2016-06.io.spdk:target1",
7583    "bdev_name": "Malloc0"
7584  },
7585  "jsonrpc": "2.0",
7586  "method": "iscsi_target_node_add_lun",
7587  "id": 1
7588}
7589~~~
7590
7591Example response:
7592
7593~~~json
7594{
7595  "jsonrpc": "2.0",
7596  "id": 1,
7597  "result": true
7598}
7599~~~
7600
7601### iscsi_target_node_set_redirect method {#rpc_iscsi_target_node_set_redirect}
7602
7603Update redirect portal of the primary portal group for the target node,
7604
7605#### Parameters
7606
7607Name                        | Optional | Type    | Description
7608--------------------------- | -------- | --------| -----------
7609name                        | Required | string  | Target node name (ASCII)
7610pg_tag                      | Required | number  | Existing portal group tag
7611redirect_host               | Optional | string  | Numeric IP address to which the target node is redirected
7612redirect_port               | Optional | string  | Numeric TCP port to which the target node is redirected
7613
7614If both redirect_host and redirect_port are omitted, clear the redirect portal.
7615
7616#### Example
7617
7618Example request:
7619
7620~~~json
7621{
7622  "params": {
7623    "name": "iqn.2016-06.io.spdk:target1",
7624    "pg_tag": 1,
7625    "redirect_host": "10.0.0.3",
7626    "redirect_port": "3260"
7627  },
7628  "jsonrpc": "2.0",
7629  "method": "iscsi_target_node_set_redirect",
7630  "id": 1
7631}
7632~~~
7633
7634Example response:
7635
7636~~~json
7637{
7638  "jsonrpc": "2.0",
7639  "id": 1,
7640  "result": true
7641}
7642~~~
7643
7644### iscsi_target_node_request_logout method {#rpc_iscsi_target_node_request_logout}
7645
7646For the target node, request connections whose portal group tag match to logout,
7647or request all connections to logout if portal group tag is omitted.
7648
7649#### Parameters
7650
7651Name                        | Optional | Type    | Description
7652--------------------------- | -------- | --------| -----------
7653name                        | Required | string  | Target node name (ASCII)
7654pg_tag                      | Optional | number  | Existing portal group tag
7655
7656#### Example
7657
7658Example request:
7659
7660~~~json
7661{
7662  "params": {
7663    "name": "iqn.2016-06.io.spdk:target1",
7664    "pg_tag": 1
7665  },
7666  "jsonrpc": "2.0",
7667  "method": "iscsi_target_node_request_logout",
7668  "id": 1
7669}
7670~~~
7671
7672Example response:
7673
7674~~~json
7675{
7676  "jsonrpc": "2.0",
7677  "id": 1,
7678  "result": true
7679}
7680~~~
7681
7682## NVMe-oF Target {#jsonrpc_components_nvmf_tgt}
7683
7684### nvmf_create_transport method {#rpc_nvmf_create_transport}
7685
7686Initialize an NVMe-oF transport with the given options.
7687
7688#### Parameters
7689
7690Name                        | Optional | Type    | Description
7691--------------------------- | -------- | --------| -----------
7692trtype                      | Required | string  | Transport type (ex. RDMA)
7693tgt_name                    | Optional | string  | Parent NVMe-oF target name.
7694max_queue_depth             | Optional | number  | Max number of outstanding I/O per queue
7695max_io_qpairs_per_ctrlr     | Optional | number  | Max number of IO qpairs per controller
7696in_capsule_data_size        | Optional | number  | Max number of in-capsule data size
7697max_io_size                 | Optional | number  | Max I/O size (bytes)
7698io_unit_size                | Optional | number  | I/O unit size (bytes)
7699max_aq_depth                | Optional | number  | Max number of admin cmds per AQ
7700num_shared_buffers          | Optional | number  | The number of pooled data buffers available to the transport
7701buf_cache_size              | Optional | number  | The number of shared buffers to reserve for each poll group
7702num_cqe                     | Optional | number  | The number of CQ entries. Only used when no_srq=true (RDMA only)
7703max_srq_depth               | Optional | number  | The number of elements in a per-thread shared receive queue (RDMA only)
7704no_srq                      | Optional | boolean | Disable shared receive queue even for devices that support it. (RDMA only)
7705c2h_success                 | Optional | boolean | Disable C2H success optimization (TCP only)
7706dif_insert_or_strip         | Optional | boolean | Enable DIF insert for write I/O and DIF strip for read I/O DIF
7707sock_priority               | Optional | number  | The socket priority of the connection owned by this transport (TCP only)
7708acceptor_backlog            | Optional | number  | The number of pending connections allowed in backlog before failing new connection attempts (RDMA only)
7709abort_timeout_sec           | Optional | number  | Abort execution timeout value, in seconds
7710no_wr_batching              | Optional | boolean | Disable work requests batching (RDMA only)
7711control_msg_num             | Optional | number  | The number of control messages per poll group (TCP only)
7712disable_mappable_bar0       | Optional | boolean | disable client mmap() of BAR0 (VFIO-USER only)
7713disable_adaptive_irq        | Optional | boolean | Disable adaptive interrupt feature (VFIO-USER only)
7714disable_shadow_doorbells    | Optional | boolean | disable shadow doorbell support (VFIO-USER only)
7715zcopy                       | Optional | boolean | Use zero-copy operations if the underlying bdev supports them
7716
7717#### Example
7718
7719Example request:
7720
7721~~~json
7722{
7723  "jsonrpc": "2.0",
7724  "method": "nvmf_create_transport",
7725  "id": 1,
7726  "params": {
7727    "trtype": "RDMA",
7728    "max_queue_depth": 32
7729  }
7730}
7731~~~
7732
7733Example response:
7734
7735~~~json
7736{
7737  "jsonrpc": "2.0",
7738  "id": 1,
7739  "result": true
7740}
7741~~~
7742
7743### nvmf_get_subsystems method {#rpc_nvmf_get_subsystems}
7744
7745#### Parameters
7746
7747Name                        | Optional | Type        | Description
7748--------------------------- | -------- | ------------| -----------
7749tgt_name                    | Optional | string      | Parent NVMe-oF target name.
7750
7751#### Example
7752
7753Example request:
7754
7755~~~json
7756{
7757  "jsonrpc": "2.0",
7758  "id": 1,
7759  "method": "nvmf_get_subsystems"
7760}
7761~~~
7762
7763Example response:
7764
7765~~~json
7766{
7767  "jsonrpc": "2.0",
7768  "id": 1,
7769  "result": [
7770    {
7771      "nqn": "nqn.2014-08.org.nvmexpress.discovery",
7772      "subtype": "Discovery"
7773      "listen_addresses": [],
7774      "hosts": [],
7775      "allow_any_host": true
7776    },
7777    {
7778      "nqn": "nqn.2016-06.io.spdk:cnode1",
7779      "subtype": "NVMe",
7780      "listen_addresses": [
7781        {
7782          "trtype": "RDMA",
7783          "adrfam": "IPv4",
7784          "traddr": "192.168.0.123",
7785          "trsvcid": "4420"
7786        }
7787      ],
7788      "hosts": [
7789        {"nqn": "nqn.2016-06.io.spdk:host1"}
7790      ],
7791      "allow_any_host": false,
7792      "serial_number": "abcdef",
7793      "model_number": "ghijklmnop",
7794      "namespaces": [
7795        {"nsid": 1, "name": "Malloc2"},
7796        {"nsid": 2, "name": "Nvme0n1"}
7797      ]
7798    }
7799  ]
7800}
7801~~~
7802
7803### nvmf_create_subsystem method {#rpc_nvmf_create_subsystem}
7804
7805Construct an NVMe over Fabrics target subsystem.
7806
7807#### Parameters
7808
7809Name                    | Optional | Type        | Description
7810----------------------- | -------- | ----------- | -----------
7811nqn                     | Required | string      | Subsystem NQN
7812tgt_name                | Optional | string      | Parent NVMe-oF target name.
7813serial_number           | Optional | string      | Serial number of virtual controller
7814model_number            | Optional | string      | Model number of virtual controller
7815max_namespaces          | Optional | number      | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
7816allow_any_host          | Optional | boolean     | Allow any host (`true`) or enforce allowed host list (`false`). Default: `false`.
7817ana_reporting           | Optional | boolean     | Enable ANA reporting feature (default: `false`).
7818min_cntlid              | Optional | number      | Minimum controller ID. Default: 1
7819max_cntlid              | Optional | number      | Maximum controller ID. Default: 0xffef
7820
7821#### Example
7822
7823Example request:
7824
7825~~~json
7826{
7827  "jsonrpc": "2.0",
7828  "id": 1,
7829  "method": "nvmf_create_subsystem",
7830  "params": {
7831    "nqn": "nqn.2016-06.io.spdk:cnode1",
7832    "allow_any_host": false,
7833    "serial_number": "abcdef",
7834    "model_number": "ghijklmnop"
7835  }
7836}
7837~~~
7838
7839Example response:
7840
7841~~~json
7842{
7843  "jsonrpc": "2.0",
7844  "id": 1,
7845  "result": true
7846}
7847~~~
7848
7849### nvmf_delete_subsystem method {#rpc_nvmf_delete_subsystem}
7850
7851Delete an existing NVMe-oF subsystem.
7852
7853#### Parameters
7854
7855Parameter              | Optional | Type        | Description
7856---------------------- | -------- | ----------- | -----------
7857nqn                    | Required | string      | Subsystem NQN to delete.
7858tgt_name               | Optional | string      | Parent NVMe-oF target name.
7859
7860#### Example
7861
7862Example request:
7863
7864~~~json
7865{
7866  "jsonrpc": "2.0",
7867  "id": 1,
7868  "method": "nvmf_delete_subsystem",
7869  "params": {
7870    "nqn": "nqn.2016-06.io.spdk:cnode1"
7871  }
7872}
7873~~~
7874
7875Example response:
7876
7877~~~json
7878{
7879  "jsonrpc": "2.0",
7880  "id": 1,
7881  "result": true
7882}
7883~~~
7884
7885### nvmf_subsystem_add_listener  method {#rpc_nvmf_subsystem_add_listener}
7886
7887Add a new listen address to an NVMe-oF subsystem.
7888
7889#### Parameters
7890
7891Name                    | Optional | Type        | Description
7892----------------------- | -------- | ----------- | -----------
7893nqn                     | Required | string      | Subsystem NQN
7894tgt_name                | Optional | string      | Parent NVMe-oF target name.
7895listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
7896
7897#### listen_address {#rpc_nvmf_listen_address}
7898
7899Name                    | Optional | Type        | Description
7900----------------------- | -------- | ----------- | -----------
7901trtype                  | Required | string      | Transport type ("RDMA")
7902adrfam                  | Required | string      | Address family ("IPv4", "IPv6", "IB", or "FC")
7903traddr                  | Required | string      | Transport address
7904trsvcid                 | Optional | string      | Transport service ID (required for RDMA or TCP)
7905
7906#### Example
7907
7908Example request:
7909
7910~~~json
7911{
7912  "jsonrpc": "2.0",
7913  "id": 1,
7914  "method": "nvmf_subsystem_add_listener",
7915  "params": {
7916    "nqn": "nqn.2016-06.io.spdk:cnode1",
7917    "listen_address": {
7918      "trtype": "RDMA",
7919      "adrfam": "IPv4",
7920      "traddr": "192.168.0.123",
7921      "trsvcid": "4420"
7922    }
7923  }
7924}
7925~~~
7926
7927Example response:
7928
7929~~~json
7930{
7931  "jsonrpc": "2.0",
7932  "id": 1,
7933  "result": true
7934}
7935~~~
7936
7937### nvmf_subsystem_remove_listener  method {#rpc_nvmf_subsystem_remove_listener}
7938
7939Remove a listen address from an NVMe-oF subsystem.
7940
7941#### Parameters
7942
7943Name                    | Optional | Type        | Description
7944----------------------- | -------- | ----------- | -----------
7945nqn                     | Required | string      | Subsystem NQN
7946tgt_name                | Optional | string      | Parent NVMe-oF target name.
7947listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
7948
7949#### Example
7950
7951Example request:
7952
7953~~~json
7954{
7955  "jsonrpc": "2.0",
7956  "id": 1,
7957  "method": "nvmf_subsystem_remove_listener",
7958  "params": {
7959    "nqn": "nqn.2016-06.io.spdk:cnode1",
7960    "listen_address": {
7961      "trtype": "RDMA",
7962      "adrfam": "IPv4",
7963      "traddr": "192.168.0.123",
7964      "trsvcid": "4420"
7965    }
7966  }
7967}
7968~~~
7969
7970Example response:
7971
7972~~~json
7973{
7974  "jsonrpc": "2.0",
7975  "id": 1,
7976  "result": true
7977}
7978~~~
7979
7980### nvmf_subsystem_listener_set_ana_state  method {#rpc_nvmf_subsystem_listener_set_ana_state}
7981
7982Set ANA state of a listener for an NVMe-oF subsystem. Only the ANA state of the specified ANA
7983group is updated, or ANA states of all ANA groups if ANA group is not specified.
7984
7985#### Parameters
7986
7987Name                    | Optional | Type        | Description
7988----------------------- | -------- | ----------- | -----------
7989nqn                     | Required | string      | Subsystem NQN
7990tgt_name                | Optional | string      | Parent NVMe-oF target name.
7991listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
7992ana_state               | Required | string      | ANA state to set ("optimized", "non_optimized", or "inaccessible")
7993anagrpid                | Optional | number      | ANA group ID
7994
7995#### Example
7996
7997Example request:
7998
7999~~~json
8000{
8001  "jsonrpc": "2.0",
8002  "id": 1,
8003  "method": "nvmf_subsystem_listener_set_ana_state",
8004  "params": {
8005    "nqn": "nqn.2016-06.io.spdk:cnode1",
8006    "listen_address": {
8007      "trtype": "RDMA",
8008      "adrfam": "IPv4",
8009      "traddr": "192.168.0.123",
8010      "trsvcid": "4420"
8011    },
8012    "ana_state", "inaccessible"
8013  }
8014}
8015~~~
8016
8017Example response:
8018
8019~~~json
8020{
8021  "jsonrpc": "2.0",
8022  "id": 1,
8023  "result": true
8024}
8025~~~
8026
8027### nvmf_subsystem_add_ns method {#rpc_nvmf_subsystem_add_ns}
8028
8029Add a namespace to a subsystem. The namespace ID is returned as the result.
8030
8031### Parameters
8032
8033Name                    | Optional | Type        | Description
8034----------------------- | -------- | ----------- | -----------
8035nqn                     | Required | string      | Subsystem NQN
8036namespace               | Required | object      | @ref rpc_nvmf_namespace object
8037tgt_name                | Optional | string      | Parent NVMe-oF target name.
8038
8039#### namespace {#rpc_nvmf_namespace}
8040
8041Name                    | Optional | Type        | Description
8042----------------------- | -------- | ----------- | -----------
8043nsid                    | Optional | number      | Namespace ID between 1 and 4294967294, inclusive. Default: Automatically assign NSID.
8044bdev_name               | Required | string      | Name of bdev to expose as a namespace.
8045nguid                   | Optional | string      | 16-byte namespace globally unique identifier in hexadecimal (e.g. "ABCDEF0123456789ABCDEF0123456789")
8046eui64                   | Optional | string      | 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789")
8047uuid                    | Optional | string      | RFC 4122 UUID (e.g. "ceccf520-691e-4b46-9546-34af789907c5")
8048ptpl_file               | Optional | string      | File path to save/restore persistent reservation information
8049anagrpid                | Optional | number      | ANA group ID. Default: Namespace ID.
8050
8051#### Example
8052
8053Example request:
8054
8055~~~json
8056{
8057  "jsonrpc": "2.0",
8058  "id": 1,
8059  "method": "nvmf_subsystem_add_ns",
8060  "params": {
8061    "nqn": "nqn.2016-06.io.spdk:cnode1",
8062    "namespace": {
8063      "nsid": 3,
8064      "bdev_name": "Nvme0n1",
8065      "ptpl_file": "/opt/Nvme0n1PR.json"
8066    }
8067  }
8068}
8069~~~
8070
8071Example response:
8072
8073~~~json
8074{
8075  "jsonrpc": "2.0",
8076  "id": 1,
8077  "result": 3
8078}
8079~~~
8080
8081### nvmf_subsystem_remove_ns method {#rpc_nvmf_subsystem_remove_ns}
8082
8083Remove a namespace from a subsystem.
8084
8085#### Parameters
8086
8087Name                    | Optional | Type        | Description
8088----------------------- | -------- | ----------- | -----------
8089nqn                     | Required | string      | Subsystem NQN
8090nsid                    | Required | number      | Namespace ID
8091tgt_name                | Optional | string      | Parent NVMe-oF target name.
8092
8093#### Example
8094
8095Example request:
8096
8097~~~json
8098{
8099  "jsonrpc": "2.0",
8100  "id": 1,
8101  "method": "nvmf_subsystem_remove_ns",
8102  "params": {
8103    "nqn": "nqn.2016-06.io.spdk:cnode1",
8104    "nsid": 1
8105  }
8106}
8107~~~
8108
8109Example response:
8110
8111~~~json
8112{
8113  "jsonrpc": "2.0",
8114  "id": 1,
8115  "result": true
8116}
8117~~~
8118
8119### nvmf_subsystem_add_host method {#rpc_nvmf_subsystem_add_host}
8120
8121Add a host NQN to the list of allowed hosts.
8122
8123#### Parameters
8124
8125Name                    | Optional | Type        | Description
8126----------------------- | -------- | ----------- | -----------
8127nqn                     | Required | string      | Subsystem NQN
8128host                    | Required | string      | Host NQN to add to the list of allowed host NQNs
8129tgt_name                | Optional | string      | Parent NVMe-oF target name.
8130
8131#### Example
8132
8133Example request:
8134
8135~~~json
8136{
8137  "jsonrpc": "2.0",
8138  "id": 1,
8139  "method": "nvmf_subsystem_add_host",
8140  "params": {
8141    "nqn": "nqn.2016-06.io.spdk:cnode1",
8142    "host": "nqn.2016-06.io.spdk:host1"
8143  }
8144}
8145~~~
8146
8147Example response:
8148
8149~~~json
8150{
8151  "jsonrpc": "2.0",
8152  "id": 1,
8153  "result": true
8154}
8155~~~
8156
8157### nvmf_subsystem_remove_host method {#rpc_nvmf_subsystem_remove_host}
8158
8159Remove a host NQN from the list of allowed hosts.
8160
8161#### Parameters
8162
8163Name                    | Optional | Type        | Description
8164----------------------- | -------- | ----------- | -----------
8165nqn                     | Required | string      | Subsystem NQN
8166host                    | Required | string      | Host NQN to remove from the list of allowed host NQNs
8167tgt_name                | Optional | string      | Parent NVMe-oF target name.
8168
8169#### Example
8170
8171Example request:
8172
8173~~~json
8174{
8175  "jsonrpc": "2.0",
8176  "id": 1,
8177  "method": "nvmf_subsystem_remove_host",
8178  "params": {
8179    "nqn": "nqn.2016-06.io.spdk:cnode1",
8180    "host": "nqn.2016-06.io.spdk:host1"
8181  }
8182}
8183~~~
8184
8185Example response:
8186
8187~~~json
8188{
8189  "jsonrpc": "2.0",
8190  "id": 1,
8191  "result": true
8192}
8193~~~
8194
8195### nvmf_subsystem_allow_any_host method {#rpc_nvmf_subsystem_allow_any_host}
8196
8197Configure a subsystem to allow any host to connect or to enforce the host NQN list.
8198
8199#### Parameters
8200
8201Name                    | Optional | Type        | Description
8202----------------------- | -------- | ----------- | -----------
8203nqn                     | Required | string      | Subsystem NQN
8204allow_any_host          | Required | boolean     | Allow any host (`true`) or enforce allowed host list (`false`).
8205tgt_name                | Optional | string      | Parent NVMe-oF target name.
8206
8207#### Example
8208
8209Example request:
8210
8211~~~json
8212{
8213  "jsonrpc": "2.0",
8214  "id": 1,
8215  "method": "nvmf_subsystem_allow_any_host",
8216  "params": {
8217    "nqn": "nqn.2016-06.io.spdk:cnode1",
8218    "allow_any_host": true
8219  }
8220}
8221~~~
8222
8223Example response:
8224
8225~~~json
8226{
8227  "jsonrpc": "2.0",
8228  "id": 1,
8229  "result": true
8230}
8231~~~
8232
8233### nvmf_subsystem_get_controllers {#rpc_nvmf_subsystem_get_controllers}
8234
8235#### Parameters
8236
8237Name                    | Optional | Type        | Description
8238----------------------- | -------- | ----------- | -----------
8239nqn                     | Required | string      | Subsystem NQN
8240tgt_name                | Optional | string      | Parent NVMe-oF target name.
8241
8242#### Example
8243
8244Example request:
8245
8246~~~json
8247{
8248  "jsonrpc": "2.0",
8249  "id": 1,
8250  "method": "nvmf_subsystem_get_controllers",
8251  "params": {
8252    "nqn": "nqn.2016-06.io.spdk:cnode1"
8253  }
8254}
8255~~~
8256
8257Example response:
8258
8259~~~json
8260{
8261  "jsonrpc": "2.0",
8262  "id": 1,
8263  "result": [
8264    {
8265      "cntlid": 1,
8266      "hostnqn": "nqn.2016-06.io.spdk:host1",
8267      "hostid": "27dad528-6368-41c3-82d3-0b956b49025d",
8268      "num_io_qpairs": 5
8269    }
8270  ]
8271}
8272~~~
8273
8274### nvmf_subsystem_get_qpairs {#rpc_nvmf_subsystem_get_qpairs}
8275
8276#### Parameters
8277
8278Name                    | Optional | Type        | Description
8279----------------------- | -------- | ----------- | -----------
8280nqn                     | Required | string      | Subsystem NQN
8281tgt_name                | Optional | string      | Parent NVMe-oF target name.
8282
8283#### Example
8284
8285Example request:
8286
8287~~~json
8288{
8289  "jsonrpc": "2.0",
8290  "id": 1,
8291  "method": "nvmf_subsystem_get_qpairs",
8292  "params": {
8293    "nqn": "nqn.2016-06.io.spdk:cnode1"
8294  }
8295}
8296~~~
8297
8298Example response:
8299
8300~~~json
8301{
8302  "jsonrpc": "2.0",
8303  "id": 1,
8304  "result": [
8305    {
8306      "cntlid": 1,
8307      "qid": 0,
8308      "state": "active",
8309      "listen_address": {
8310        "trtype": "RDMA",
8311        "adrfam": "IPv4",
8312        "traddr": "192.168.0.123",
8313        "trsvcid": "4420"
8314      }
8315    },
8316    {
8317      "cntlid": 1,
8318      "qid": 1,
8319      "state": "active",
8320      "listen_address": {
8321        "trtype": "RDMA",
8322        "adrfam": "IPv4",
8323        "traddr": "192.168.0.123",
8324        "trsvcid": "4420"
8325      }
8326    }
8327  ]
8328}
8329~~~
8330
8331### nvmf_subsystem_get_listeners {#rpc_nvmf_subsystem_get_listeners}
8332
8333#### Parameters
8334
8335Name                    | Optional | Type        | Description
8336----------------------- | -------- | ----------- | -----------
8337nqn                     | Required | string      | Subsystem NQN
8338tgt_name                | Optional | string      | Parent NVMe-oF target name.
8339
8340#### Example
8341
8342Example request:
8343
8344~~~json
8345{
8346  "jsonrpc": "2.0",
8347  "id": 1,
8348  "method": "nvmf_subsystem_get_listeners",
8349  "params": {
8350    "nqn": "nqn.2016-06.io.spdk:cnode1"
8351  }
8352}
8353~~~
8354
8355Example response:
8356
8357~~~json
8358{
8359  "jsonrpc": "2.0",
8360  "id": 1,
8361  "result": [
8362    {
8363      "address": {
8364        "trtype": "RDMA",
8365        "adrfam": "IPv4",
8366        "traddr": "192.168.0.123",
8367        "trsvcid": "4420"
8368      },
8369      "ana_state": "optimized"
8370    }
8371  ]
8372}
8373~~~
8374
8375### nvmf_set_max_subsystems {#rpc_nvmf_set_max_subsystems}
8376
8377Set the maximum allowed subsystems for the NVMe-oF target.  This RPC may only be called
8378before SPDK subsystems have been initialized.
8379
8380#### Parameters
8381
8382Name                    | Optional | Type        | Description
8383----------------------- | -------- | ----------- | -----------
8384max_subsystems          | Required | number      | Maximum number of NVMe-oF subsystems
8385
8386#### Example
8387
8388Example request:
8389
8390~~~json
8391{
8392  "jsonrpc": "2.0",
8393  "id": 1,
8394  "method": "nvmf_set_max_subsystems",
8395  "params": {
8396    "max_subsystems": 1024
8397  }
8398}
8399~~~
8400
8401Example response:
8402
8403~~~json
8404{
8405  "jsonrpc": "2.0",
8406  "id": 1,
8407  "result": true
8408}
8409~~~
8410
8411### nvmf_set_config {#rpc_nvmf_set_config}
8412
8413Set global configuration of NVMe-oF target.  This RPC may only be called before SPDK subsystems
8414have been initialized.
8415
8416#### Parameters
8417
8418Name                    | Optional | Type        | Description
8419----------------------- | -------- | ----------- | -----------
8420acceptor_poll_rate      | Optional | number      | Polling interval of the acceptor for incoming connections (microseconds)
8421admin_cmd_passthru      | Optional | object      | Admin command passthru configuration
8422poll_groups_mask        | Optional | string      | Set cpumask for NVMf poll groups
8423discovery_filter        | Optional | string      | Set discovery filter, possible values are: `match_any` (default) or comma separated values: `transport`, `address`, `svcid`
8424
8425#### admin_cmd_passthru {#spdk_nvmf_admin_passthru_conf}
8426
8427Name                    | Optional | Type        | Description
8428----------------------- | -------- | ----------- | -----------
8429identify_ctrlr          | Required | bool        | If true, enables custom identify handler that reports some identify attributes from the underlying NVMe drive
8430
8431#### Example
8432
8433Example request:
8434
8435~~~json
8436{
8437  "jsonrpc": "2.0",
8438  "id": 1,
8439  "method": "nvmf_set_config",
8440  "params": {
8441    "acceptor_poll_rate": 10000
8442  }
8443}
8444~~~
8445
8446Example response:
8447
8448~~~json
8449{
8450  "jsonrpc": "2.0",
8451  "id": 1,
8452  "result": true
8453}
8454~~~
8455
8456### nvmf_get_transports method {#rpc_nvmf_get_transports}
8457
8458#### Parameters
8459
8460The user may specify no parameters in order to list all transports, or a transport may be
8461specified by type.
8462
8463Name                        | Optional | Type        | Description
8464--------------------------- | -------- | ------------| -----------
8465tgt_name                    | Optional | string      | Parent NVMe-oF target name.
8466trtype                      | Optional | string      | Transport type.
8467
8468#### Example
8469
8470Example request:
8471
8472~~~json
8473{
8474  "jsonrpc": "2.0",
8475  "id": 1,
8476  "method": "nvmf_get_transports"
8477}
8478~~~
8479
8480Example response:
8481
8482~~~json
8483{
8484  "jsonrpc": "2.0",
8485  "id": 1,
8486  "result": [
8487    {
8488      "type": "RDMA".
8489      "max_queue_depth": 128,
8490      "max_io_qpairs_per_ctrlr": 64,
8491      "in_capsule_data_size": 4096,
8492      "max_io_size": 131072,
8493      "io_unit_size": 131072,
8494      "abort_timeout_sec": 1
8495    }
8496  ]
8497}
8498~~~
8499
8500### nvmf_get_stats method {#rpc_nvmf_get_stats}
8501
8502Retrieve current statistics of the NVMf subsystem.
8503
8504#### Parameters
8505
8506Name                        | Optional | Type        | Description
8507--------------------------- | -------- | ------------| -----------
8508tgt_name                    | Optional | string      | Parent NVMe-oF target name.
8509
8510#### Response
8511
8512The response is an object containing NVMf subsystem statistics.
8513In the response, `admin_qpairs` and `io_qpairs` are reflecting cumulative queue pair counts while
8514`current_admin_qpairs` and `current_io_qpairs` are showing the current number.
8515
8516#### Example
8517
8518Example request:
8519
8520~~~json
8521{
8522  "jsonrpc": "2.0",
8523  "method": "nvmf_get_stats",
8524  "id": 1
8525}
8526~~~
8527
8528Example response:
8529
8530~~~json
8531{
8532  "jsonrpc": "2.0",
8533  "id": 1,
8534  "result": {
8535    "tick_rate": 2400000000,
8536    "poll_groups": [
8537      {
8538        "name": "app_thread",
8539        "admin_qpairs": 1,
8540        "io_qpairs": 4,
8541        "current_admin_qpairs": 1,
8542        "current_io_qpairs": 2,
8543        "pending_bdev_io": 1721,
8544        "transports": [
8545          {
8546            "trtype": "RDMA",
8547            "pending_data_buffer": 12131888,
8548            "devices": [
8549              {
8550                "name": "mlx5_1",
8551                "polls": 72284105,
8552                "completions": 0,
8553                "requests": 0,
8554                "request_latency": 0,
8555                "pending_free_request": 0,
8556                "pending_rdma_read": 0,
8557                "pending_rdma_write": 0,
8558                "total_send_wrs": 0,
8559                "send_doorbell_updates": 0,
8560                "total_recv_wrs": 0,
8561                "recv_doorbell_updates": 1
8562              },
8563              {
8564                "name": "mlx5_0",
8565                "polls": 72284105,
8566                "completions": 15165875,
8567                "requests": 7582935,
8568                "request_latency": 1249323766184,
8569                "pending_free_request": 0,
8570                "pending_rdma_read": 337602,
8571                "pending_rdma_write": 0,
8572                "total_send_wrs": 15165875,
8573                "send_doorbell_updates": 1516587,
8574                "total_recv_wrs": 15165875,
8575                "recv_doorbell_updates": 1516587
8576              }
8577            ]
8578          }
8579        ]
8580      }
8581    ]
8582  }
8583}
8584~~~
8585
8586### nvmf_set_crdt {#rpc_nvmf_set_crdt}
8587
8588Set the 3 CRDT (Command Retry Delay Time) values. For details about
8589CRDT, please refer to the NVMe specification. Currently all the
8590SPDK nvmf subsystems share the same CRDT values. The default values
8591are 0. This rpc can only be invoked in STARTUP stage. All values are
8592in units of 100 milliseconds (same as the NVMe specification).
8593
8594#### Parameters
8595
8596Name                    | Optional | Type        | Description
8597----------------------- | -------- | ----------- | -----------
8598crdt1                   | Optional | number      | Command Retry Delay Time 1
8599crdt2                   | Optional | number      | Command Retry Delay Time 2
8600crdt3                   | Optional | number      | Command Retry Delay Time 3
8601
8602## Vfio-user Target
8603
8604### vfu_tgt_set_base_path {#rpc_vfu_tgt_set_base_path}
8605
8606Set base path of Unix Domain socket file.
8607
8608#### Parameters
8609
8610Name                    | Optional | Type        | Description
8611----------------------- | -------- | ----------- | -----------
8612path                    | Required | string      | Base path
8613
8614#### Example
8615
8616Example request:
8617
8618~~~json
8619{
8620  "params": {
8621    "path": "/var/run/vfu_tgt"
8622  },
8623  "jsonrpc": "2.0",
8624  "method": "vfu_tgt_set_base_path",
8625  "id": 1
8626}
8627~~~
8628
8629Example response:
8630
8631~~~json
8632{
8633  "jsonrpc": "2.0",
8634  "id": 1,
8635  "result": true
8636}
8637~~~
8638
8639### vfu_virtio_delete_endpoint {#rpc_vfu_virtio_delete_endpoint}
8640
8641Delete PCI device via endpoint name.
8642
8643#### Parameters
8644
8645Name                    | Optional | Type        | Description
8646----------------------- | -------- | ----------- | -----------
8647name                    | Required | string      | Endpoint name
8648
8649#### Example
8650
8651Example request:
8652
8653~~~json
8654{
8655  "params": {
8656    "name": "vfu.0"
8657  },
8658  "jsonrpc": "2.0",
8659  "method": "vfu_virtio_delete_endpoint",
8660  "id": 1
8661}
8662~~~
8663
8664Example response:
8665
8666~~~json
8667{
8668  "jsonrpc": "2.0",
8669  "id": 1,
8670  "result": true
8671}
8672~~~
8673
8674### vfu_virtio_create_blk_endpoint {#rpc_vfu_virtio_create_blk_endpoint}
8675
8676Create vfio-user virtio-blk PCI endpoint.
8677
8678#### Parameters
8679
8680Name                    | Optional | Type        | Description
8681----------------------- | -------- | ----------- | -----------
8682name                    | Required | string      | Endpoint name
8683bdev_name               | Required | string      | Block device name
8684cpumask                 | Optional | string      | CPU masks
8685num_queues              | Optional | number      | Number of queues
8686qsize                   | Optional | number      | Queue size
8687packed_ring             | Optional | boolean     | Enable packed ring
8688
8689#### Example
8690
8691Example request:
8692
8693~~~json
8694{
8695  "params": {
8696    "name": "vfu.0",
8697    "bdev_name": "Malloc0",
8698    "cpumask": "0x2",
8699    "num_queues": 4,
8700    "qsize": 256
8701  },
8702  "jsonrpc": "2.0",
8703  "method": "vfu_virtio_create_blk_endpoint",
8704  "id": 1
8705}
8706~~~
8707
8708Example response:
8709
8710~~~json
8711{
8712  "jsonrpc": "2.0",
8713  "id": 1,
8714  "result": true
8715}
8716~~~
8717
8718### vfu_virtio_scsi_add_target {#rpc_vfu_virtio_scsi_add_target}
8719
8720Add block device to specified SCSI target of vfio-user virtio-scsi PCI endpoint.
8721
8722#### Parameters
8723
8724Name                    | Optional | Type        | Description
8725----------------------- | -------- | ----------- | -----------
8726name                    | Required | string      | Endpoint name
8727scsi_target_num         | Required | number      | SCSI target number
8728bdev_name               | Required | string      | Block device name
8729
8730#### Example
8731
8732Example request:
8733
8734~~~json
8735{
8736  "params": {
8737    "name": "vfu.0",
8738    "scsi_target_num": 0,
8739    "bdev_name": "Malloc0"
8740  },
8741  "jsonrpc": "2.0",
8742  "method": "vfu_virtio_scsi_add_target",
8743  "id": 1
8744}
8745~~~
8746
8747Example response:
8748
8749~~~json
8750{
8751  "jsonrpc": "2.0",
8752  "id": 1,
8753  "result": true
8754}
8755~~~
8756
8757### vfu_virtio_scsi_remove_target {#rpc_vfu_virtio_scsi_remove_target}
8758
8759Remove a SCSI target of vfio-user virtio-scsi PCI endpoint.
8760
8761#### Parameters
8762
8763Name                    | Optional | Type        | Description
8764----------------------- | -------- | ----------- | -----------
8765name                    | Required | string      | Endpoint name
8766scsi_target_num         | Required | number      | SCSI target number
8767
8768#### Example
8769
8770Example request:
8771
8772~~~json
8773{
8774  "params": {
8775    "name": "vfu.0",
8776    "scsi_target_num": 0
8777  },
8778  "jsonrpc": "2.0",
8779  "method": "vfu_virtio_scsi_remove_target",
8780  "id": 1
8781}
8782~~~
8783
8784Example response:
8785
8786~~~json
8787{
8788  "jsonrpc": "2.0",
8789  "id": 1,
8790  "result": true
8791}
8792~~~
8793
8794### vfu_virtio_create_scsi_endpoint {#rpc_vfu_virtio_create_scsi_endpoint}
8795
8796Create vfio-user virtio-scsi PCI endpoint.
8797
8798#### Parameters
8799
8800Name                    | Optional | Type        | Description
8801----------------------- | -------- | ----------- | -----------
8802name                    | Required | string      | Endpoint name
8803cpumask                 | Optional | string      | CPU masks
8804num_io_queues           | Optional | number      | Number of IO queues
8805qsize                   | Optional | number      | Queue size
8806packed_ring             | Optional | boolean     | Enable packed ring
8807
8808#### Example
8809
8810Example request:
8811
8812~~~json
8813{
8814  "params": {
8815    "name": "vfu.0",
8816    "cpumask": "0x2",
8817    "num_io_queues": 4,
8818    "qsize": 256
8819  },
8820  "jsonrpc": "2.0",
8821  "method": "vfu_virtio_create_scsi_endpoint",
8822  "id": 1
8823}
8824~~~
8825
8826Example response:
8827
8828~~~json
8829{
8830  "jsonrpc": "2.0",
8831  "id": 1,
8832  "result": true
8833}
8834~~~
8835
8836## Vhost Target {#jsonrpc_components_vhost_tgt}
8837
8838The following common preconditions need to be met in all target types.
8839
8840Controller name will be used to create UNIX domain socket. This implies that name concatenated with vhost socket
8841directory path needs to be valid UNIX socket name.
8842
8843@ref cpu_mask parameter is used to choose CPU on which pollers will be launched when new initiator is connecting.
8844It must be a subset of application CPU mask. Default value is CPU mask of the application.
8845
8846### vhost_controller_set_coalescing {#rpc_vhost_controller_set_coalescing}
8847
8848Controls interrupt coalescing for specific target. Because `delay_base_us` is used to calculate delay in CPU ticks
8849there is no hardcoded limit for this parameter. Only limitation is that final delay in CPU ticks might not overflow
885032 bit unsigned integer (which is more than 1s @ 4GHz CPU). In real scenarios `delay_base_us` should be much lower
8851than 150us. To disable coalescing set `delay_base_us` to 0.
8852
8853#### Parameters
8854
8855Name                    | Optional | Type        | Description
8856----------------------- | -------- | ----------- | -----------
8857ctrlr                   | Required | string      | Controller name
8858delay_base_us           | Required | number      | Base (minimum) coalescing time in microseconds
8859iops_threshold          | Required | number      | Coalescing activation level greater than 0 in IO per second
8860
8861#### Example
8862
8863Example request:
8864
8865~~~json
8866{
8867  "params": {
8868    "iops_threshold": 100000,
8869    "ctrlr": "VhostScsi0",
8870    "delay_base_us": 80
8871  },
8872  "jsonrpc": "2.0",
8873  "method": "vhost_controller_set_coalescing",
8874  "id": 1
8875}
8876~~~
8877
8878Example response:
8879
8880~~~json
8881{
8882  "jsonrpc": "2.0",
8883  "id": 1,
8884  "result": true
8885}
8886~~~
8887
8888### vhost_create_scsi_controller {#rpc_vhost_create_scsi_controller}
8889
8890Construct vhost SCSI target.
8891
8892#### Parameters
8893
8894Name                    | Optional | Type        | Description
8895----------------------- | -------- | ----------- | -----------
8896ctrlr                   | Required | string      | Controller name
8897cpumask                 | Optional | string      | @ref cpu_mask for this controller
8898
8899#### Example
8900
8901Example request:
8902
8903~~~json
8904{
8905  "params": {
8906    "cpumask": "0x2",
8907    "ctrlr": "VhostScsi0"
8908  },
8909  "jsonrpc": "2.0",
8910  "method": "vhost_create_scsi_controller",
8911  "id": 1
8912}
8913~~~
8914
8915Example response:
8916
8917~~~json
8918{
8919  "jsonrpc": "2.0",
8920  "id": 1,
8921  "result": true
8922}
8923~~~
8924
8925### vhost_scsi_controller_add_target {#rpc_vhost_scsi_controller_add_target}
8926
8927In vhost target `ctrlr` create SCSI target with ID `scsi_target_num` and add `bdev_name` as LUN 0.
8928
8929#### Parameters
8930
8931Name                    | Optional | Type        | Description
8932----------------------- | -------- | ----------- | -----------
8933ctrlr                   | Required | string      | Controller name
8934scsi_target_num         | Required | number      | SCSI target ID between 0 and 7 or -1 to use first free ID.
8935bdev_name               | Required | string      | Name of bdev to expose as a LUN 0
8936
8937#### Response
8938
8939SCSI target ID.
8940
8941#### Example
8942
8943Example request:
8944
8945~~~json
8946{
8947  "params": {
8948    "scsi_target_num": 1,
8949    "bdev_name": "Malloc0",
8950    "ctrlr": "VhostScsi0"
8951  },
8952  "jsonrpc": "2.0",
8953  "method": "vhost_scsi_controller_add_target",
8954  "id": 1
8955}
8956~~~
8957
8958Example response:
8959
8960~~~json
8961response:
8962{
8963  "jsonrpc": "2.0",
8964  "id": 1,
8965  "result": 1
8966}
8967~~~
8968
8969### vhost_scsi_controller_remove_target {#rpc_vhost_scsi_controller_remove_target}
8970
8971Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`.
8972
8973This method will fail if initiator is connected, but doesn't support hot-remove (the `VIRTIO_SCSI_F_HOTPLUG` is not negotiated).
8974
8975#### Parameters
8976
8977Name                    | Optional | Type        | Description
8978----------------------- | -------- | ----------- | -----------
8979ctrlr                   | Required | string      | Controller name
8980scsi_target_num         | Required | number      | SCSI target ID between 0 and 7
8981
8982#### Example
8983
8984Example request:
8985
8986~~~json
8987request:
8988{
8989  "params": {
8990    "scsi_target_num": 1,
8991    "ctrlr": "VhostScsi0"
8992  },
8993  "jsonrpc": "2.0",
8994  "method": "vhost_scsi_controller_remove_target",
8995  "id": 1
8996}
8997~~~
8998
8999Example response:
9000
9001~~~json
9002{
9003  "jsonrpc": "2.0",
9004  "id": 1,
9005  "result": true
9006}
9007~~~
9008
9009### virtio_blk_create_transport {#rpc_virtio_blk_create_transport}
9010
9011Create virtio blk transport.
9012
9013#### Parameters
9014
9015Name                    | Optional | Type        | Description
9016----------------------- | -------- | ----------- | -----------
9017name                    | Required | string      | Transport name
9018
9019#### Example
9020
9021Example request:
9022
9023~~~json
9024{
9025  "params": {
9026    "name": "vhost_user_blk"
9027  },
9028  "jsonrpc": "2.0",
9029  "method": "virtio_blk_create_transport",
9030  "id": 1
9031}
9032~~~
9033
9034Example response:
9035
9036~~~json
9037{
9038  "jsonrpc": "2.0",
9039  "id": 1,
9040  "result": true
9041}
9042~~~
9043
9044### virtio_blk_get_transports {#rpc_virtio_blk_get_transports}
9045
9046#### Parameters
9047
9048The user may specify no parameters in order to list all transports,
9049or a transport name may be specified.
9050
9051Name                        | Optional | Type        | Description
9052--------------------------- | -------- | ------------| -----------
9053name                        | Optional | string      | Transport name.
9054
9055#### Example
9056
9057Example request:
9058
9059~~~json
9060{
9061  "jsonrpc": "2.0",
9062  "method": "virtio_blk_get_transports",
9063  "id": 1
9064}
9065~~~
9066
9067Example response:
9068
9069~~~json
9070{
9071  "jsonrpc": "2.0",
9072  "id": 1,
9073  "result": [
9074    {
9075      "name": "vhost_user_blk"
9076    }
9077  ]
9078}
9079~~~
9080
9081### vhost_create_blk_controller {#rpc_vhost_create_blk_controller}
9082
9083Create vhost block controller
9084
9085If `readonly` is `true` then vhost block target will be created as read only and fail any write requests.
9086The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator.
9087
9088#### Parameters
9089
9090Name                    | Optional | Type        | Description
9091----------------------- | -------- | ----------- | -----------
9092ctrlr                   | Required | string      | Controller name
9093bdev_name               | Required | string      | Name of bdev to expose block device
9094readonly                | Optional | boolean     | If true, this target will be read only (default: false)
9095cpumask                 | Optional | string      | @ref cpu_mask for this controller
9096transport               | Optional | string      | virtio blk transport name (default: vhost_user_blk)
9097
9098#### Example
9099
9100Example request:
9101
9102~~~json
9103{
9104  "params": {
9105    "dev_name": "Malloc0",
9106    "ctrlr": "VhostBlk0"
9107  },
9108  "jsonrpc": "2.0",
9109  "method": "vhost_create_blk_controller",
9110  "id": 1
9111}
9112~~~
9113
9114Example response:
9115
9116~~~json
9117{
9118  "jsonrpc": "2.0",
9119  "id": 1,
9120  "result": true
9121}
9122~~~
9123
9124### vhost_get_controllers {#rpc_vhost_get_controllers}
9125
9126Display information about all or specific vhost controller(s).
9127
9128#### Parameters
9129
9130The user may specify no parameters in order to list all controllers, or a controller may be
9131specified by name.
9132
9133Name                    | Optional | Type        | Description
9134----------------------- | -------- | ----------- | -----------
9135name                    | Optional | string      | Vhost controller name
9136
9137#### Response {#rpc_vhost_get_controllers_response}
9138
9139Response is an array of objects describing requested controller(s). Common fields are:
9140
9141Name                    | Type        | Description
9142----------------------- | ----------- | -----------
9143ctrlr                   | string      | Controller name
9144cpumask                 | string      | @ref cpu_mask of this controller
9145delay_base_us           | number      | Base (minimum) coalescing time in microseconds (0 if disabled)
9146iops_threshold          | number      | Coalescing activation level
9147backend_specific        | object      | Backend specific information
9148
9149### Vhost block {#rpc_vhost_get_controllers_blk}
9150
9151`backend_specific` contains one `block` object  of type:
9152
9153Name                    | Type        | Description
9154----------------------- | ----------- | -----------
9155bdev                    | string      | Backing bdev name or Null if bdev is hot-removed
9156readonly                | boolean     | True if controllers is readonly, false otherwise
9157
9158### Vhost SCSI {#rpc_vhost_get_controllers_scsi}
9159
9160`backend_specific` contains `scsi` array of following objects:
9161
9162Name                    | Type        | Description
9163----------------------- | ----------- | -----------
9164target_name             | string      | Name of this SCSI target
9165id                      | number      | Unique SPDK global SCSI target ID
9166scsi_dev_num            | number      | SCSI target ID initiator will see when scanning this controller
9167luns                    | array       | array of objects describing @ref rpc_vhost_get_controllers_scsi_luns
9168
9169### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns}
9170
9171Object of type:
9172
9173Name                    | Type        | Description
9174----------------------- | ----------- | -----------
9175id                      | number      | SCSI LUN ID
9176bdev_name               | string      | Backing bdev name
9177
9178### Vhost NVMe {#rpc_vhost_get_controllers_nvme}
9179
9180`backend_specific` contains `namespaces` array of following objects:
9181
9182Name                    | Type        | Description
9183----------------------- | ----------- | -----------
9184nsid                    | number      | Namespace ID
9185bdev                    | string      | Backing bdev name
9186
9187#### Example
9188
9189Example request:
9190
9191~~~json
9192{
9193  "jsonrpc": "2.0",
9194  "method": "vhost_get_controllers",
9195  "id": 1
9196}
9197~~~
9198
9199Example response:
9200
9201~~~json
9202{
9203  "jsonrpc": "2.0",
9204  "id": 1,
9205  "result": [
9206    {
9207      "cpumask": "0x2",
9208      "backend_specific": {
9209        "block": {
9210          "readonly": false,
9211          "bdev": "Malloc0"
9212        }
9213      },
9214      "iops_threshold": 60000,
9215      "ctrlr": "VhostBlk0",
9216      "delay_base_us": 100
9217    },
9218    {
9219      "cpumask": "0x2",
9220      "backend_specific": {
9221        "scsi": [
9222          {
9223            "target_name": "Target 2",
9224            "luns": [
9225              {
9226                "id": 0,
9227                "bdev_name": "Malloc1"
9228              }
9229            ],
9230            "id": 0,
9231            "scsi_dev_num": 2
9232          },
9233          {
9234            "target_name": "Target 5",
9235            "luns": [
9236              {
9237                "id": 0,
9238                "bdev_name": "Malloc2"
9239              }
9240            ],
9241            "id": 1,
9242            "scsi_dev_num": 5
9243          }
9244        ]
9245      },
9246      "iops_threshold": 60000,
9247      "ctrlr": "VhostScsi0",
9248      "delay_base_us": 0
9249    },
9250    {
9251      "cpumask": "0x2",
9252      "backend_specific": {
9253        "namespaces": [
9254          {
9255            "bdev": "Malloc3",
9256            "nsid": 1
9257          },
9258          {
9259            "bdev": "Malloc4",
9260            "nsid": 2
9261          }
9262        ]
9263      },
9264      "iops_threshold": 60000,
9265      "ctrlr": "VhostNvme0",
9266      "delay_base_us": 0
9267    }
9268  ]
9269}
9270~~~
9271
9272### vhost_delete_controller {#rpc_vhost_delete_controller}
9273
9274Remove vhost target.
9275
9276This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of
9277vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_vhost_scsi_controller_remove_target.
9278
9279#### Parameters
9280
9281Name                    | Optional | Type        | Description
9282----------------------- | -------- | ----------- | -----------
9283ctrlr                   | Required | string      | Controller name
9284
9285#### Example
9286
9287Example request:
9288
9289~~~json
9290{
9291  "params": {
9292    "ctrlr": "VhostNvme0"
9293  },
9294  "jsonrpc": "2.0",
9295  "method": "vhost_delete_controller",
9296  "id": 1
9297}
9298~~~
9299
9300Example response:
9301
9302~~~json
9303{
9304  "jsonrpc": "2.0",
9305  "id": 1,
9306  "result": true
9307}
9308~~~
9309
9310## Logical Volume {#jsonrpc_components_lvol}
9311
9312Identification of logical volume store and logical volume is explained first.
9313
9314A logical volume store has a UUID and a name for its identification.
9315The UUID is generated on creation and it can be used as a unique identifier.
9316The name is specified on creation and can be renamed.
9317Either UUID or name is used to access logical volume store in RPCs.
9318
9319A logical volume has a UUID and a name for its identification.
9320The UUID of the logical volume is generated on creation and it can be unique identifier.
9321The alias of the logical volume takes the format _lvs_name/lvol_name_ where:
9322
9323* _lvs_name_ is the name of the logical volume store.
9324* _lvol_name_ is specified on creation and can be renamed.
9325
9326### bdev_lvol_create_lvstore {#rpc_bdev_lvol_create_lvstore}
9327
9328Construct a logical volume store.
9329
9330#### Parameters
9331
9332Name                          | Optional | Type        | Description
9333----------------------------- | -------- | ----------- | -----------
9334bdev_name                     | Required | string      | Bdev on which to construct logical volume store
9335lvs_name                      | Required | string      | Name of the logical volume store to create
9336cluster_sz                    | Optional | number      | Cluster size of the logical volume store in bytes (Default: 4MiB)
9337clear_method                  | Optional | string      | Change clear method for data region. Available: none, unmap (default), write_zeroes
9338num_md_pages_per_cluster_ratio| Optional | number      | Reserved metadata pages per cluster (Default: 100)
9339
9340The num_md_pages_per_cluster_ratio defines the amount of metadata to
9341allocate when the logical volume store is created. The default value
9342is '100', which translates to 1 4KiB per cluster. For the default 4MiB
9343cluster size, this equates to about 0.1% of the underlying block
9344device allocated for metadata. Logical volume stores can be grown, if
9345the size of the underlying block device grows in the future, but only
9346if enough metadata pages were allocated to support the growth. So
9347num_md_pages_per_cluster_ratio should be set to a higher value if
9348wanting to support future growth. For example,
9349num_md_pages_per_cluster_ratio = 200 would support future 2x growth of
9350the logical volume store, and would result in 0.2% of the underlying
9351block device allocated for metadata (with a default 4MiB cluster
9352size).
9353
9354#### Response
9355
9356UUID of the created logical volume store is returned.
9357
9358#### Example
9359
9360Example request:
9361
9362~~~json
9363{
9364  "jsonrpc": "2.0",
9365  "id": 1,
9366  "method": "bdev_lvol_create_lvstore",
9367  "params": {
9368    "lvs_name": "LVS0",
9369    "bdev_name": "Malloc0"
9370    "clear_method": "write_zeroes"
9371  }
9372}
9373~~~
9374
9375Example response:
9376
9377~~~json
9378{
9379  "jsonrpc": "2.0",
9380  "id": 1,
9381  "result": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
9382}
9383~~~
9384
9385### bdev_lvol_delete_lvstore {#rpc_bdev_lvol_delete_lvstore}
9386
9387Destroy a logical volume store.
9388
9389#### Parameters
9390
9391Name                    | Optional | Type        | Description
9392----------------------- | -------- | ----------- | -----------
9393uuid                    | Optional | string      | UUID of the logical volume store to destroy
9394lvs_name                | Optional | string      | Name of the logical volume store to destroy
9395
9396Either uuid or lvs_name must be specified, but not both.
9397
9398#### Example
9399
9400Example request:
9401
9402~~~json
9403{
9404  "jsonrpc": "2.0",
9405  "method": "bdev_lvol_delete_lvstore",
9406  "id": 1
9407  "params": {
9408    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
9409  }
9410}
9411~~~
9412
9413Example response:
9414
9415~~~json
9416{
9417  "jsonrpc": "2.0",
9418  "id": 1,
9419  "result": true
9420}
9421~~~
9422
9423### bdev_lvol_get_lvstores {#rpc_bdev_lvol_get_lvstores}
9424
9425Get a list of logical volume stores.
9426
9427#### Parameters
9428
9429Name                    | Optional | Type        | Description
9430----------------------- | -------- | ----------- | -----------
9431uuid                    | Optional | string      | UUID of the logical volume store to retrieve information about
9432lvs_name                | Optional | string      | Name of the logical volume store to retrieve information about
9433
9434Either uuid or lvs_name may be specified, but not both.
9435If both uuid and lvs_name are omitted, information about all logical volume stores is returned.
9436
9437#### Example
9438
9439Example request:
9440
9441~~~json
9442{
9443  "jsonrpc": "2.0",
9444  "method": "bdev_lvol_get_lvstores",
9445  "id": 1,
9446  "params": {
9447    "lvs_name": "LVS0"
9448  }
9449}
9450~~~
9451
9452Example response:
9453
9454~~~json
9455{
9456  "jsonrpc": "2.0",
9457  "id": 1,
9458  "result": [
9459    {
9460      "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5",
9461      "base_bdev": "Malloc0",
9462      "free_clusters": 31,
9463      "cluster_size": 4194304,
9464      "total_data_clusters": 31,
9465      "block_size": 4096,
9466      "name": "LVS0"
9467    }
9468  ]
9469}
9470~~~
9471
9472### bdev_lvol_rename_lvstore {#rpc_bdev_lvol_rename_lvstore}
9473
9474Rename a logical volume store.
9475
9476#### Parameters
9477
9478Name                    | Optional | Type        | Description
9479----------------------- | -------- | ----------- | -----------
9480old_name                | Required | string      | Existing logical volume store name
9481new_name                | Required | string      | New logical volume store name
9482
9483#### Example
9484
9485Example request:
9486
9487~~~json
9488{
9489  "jsonrpc": "2.0",
9490  "method": "bdev_lvol_rename_lvstore",
9491  "id": 1,
9492  "params": {
9493    "old_name": "LVS0",
9494    "new_name": "LVS2"
9495  }
9496}
9497~~~
9498
9499Example response:
9500
9501~~~json
9502{
9503  "jsonrpc": "2.0",
9504  "id": 1,
9505  "result": true
9506}
9507~~~
9508
9509### bdev_lvol_grow_lvstore {#rpc_bdev_lvol_grow_lvstore}
9510
9511Grow the logical volume store to fill the underlying bdev
9512
9513#### Parameters
9514
9515Name                    | Optional | Type        | Description
9516----------------------- | -------- | ----------- | -----------
9517uuid                    | Optional | string      | UUID of the logical volume store to grow
9518lvs_name                | Optional | string      | Name of the logical volume store to grow
9519
9520Either uuid or lvs_name must be specified, but not both.
9521
9522#### Example
9523
9524Example request:
9525
9526~~~json
9527{
9528  "jsonrpc": "2.0",
9529  "method": "bdev_lvol_grow_lvstore",
9530  "id": 1
9531  "params": {
9532    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
9533  }
9534}
9535~~~
9536
9537Example response:
9538
9539~~~json
9540{
9541  "jsonrpc": "2.0",
9542  "id": 1,
9543  "result": true
9544}
9545~~~
9546
9547### bdev_lvol_create {#rpc_bdev_lvol_create}
9548
9549Create a logical volume on a logical volume store.
9550
9551#### Parameters
9552
9553Name                    | Optional | Type        | Description
9554----------------------- | -------- | ----------- | -----------
9555lvol_name               | Required | string      | Name of logical volume to create
9556size                    | Optional | number      | Desired size of logical volume in bytes (Deprecated. Please use size_in_mib instead.)
9557size_in_mib             | Optional | number      | Desired size of logical volume in MiB
9558thin_provision          | Optional | boolean     | True to enable thin provisioning
9559uuid                    | Optional | string      | UUID of logical volume store to create logical volume on
9560lvs_name                | Optional | string      | Name of logical volume store to create logical volume on
9561clear_method            | Optional | string      | Change default data clusters clear method. Available: none, unmap, write_zeroes
9562
9563Size will be rounded up to a multiple of cluster size. Either uuid or lvs_name must be specified, but not both.
9564lvol_name will be used in the alias of the created logical volume.
9565
9566#### Response
9567
9568UUID of the created logical volume is returned.
9569
9570#### Example
9571
9572Example request:
9573
9574~~~json
9575{
9576  "jsonrpc": "2.0",
9577  "method": "bdev_lvol_create",
9578  "id": 1,
9579  "params": {
9580    "lvol_name": "LVOL0",
9581    "size_in_mib": 1,
9582    "lvs_name": "LVS0",
9583    "clear_method": "unmap",
9584    "thin_provision": true
9585  }
9586}
9587~~~
9588
9589Example response:
9590
9591~~~json
9592{
9593  "jsonrpc": "2.0",
9594  "id": 1,
9595  "result": "1b38702c-7f0c-411e-a962-92c6a5a8a602"
9596}
9597~~~
9598
9599### bdev_lvol_snapshot {#rpc_bdev_lvol_snapshot}
9600
9601Capture a snapshot of the current state of a logical volume.
9602
9603#### Parameters
9604
9605Name                    | Optional | Type        | Description
9606----------------------- | -------- | ----------- | -----------
9607lvol_name               | Required | string      | UUID or alias of the logical volume to create a snapshot from
9608snapshot_name           | Required | string      | Name for the newly created snapshot
9609
9610#### Response
9611
9612UUID of the created logical volume snapshot is returned.
9613
9614#### Example
9615
9616Example request:
9617
9618~~~json
9619{
9620  "jsonrpc": "2.0",
9621  "method": "bdev_lvol_snapshot",
9622  "id": 1,
9623  "params": {
9624    "lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602",
9625    "snapshot_name": "SNAP1"
9626  }
9627}
9628~~~
9629
9630Example response:
9631
9632~~~json
9633{
9634  "jsonrpc": "2.0",
9635  "id": 1,
9636  "result": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670"
9637}
9638~~~
9639
9640### bdev_lvol_clone {#rpc_bdev_lvol_clone}
9641
9642Create a logical volume based on a snapshot.
9643
9644#### Parameters
9645
9646Name                    | Optional | Type        | Description
9647----------------------- | -------- | ----------- | -----------
9648snapshot_name           | Required | string      | UUID or alias of the snapshot to clone
9649clone_name              | Required | string      | Name for the logical volume to create
9650
9651#### Response
9652
9653UUID of the created logical volume clone is returned.
9654
9655#### Example
9656
9657Example request:
9658
9659~~~json
9660{
9661  "jsonrpc": "2.0"
9662  "method": "bdev_lvol_clone",
9663  "id": 1,
9664  "params": {
9665    "snapshot_name": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670",
9666    "clone_name": "CLONE1"
9667  }
9668}
9669~~~
9670
9671Example response:
9672
9673~~~json
9674{
9675  "jsonrpc": "2.0",
9676  "id": 1,
9677  "result": "8d87fccc-c278-49f0-9d4c-6237951aca09"
9678}
9679~~~
9680
9681### bdev_lvol_clone_bdev {#rpc_bdev_lvol_clone_bdev}
9682
9683Create a logical volume based on an external snapshot bdev. The external snapshot bdev
9684is a bdev that will not be written to by any consumer and must not be an lvol in the
9685lvstore as the clone.
9686
9687Regardless of whether the bdev is specified by name or UUID, the bdev UUID will be stored
9688in the logical volume's metadata for use while the lvolstore is loading. For this reason,
9689it is important that the bdev chosen has a static UUID.
9690
9691#### Parameters
9692
9693Name                    | Optional | Type        | Description
9694----------------------- | -------- | ----------- | -----------
9695bdev                    | Required | string      | Name or UUID for bdev that acts as the external snapshot
9696lvs_name                | Required | string      | logical volume store name
9697clone_name              | Required | string      | Name for the logical volume to create
9698
9699#### Response
9700
9701UUID of the created logical volume clone is returned.
9702
9703#### Example
9704
9705Example request:
9706
9707~~~json
9708{
9709  "jsonrpc": "2.0",
9710  "method": "bdev_lvol_clone_bdev",
9711  "id": 1,
9712  "params": {
9713    "bdev_uuid": "e4b40d8b-f623-416d-8234-baf5a4c83cbd",
9714    "lvs_name": "lvs1",
9715    "clone_name": "clone2"
9716  }
9717}
9718~~~
9719
9720Example response:
9721
9722~~~json
9723{
9724  "jsonrpc": "2.0",
9725  "id": 1,
9726  "result": "336f662b-08e5-4006-8e06-e2023f7f9886"
9727}
9728~~~
9729
9730### bdev_lvol_rename {#rpc_bdev_lvol_rename}
9731
9732Rename a logical volume. New name will rename only the alias of the logical volume.
9733
9734#### Parameters
9735
9736Name                    | Optional | Type        | Description
9737----------------------- | -------- | ----------- | -----------
9738old_name                | Required | string      | UUID or alias of the existing logical volume
9739new_name                | Required | string      | New logical volume name
9740
9741#### Example
9742
9743Example request:
9744
9745~~~json
9746{
9747  "jsonrpc": "2.0",
9748  "method": "bdev_lvol_rename",
9749  "id": 1,
9750  "params": {
9751    "old_name": "067df606-6dbc-4143-a499-0d05855cb3b8",
9752    "new_name": "LVOL2"
9753  }
9754}
9755~~~
9756
9757Example response:
9758
9759~~~json
9760{
9761  "jsonrpc": "2.0",
9762  "id": 1,
9763  "result": true
9764}
9765~~~
9766
9767### bdev_lvol_resize {#rpc_bdev_lvol_resize}
9768
9769Resize a logical volume.
9770
9771#### Parameters
9772
9773Name                    | Optional | Type        | Description
9774----------------------- | -------- | ----------- | -----------
9775name                    | Required | string      | UUID or alias of the logical volume to resize
9776size                    | Optional | number      | Desired size of the logical volume in bytes (Deprecated. Please use size_in_mib instead.)
9777size_in_mib             | Optional | number      | Desired size of the logical volume in MiB
9778
9779#### Example
9780
9781Example request:
9782
9783~~~json
9784{
9785  "jsonrpc": "2.0",
9786  "method": "bdev_lvol_resize",
9787  "id": 1,
9788  "params": {
9789    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
9790    "size_in_mib": 2
9791  }
9792}
9793~~~
9794
9795Example response:
9796
9797~~~json
9798{
9799  "jsonrpc": "2.0",
9800  "id": 1,
9801  "result": true
9802}
9803~~~
9804
9805### bdev_lvol_set_read_only{#rpc_bdev_lvol_set_read_only}
9806
9807Mark logical volume as read only.
9808
9809#### Parameters
9810
9811Name                    | Optional | Type        | Description
9812----------------------- | -------- | ----------- | -----------
9813name                    | Required | string      | UUID or alias of the logical volume to set as read only
9814
9815#### Example
9816
9817Example request:
9818
9819~~~json
9820{
9821  "jsonrpc": "2.0",
9822  "method": "bdev_lvol_set_read_only",
9823  "id": 1,
9824  "params": {
9825    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
9826  }
9827}
9828~~~
9829
9830Example response:
9831
9832~~~json
9833{
9834  "jsonrpc": "2.0",
9835  "id": 1,
9836  "result": true
9837}
9838~~~
9839
9840### bdev_lvol_delete {#rpc_bdev_lvol_delete}
9841
9842Destroy a logical volume.
9843
9844#### Parameters
9845
9846Name                    | Optional | Type        | Description
9847----------------------- | -------- | ----------- | -----------
9848name                    | Required | string      | UUID or alias of the logical volume to destroy
9849
9850#### Example
9851
9852Example request:
9853
9854~~~json
9855{
9856  "jsonrpc": "2.0",
9857  "method": "bdev_lvol_delete",
9858  "id": 1,
9859  "params": {
9860    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a"
9861  }
9862}
9863~~~
9864
9865Example response:
9866
9867~~~json
9868{
9869  "jsonrpc": "2.0",
9870  "id": 1,
9871  "result": true
9872}
9873~~~
9874
9875### bdev_lvol_inflate {#rpc_bdev_lvol_inflate}
9876
9877Inflate a logical volume. All unallocated clusters are allocated and copied from the parent or zero filled
9878if not allocated in the parent. Then all dependencies on the parent are removed.
9879
9880### Parameters
9881
9882Name                    | Optional | Type        | Description
9883----------------------- | -------- | ----------- | -----------
9884name                    | Required | string      | UUID or alias of the logical volume to inflate
9885
9886#### Example
9887
9888Example request:
9889
9890~~~json
9891{
9892  "jsonrpc": "2.0",
9893  "method": "bdev_lvol_inflate",
9894  "id": 1,
9895  "params": {
9896    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
9897  }
9898}
9899~~~
9900
9901Example response:
9902
9903~~~json
9904{
9905  "jsonrpc": "2.0",
9906  "id": 1,
9907  "result": true
9908}
9909~~~
9910
9911### bdev_lvol_decouple_parent {#rpc_bdev_lvol_decouple_parent}
9912
9913Decouple the parent of a logical volume. For unallocated clusters which is allocated in the parent, they are
9914allocated and copied from the parent, but for unallocated clusters which is thin provisioned in the parent,
9915they are kept thin provisioned. Then all dependencies on the parent are removed.
9916
9917#### Parameters
9918
9919Name                    | Optional | Type        | Description
9920----------------------- | -------- | ----------- | -----------
9921name                    | Required | string      | UUID or alias of the logical volume to decouple the parent of it
9922
9923#### Example
9924
9925Example request:
9926
9927~~~json
9928{
9929  "jsonrpc": "2.0",
9930  "method": "bdev_lvol_decouple_parent",
9931  "id": 1.
9932  "params": {
9933    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
9934  }
9935}
9936~~~
9937
9938Example response:
9939
9940~~~json
9941{
9942  "jsonrpc": "2.0",
9943  "id": 1,
9944  "result": true
9945}
9946~~~
9947
9948### bdev_lvol_get_lvols {#rpc_bdev_lvol_get_lvols}
9949
9950Get a list of logical volumes. This list can be limited by lvol store and will display volumes even if
9951they are degraded. Degraded lvols do not have an associated bdev, thus this RPC call may return lvols
9952not returned by `bdev_get_bdevs`.
9953
9954#### Parameters
9955
9956Name                    | Optional | Type        | Description
9957----------------------- | -------- | ----------- | -----------
9958lvs_uuid                | Optional | string      | Only show volumes in the logical volume store with this UUID
9959lvs_name                | Optional | string      | Only show volumes in the logical volume store with this name
9960
9961Either lvs_uuid or lvs_name may be specified, but not both.
9962If both lvs_uuid and lvs_name are omitted, information about lvols in all logical volume stores is returned.
9963
9964#### Example
9965
9966Example request:
9967
9968~~~json
9969{
9970  "jsonrpc": "2.0",
9971  "method": "bdev_lvol_get_lvols",
9972  "id": 1,
9973  "params": {
9974    "lvs_name": "lvs_test"
9975  }
9976}
9977~~~
9978
9979Example response:
9980
9981~~~json
9982[
9983  {
9984    "alias": "lvs_test/lvol1",
9985    "uuid": "b335c368-851d-4099-81e0-018cc494fdf6",
9986    "name": "lvol1",
9987    "is_thin_provisioned": false,
9988    "is_snapshot": false,
9989    "is_clone": false,
9990    "is_esnap_clone": false,
9991    "is_degraded": false,
9992    "lvs": {
9993      "name": "lvs_test",
9994      "uuid": "a1c8d950-5715-4558-936d-ab9e6eca0794"
9995    }
9996  }
9997]
9998~~~
9999
10000## RAID
10001
10002### bdev_raid_get_bdevs {#rpc_bdev_raid_get_bdevs}
10003
10004This is used to list all the raid bdev details based on the input category requested. Category should be one
10005of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether they are online or
10006configuring or offline. 'online' is the raid bdev which is registered with bdev layer. 'configuring' is
10007the raid bdev which does not have full configuration discovered yet. 'offline' is the raid bdev which is
10008not registered with bdev as of now and it has encountered any error or user has requested to offline
10009the raid bdev.
10010
10011#### Parameters
10012
10013Name                    | Optional | Type        | Description
10014----------------------- | -------- | ----------- | -----------
10015category                | Required | string      | all or online or configuring or offline
10016
10017#### Example
10018
10019Example request:
10020
10021~~~json
10022{
10023  "jsonrpc": "2.0",
10024  "method": "bdev_raid_get_bdevs",
10025  "id": 1,
10026  "params": {
10027    "category": "all"
10028  }
10029}
10030~~~
10031
10032Example response:
10033
10034~~~json
10035{
10036  "jsonrpc": "2.0",
10037  "id": 1,
10038  "result": [
10039    {
10040      "name": "RaidBdev0",
10041      "strip_size_kb": 128,
10042      "state": "online",
10043      "raid_level": "raid0",
10044      "num_base_bdevs": 2,
10045      "num_base_bdevs_discovered": 2,
10046      "base_bdevs_list": [
10047        "malloc0",
10048        "malloc1"
10049      ]
10050    },
10051    {
10052      "name": "RaidBdev1",
10053      "strip_size_kb": 128,
10054      "state": "configuring",
10055      "raid_level": "raid0",
10056      "num_base_bdevs": 2,
10057      "num_base_bdevs_discovered": 1,
10058      "base_bdevs_list": [
10059        "malloc2",
10060        null
10061      ]
10062    }
10063  ]
10064}
10065~~~
10066
10067### bdev_raid_create {#rpc_bdev_raid_create}
10068
10069Constructs new RAID bdev.
10070
10071#### Parameters
10072
10073Name                    | Optional | Type        | Description
10074----------------------- | -------- | ----------- | -----------
10075name                    | Required | string      | RAID bdev name
10076strip_size_kb           | Required | number      | Strip size in KB
10077raid_level              | Required | string      | RAID level
10078base_bdevs              | Required | string      | Base bdevs name, whitespace separated list in quotes
10079
10080#### Example
10081
10082Example request:
10083
10084~~~json
10085{
10086  "jsonrpc": "2.0",
10087  "method": "bdev_raid_create",
10088  "id": 1,
10089  "params": {
10090    "name": "Raid0",
10091    "raid_level": "0",
10092    "base_bdevs": [
10093      "Malloc0",
10094      "Malloc1",
10095      "Malloc2",
10096      "Malloc3"
10097    ],
10098    "strip_size_kb": 4
10099  }
10100}
10101~~~
10102
10103Example response:
10104
10105~~~json
10106{
10107  "jsonrpc": "2.0",
10108  "id": 1,
10109  "result": true
10110}
10111~~~
10112
10113### bdev_raid_delete {#rpc_bdev_raid_delete}
10114
10115Removes RAID bdev.
10116
10117#### Parameters
10118
10119Name                    | Optional | Type        | Description
10120----------------------- | -------- | ----------- | -----------
10121name                    | Required | string      | RAID bdev name
10122
10123#### Example
10124
10125Example request:
10126
10127~~~json
10128{
10129  "jsonrpc": "2.0",
10130  "method": "bdev_raid_delete",
10131  "id": 1,
10132  "params": {
10133    "name": "Raid0"
10134  }
10135}
10136~~~
10137
10138Example response:
10139
10140~~~json
10141{
10142  "jsonrpc": "2.0",
10143  "id": 1,
10144  "result": true
10145}
10146~~~
10147
10148## SPLIT
10149
10150### bdev_split_create {#rpc_bdev_split_create}
10151
10152This is used to split an underlying block device and create several smaller equal-sized vbdevs.
10153
10154#### Parameters
10155
10156Name                    | Optional | Type        | Description
10157----------------------- | -------- | ----------- | -----------
10158base_bdev               | Required | string      | base bdev name
10159split_count             | Required | number      | number of splits
10160split_size_mb           | Optional | number      | size in MB to restrict the size
10161
10162#### Example
10163
10164Example request:
10165
10166~~~json
10167{
10168  "jsonrpc": "2.0",
10169  "method": "bdev_split_create",
10170  "id": 1,
10171  "params": {
10172    "base_bdev": "Malloc0",
10173    "split_count": 4
10174  }
10175}
10176~~~
10177
10178Example response:
10179
10180~~~json
10181{
10182  "jsonrpc": "2.0",
10183  "id": 1,
10184  "result": [
10185    "Malloc0p0",
10186    "Malloc0p1",
10187    "Malloc0p2",
10188    "Malloc0p3"
10189  ]
10190}
10191~~~
10192
10193### bdev_split_delete {#rpc_bdev_split_delete}
10194
10195This is used to remove the split vbdevs.
10196
10197#### Parameters
10198
10199Name                    | Optional | Type        | Description
10200----------------------- | -------- | ----------- | -----------
10201base_bdev               | Required | string      | base bdev name
10202
10203#### Example
10204
10205Example request:
10206
10207~~~json
10208{
10209  "jsonrpc": "2.0",
10210  "method": "bdev_split_delete",
10211  "id": 1,
10212  "params": {
10213    "base_bdev": "Malloc0"
10214  }
10215}
10216~~~
10217
10218Example response:
10219
10220~~~json
10221{
10222  "jsonrpc": "2.0",
10223  "id": 1,
10224  "result": true
10225}
10226~~~
10227
10228## Uring
10229
10230### bdev_uring_create {#rpc_bdev_uring_create}
10231
10232Create a bdev with io_uring backend.
10233
10234#### Parameters
10235
10236Name                    | Optional | Type        | Description
10237----------------------- | -------- | ----------- | -----------
10238filename                | Required | string      | path to device or file (ex: /dev/nvme0n1)
10239name                    | Required | string      | name of bdev
10240block_size              | Optional | number      | block size of device (If omitted, get the block size from the file)
10241
10242#### Example
10243
10244Example request:
10245
10246~~~json
10247{
10248  "jsonrpc": "2.0",
10249  "method": "bdev_uring_create",
10250  "id": 1,
10251  "params": {
10252    "name": "bdev_u0",
10253    "filename": "/dev/nvme0n1",
10254    "block_size": 512
10255  }
10256}
10257~~~
10258
10259Example response:
10260
10261~~~json
10262{
10263  "jsonrpc": "2.0",
10264  "id": 1,
10265  "result": "bdev_u0"
10266}
10267~~~
10268
10269### bdev_uring_delete {#rpc_bdev_uring_delete}
10270
10271Remove a uring bdev.
10272
10273#### Parameters
10274
10275Name                    | Optional | Type        | Description
10276----------------------- | -------- | ----------- | -----------
10277name                    | Required | string      | name of uring bdev to delete
10278
10279#### Example
10280
10281Example request:
10282
10283~~~json
10284{
10285  "jsonrpc": "2.0",
10286  "method": "bdev_uring_delete",
10287  "id": 1,
10288  "params": {
10289    "name": "bdev_u0"
10290  }
10291}
10292~~~
10293
10294Example response:
10295
10296~~~json
10297{
10298  "jsonrpc": "2.0",
10299  "id": 1,
10300  "result": true
10301}
10302~~~
10303
10304## OPAL
10305
10306### bdev_nvme_opal_init {#rpc_bdev_nvme_opal_init}
10307
10308This is used to initialize OPAL of a given NVMe ctrlr, including taking ownership and activating.
10309
10310#### Parameters
10311
10312Name                    | Optional | Type        | Description
10313----------------------- | -------- | ----------- | -----------
10314nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
10315password                | Required | string      | admin password of OPAL
10316
10317#### Example
10318
10319Example request:
10320
10321~~~json
10322{
10323  "jsonrpc": "2.0",
10324  "method": "bdev_nvme_opal_init",
10325  "id": 1,
10326  "params": {
10327    "nvme_ctrlr_name": "nvme0",
10328    "password": "*****"
10329  }
10330}
10331~~~
10332
10333Example response:
10334
10335~~~json
10336{
10337  "jsonrpc": "2.0",
10338  "id": 1,
10339  "result": true
10340}
10341~~~
10342
10343### bdev_nvme_opal_revert {#rpc_bdev_nvme_opal_revert}
10344
10345This is used to revert OPAL to its factory settings. Erase all user configuration and data.
10346
10347#### Parameters
10348
10349Name                    | Optional | Type        | Description
10350----------------------- | -------- | ----------- | -----------
10351nvme_ctrlr_name         | Required | string      | name of nvme ctrlr
10352password                | Required | string      | admin password of OPAL
10353
10354#### Example
10355
10356Example request:
10357
10358~~~json
10359{
10360  "jsonrpc": "2.0",
10361  "method": "bdev_nvme_opal_revert",
10362  "id": 1,
10363  "params": {
10364    "nvme_ctrlr_name": "nvme0",
10365    "password": "*****"
10366  }
10367}
10368~~~
10369
10370Example response:
10371
10372~~~json
10373{
10374  "jsonrpc": "2.0",
10375  "id": 1,
10376  "result": true
10377}
10378~~~
10379
10380### bdev_opal_create {#rpc_bdev_opal_create}
10381
10382This is used to create an OPAL virtual bdev.
10383
10384#### Parameters
10385
10386Name                    | Optional | Type        | Description
10387----------------------- | -------- | ----------- | -----------
10388nvme_ctrlr_name         | Required | string      | name of nvme ctrlr that supports OPAL
10389nsid                    | Required | number      | namespace ID
10390locking_range_id        | Required | number      | OPAL locking range ID
10391range_start             | Required | number      | locking range start LBA
10392range_length            | Required | number      | locking range length
10393password                | Required | string      | admin password of OPAL
10394
10395#### Response
10396
10397The response is the name of created OPAL virtual bdev.
10398
10399#### Example
10400
10401Example request:
10402
10403~~~json
10404{
10405  "jsonrpc": "2.0",
10406  "method": "bdev_opal_create",
10407  "id": 1,
10408  "params": {
10409    "nvme_ctrlr_name": "nvme0",
10410    "nsid": 1,
10411    "locking_range_id": 1,
10412    "range_start": 0,
10413    "range_length": 4096,
10414    "password": "*****"
10415  }
10416}
10417~~~
10418
10419Example response:
10420
10421~~~json
10422{
10423  "jsonrpc": "2.0",
10424  "id": 1,
10425  "result": "nvme0n1r1"
10426}
10427~~~
10428
10429### bdev_opal_get_info {#rpc_bdev_opal_get_info}
10430
10431This is used to get information of a given OPAL bdev.
10432
10433#### Parameters
10434
10435Name                    | Optional | Type        | Description
10436----------------------- | -------- | ----------- | -----------
10437bdev_name               | Required | string      | name of OPAL vbdev
10438password                | Required | string      | admin password
10439
10440#### Response
10441
10442The response is the locking info of OPAL virtual bdev.
10443
10444#### Example
10445
10446Example request:
10447
10448~~~json
10449{
10450  "jsonrpc": "2.0",
10451  "method": "bdev_opal_get_info",
10452  "id": 1,
10453  "params": {
10454    "bdev_name": "nvme0n1r1",
10455    "password": "*****"
10456  }
10457}
10458~~~
10459
10460Example response:
10461
10462~~~json
10463{
10464  "jsonrpc": "2.0",
10465  "id": 1,
10466  "result": {
10467      "name": "nvme0n1r1",
10468      "range_start": 0,
10469      "range_length": 4096,
10470      "read_lock_enabled": true,
10471      "write_lock_enabled": true,
10472      "read_locked": false,
10473      "write_locked": false
10474    }
10475}
10476~~~
10477
10478### bdev_opal_delete {#rpc_bdev_opal_delete}
10479
10480This is used to delete OPAL vbdev.
10481
10482#### Parameters
10483
10484Name                    | Optional | Type        | Description
10485----------------------- | -------- | ----------- | -----------
10486bdev_name               | Required | string      | name of OPAL vbdev
10487password                | Required | string      | admin password
10488
10489#### Example
10490
10491Example request:
10492
10493~~~json
10494{
10495  "jsonrpc": "2.0",
10496  "method": "bdev_opal_delete",
10497  "id": 1,
10498  "params": {
10499    "bdev_name": "nvme0n1r1",
10500    "password": "*****"
10501  }
10502}
10503~~~
10504
10505Example response:
10506
10507~~~json
10508{
10509  "jsonrpc": "2.0",
10510  "id": 1,
10511  "result": true
10512}
10513~~~
10514
10515### bdev_opal_new_user {#rpc_bdev_opal_new_user}
10516
10517This enables a new user to the specified opal bdev so that the user can lock/unlock the bdev.
10518Recalling this for the same opal bdev, only the newest user will have the privilege.
10519
10520#### Parameters
10521
10522Name                    | Optional | Type        | Description
10523----------------------- | -------- | ----------- | -----------
10524bdev_name               | Required | string      | name of OPAL vbdev
10525admin_password          | Required | string      | admin password
10526user_id                 | Required | number      | user ID
10527user_password           | Required | string      | user password
10528
10529#### Example
10530
10531Example request:
10532
10533~~~json
10534{
10535  "jsonrpc": "2.0",
10536  "method": "bdev_opal_new_user",
10537  "id": 1,
10538  "params": {
10539    "bdev_name": "nvme0n1r1",
10540    "admin_password": "*****",
10541    "user_id": "1",
10542    "user_password": "********"
10543  }
10544}
10545~~~
10546
10547Example response:
10548
10549~~~json
10550{
10551  "jsonrpc": "2.0",
10552  "id": 1,
10553  "result": true
10554}
10555~~~
10556
10557### bdev_opal_set_lock_state {#rpc_bdev_opal_set_lock_state}
10558
10559This is used to lock/unlock specific opal bdev providing user ID and password.
10560
10561#### Parameters
10562
10563Name                    | Optional | Type        | Description
10564----------------------- | -------- | ----------- | -----------
10565bdev_name               | Required | string      | name of OPAL vbdev
10566user_id                 | Required | number      | user ID
10567password                | Required | string      | user password
10568lock_state              | Required | string      | lock state
10569
10570#### Example
10571
10572Example request:
10573
10574~~~json
10575{
10576  "jsonrpc": "2.0",
10577  "method": "bdev_opal_set_lock_state",
10578  "id": 1,
10579  "params": {
10580    "bdev_name": "nvme0n1r1",
10581    "user_id": "1",
10582    "user_password": "********",
10583    "lock_state": "rwlock"
10584  }
10585}
10586~~~
10587
10588Example response:
10589
10590~~~json
10591{
10592  "jsonrpc": "2.0",
10593  "id": 1,
10594  "result": true
10595}
10596~~~
10597
10598## Notifications
10599
10600### notify_get_types {#rpc_notify_get_types}
10601
10602Return list of all supported notification types.
10603
10604#### Parameters
10605
10606None
10607
10608#### Response
10609
10610The response is an array of strings - supported RPC notification types.
10611
10612#### Example
10613
10614Example request:
10615
10616~~~json
10617{
10618  "jsonrpc": "2.0",
10619  "method": "notify_get_types",
10620  "id": 1
10621}
10622~~~
10623
10624Example response:
10625
10626~~~json
10627{
10628  "id": 1,
10629  "result": [
10630    "bdev_register",
10631    "bdev_unregister"
10632  ],
10633  "jsonrpc": "2.0"
10634}
10635~~~
10636
10637### notify_get_notifications {#notify_get_notifications}
10638
10639Request notifications. Returns array of notifications that happened since the specified id (or first that is available).
10640
10641Notice: Notifications are kept in circular buffer with limited size. Older notifications might be inaccessible
10642due to being overwritten by new ones.
10643
10644#### Parameters
10645
10646Name                    | Optional | Type        | Description
10647----------------------- | -------- | ----------- | -----------
10648id                      | Optional | number      | First Event ID to fetch (default: first available).
10649max                     | Optional | number      | Maximum number of event to return (default: no limit).
10650
10651#### Response
10652
10653Response is an array of event objects.
10654
10655Name                    | Optional | Type        | Description
10656----------------------- | -------- | ----------- | -----------
10657id                      | Optional | number      | Event ID.
10658type                    | Optional | number      | Type of the event.
10659ctx                     | Optional | string      | Event context.
10660
10661#### Example
10662
10663Example request:
10664
10665~~~json
10666{
10667  "id": 1,
10668  "jsonrpc": "2.0",
10669  "method": "notify_get_notifications",
10670  "params": {
10671    "id": 1,
10672    "max": 10
10673  }
10674}
10675
10676~~~
10677
10678Example response:
10679
10680~~~json
10681{
10682  "jsonrpc": "2.0",
10683  "id": 1,
10684  "result": [
10685    {
10686      "ctx": "Malloc0",
10687      "type": "bdev_register",
10688      "id": 1
10689    },
10690    {
10691      "ctx": "Malloc2",
10692      "type": "bdev_register",
10693      "id": 2
10694    }
10695  ]
10696}
10697~~~
10698
10699## Linux Userspace Block Device (UBLK) {#jsonrpc_components_ublk}
10700
10701SPDK supports exporting bdevs though Linux ublk. The motivation behind it is to back a Linux kernel block device
10702with an SPDK user space bdev.
10703
10704To export a device over ublk, first make sure the Linux kernel ublk driver is loaded by running 'modprobe ublk_drv'.
10705
10706### ublk_create_target {#rpc_ublk_create_target}
10707
10708Start to create ublk threads and initialize ublk target. It will return an error if user calls this RPC twice without
10709ublk_destroy_target in between. It will use current cpumask in SPDK when user does not specify cpumask option.
10710
10711#### Parameters
10712
10713Name                    | Optional | Type        | Description
10714----------------------- | -------- | ----------- | -----------
10715cpumask                 | Optional | string      | Cpumask for ublk target
10716
10717#### Response
10718
10719True if ublk target initialization is successful; False if failed.
10720
10721#### Example
10722
10723Example request:
10724
10725~~~json
10726{
10727  "params": {
10728    "cpumask": "0x2"
10729  },
10730  "jsonrpc": "2.0",
10731  "method": "ublk_create_target",
10732  "id": 1
10733}
10734~~~
10735
10736Example response:
10737
10738~~~json
10739{
10740  "jsonrpc": "2.0",
10741  "id": 1,
10742  "result": true
10743}
10744~~~
10745
10746### ublk_destroy_target {#rpc_ublk_destroy_target}
10747
10748Release all UBLK devices and destroy ublk target.
10749
10750#### Response
10751
10752True if ublk target destruction is successful; False if failed.
10753
10754#### Example
10755
10756Example request:
10757
10758~~~json
10759{
10760  "jsonrpc": "2.0",
10761  "method": "ublk_destroy_target",
10762  "id": 1
10763}
10764~~~
10765
10766Example response:
10767
10768~~~json
10769{
10770  "jsonrpc": "2.0",
10771  "id": 1,
10772  "result": true
10773}
10774~~~
10775
10776### ublk_start_disk {#rpc_ublk_start_disk}
10777
10778Start to export one SPDK bdev as a UBLK device
10779
10780#### Parameters
10781
10782Name                    | Optional | Type        | Description
10783----------------------- | -------- | ----------- | -----------
10784bdev_name               | Required | string      | Bdev name to export
10785ublk_id                 | Required | int         | Device id
10786queue_depth             | Optional | int         | Device queue depth
10787num_queues              | Optional | int         | Total number of device queues
10788
10789#### Response
10790
10791UBLK device ID
10792
10793#### Example
10794
10795Example request:
10796
10797~~~json
10798{
10799 "params": {
10800    "ublk_id": "1",
10801    "bdev_name": "Malloc1"
10802  },
10803  "jsonrpc": "2.0",
10804  "method": "ublk_start_disk",
10805  "id": 1
10806}
10807~~~
10808
10809Example response:
10810
10811~~~json
10812{
10813  "jsonrpc": "2.0",
10814  "id": 1,
10815  "result": 1
10816}
10817~~~
10818
10819### ublk_stop_disk {#rpc_ublk_stop_disk}
10820
10821Delete a UBLK device
10822
10823#### Parameters
10824
10825Name                    | Optional | Type        | Description
10826----------------------- | -------- | ----------- | -----------
10827ublk_id                 | Required | int         | Device id to delete
10828
10829#### Response
10830
10831True if UBLK device is deleted successfully; False if failed.
10832
10833#### Example
10834
10835Example request:
10836
10837~~~json
10838{
10839 "params": {
10840    "ublk_id": "1",
10841  },
10842  "jsonrpc": "2.0",
10843  "method": "ublk_stop_disk",
10844  "id": 1
10845}
10846~~~
10847
10848Example response:
10849
10850~~~json
10851{
10852  "jsonrpc": "2.0",
10853  "id": 1,
10854  "result": true
10855}
10856~~~
10857
10858### ublk_get_disks {#rpc_ublk_get_disks}
10859
10860Display full or specified ublk device list
10861
10862#### Parameters
10863
10864Name                    | Optional | Type        | Description
10865----------------------- | -------- | ----------- | -----------
10866ublk_id                 | Optional | int         | ublk device id to display
10867
10868#### Response
10869
10870Display ublk device list
10871
10872#### Example
10873
10874Example request:
10875
10876~~~json
10877{
10878  "jsonrpc": "2.0",
10879  "method": "ublk_get_disks",
10880  "id": 1
10881}
10882~~~
10883
10884Example response:
10885
10886~~~json
10887{
10888  "jsonrpc": "2.0",
10889  "id": 1,
10890  "result":  [
10891    {
10892      "ublk_device": "/dev/ublkb1",
10893      "id": 1,
10894      "queue_depth": 512,
10895      "num_queues": 1,
10896      "bdev_name": "Malloc1"
10897    }
10898  ]
10899}
10900~~~
10901
10902## Linux Network Block Device (NBD) {#jsonrpc_components_nbd}
10903
10904SPDK supports exporting bdevs through Linux nbd. These devices then appear as standard Linux kernel block devices
10905and can be accessed using standard utilities like fdisk.
10906
10907In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.
10908
10909### nbd_start_disk {#rpc_nbd_start_disk}
10910
10911Start to export one SPDK bdev as NBD disk
10912
10913#### Parameters
10914
10915Name                    | Optional | Type        | Description
10916----------------------- | -------- | ----------- | -----------
10917bdev_name               | Required | string      | Bdev name to export
10918nbd_device              | Optional | string      | NBD device name to assign
10919
10920#### Response
10921
10922Path of exported NBD disk
10923
10924#### Example
10925
10926Example request:
10927
10928~~~json
10929{
10930 "params": {
10931    "nbd_device": "/dev/nbd1",
10932    "bdev_name": "Malloc1"
10933  },
10934  "jsonrpc": "2.0",
10935  "method": "nbd_start_disk",
10936  "id": 1
10937}
10938~~~
10939
10940Example response:
10941
10942~~~json
10943{
10944  "jsonrpc": "2.0",
10945  "id": 1,
10946  "result": "/dev/nbd1"
10947}
10948~~~
10949
10950### nbd_stop_disk {#rpc_nbd_stop_disk}
10951
10952Stop one NBD disk which is based on SPDK bdev.
10953
10954#### Parameters
10955
10956Name                    | Optional | Type        | Description
10957----------------------- | -------- | ----------- | -----------
10958nbd_device              | Required | string      | NBD device name to stop
10959
10960#### Example
10961
10962Example request:
10963
10964~~~json
10965{
10966 "params": {
10967    "nbd_device": "/dev/nbd1",
10968  },
10969  "jsonrpc": "2.0",
10970  "method": "nbd_stop_disk",
10971  "id": 1
10972}
10973~~~
10974
10975Example response:
10976
10977~~~json
10978{
10979  "jsonrpc": "2.0",
10980  "id": 1,
10981  "result": "true"
10982}
10983~~~
10984
10985### nbd_get_disks {#rpc_nbd_get_disks}
10986
10987Display all or specified NBD device list
10988
10989#### Parameters
10990
10991Name                    | Optional | Type        | Description
10992----------------------- | -------- | ----------- | -----------
10993nbd_device              | Optional | string      | NBD device name to display
10994
10995#### Response
10996
10997The response is an array of exported NBD devices and their corresponding SPDK bdev.
10998
10999#### Example
11000
11001Example request:
11002
11003~~~json
11004{
11005  "jsonrpc": "2.0",
11006  "method": "nbd_get_disks",
11007  "id": 1
11008}
11009~~~
11010
11011Example response:
11012
11013~~~json
11014{
11015  "jsonrpc": "2.0",
11016  "id": 1,
11017  "result":  [
11018    {
11019      "bdev_name": "Malloc0",
11020      "nbd_device": "/dev/nbd0"
11021    },
11022    {
11023      "bdev_name": "Malloc1",
11024      "nbd_device": "/dev/nbd1"
11025    }
11026  ]
11027}
11028~~~
11029
11030## Blobfs {#jsonrpc_components_blobfs}
11031
11032### blobfs_detect {#rpc_blobfs_detect}
11033
11034Detect whether a blobfs exists on bdev.
11035
11036#### Parameters
11037
11038Name                    | Optional | Type        | Description
11039----------------------- | -------- | ----------- | -----------
11040bdev_name               | Required | string      | Block device name to detect blobfs
11041
11042#### Response
11043
11044True if a blobfs exists on the bdev; False otherwise.
11045
11046#### Example
11047
11048Example request:
11049
11050~~~json
11051{
11052  "jsonrpc": "2.0",
11053  "id": 1,
11054  "method": "blobfs_detect",
11055  "params": {
11056    "bdev_name": "Malloc0"
11057  }
11058}
11059~~~
11060
11061Example response:
11062
11063~~~json
11064{
11065  "jsonrpc": "2.0",
11066  "id": 1,
11067  "result": "true"
11068}
11069~~~
11070
11071### blobfs_create {#rpc_blobfs_create}
11072
11073Build blobfs on bdev.
11074
11075#### Parameters
11076
11077Name                    | Optional | Type        | Description
11078----------------------- | -------- | ----------- | -----------
11079bdev_name               | Required | string      | Block device name to create blobfs
11080cluster_sz              | Optional | number      | Size of cluster in bytes. Must be multiple of 4KiB page size, default and minimal value is 1M.
11081
11082#### Example
11083
11084Example request:
11085
11086~~~json
11087{
11088  "jsonrpc": "2.0",
11089  "id": 1,
11090  "method": "blobfs_create",
11091  "params": {
11092    "bdev_name": "Malloc0",
11093    "cluster_sz": 1M
11094  }
11095}
11096~~~
11097
11098Example response:
11099
11100~~~json
11101{
11102  "jsonrpc": "2.0",
11103  "id": 1,
11104  "result": "true"
11105}
11106~~~
11107
11108### blobfs_mount {#rpc_blobfs_mount}
11109
11110Mount a blobfs on bdev to one host path through FUSE
11111
11112#### Parameters
11113
11114Name                    | Optional | Type        | Description
11115----------------------- | -------- | ----------- | -----------
11116bdev_name               | Required | string      | Block device name where the blobfs is
11117mountpoint              | Required | string      | Mountpoint path in host to mount blobfs
11118
11119#### Example
11120
11121Example request:
11122
11123~~~json
11124{
11125  "jsonrpc": "2.0",
11126  "id": 1,
11127  "method": ""blobfs_mount"",
11128  "params": {
11129    "bdev_name": "Malloc0",
11130    "mountpoint": "/mnt/"
11131  }
11132}
11133~~~
11134
11135Example response:
11136
11137~~~json
11138{
11139  "jsonrpc": "2.0",
11140  "id": 1,
11141  "result": "true"
11142}
11143~~~
11144
11145### blobfs_set_cache_size {#rpc_blobfs_set_cache_size}
11146
11147Set cache pool size for blobfs filesystems.  This RPC is only permitted when the cache pool is not already initialized.
11148
11149The cache pool is initialized when the first blobfs filesystem is initialized or loaded.  It is freed when the all
11150initialized or loaded filesystems are unloaded.
11151
11152#### Parameters
11153
11154Name                    | Optional | Type        | Description
11155----------------------- | -------- | ----------- | -----------
11156size_in_mb              | Required | number      | Cache size in megabytes
11157
11158#### Response
11159
11160True if cache size is set successfully; False if failed to set.
11161
11162#### Example
11163
11164Example request:
11165
11166~~~json
11167{
11168  "jsonrpc": "2.0",
11169  "id": 1,
11170  "method": "blobfs_set_cache_size",
11171  "params": {
11172    "size_in_mb": 512,
11173  }
11174}
11175~~~
11176
11177Example response:
11178
11179~~~json
11180{
11181  "jsonrpc": "2.0",
11182  "id": 1,
11183  "result": true
11184}
11185~~~
11186
11187## Socket layer {#jsonrpc_components_sock}
11188
11189### sock_impl_get_options {#rpc_sock_impl_get_options}
11190
11191Get parameters for the socket layer implementation.
11192
11193#### Parameters
11194
11195Name                    | Optional | Type        | Description
11196----------------------- | -------- | ----------- | -----------
11197impl_name               | Required | string      | Name of socket implementation, e.g. posix
11198
11199#### Response
11200
11201Response is an object with current socket layer options for requested implementation.
11202
11203#### Example
11204
11205Example request:
11206
11207~~~json
11208{
11209  "jsonrpc": "2.0",
11210  "method": "sock_impl_get_options",
11211  "id": 1,
11212  "params": {
11213    "impl_name": "posix"
11214  }
11215}
11216~~~
11217
11218Example response:
11219
11220~~~json
11221{
11222  "jsonrpc": "2.0",
11223  "id": 1,
11224  "result": {
11225    "recv_buf_size": 2097152,
11226    "send_buf_size": 2097152,
11227    "enable_recv_pipe": true,
11228    "enable_quickack": true,
11229    "enable_placement_id": 0,
11230    "enable_zerocopy_send_server": true,
11231    "enable_zerocopy_send_client": false,
11232    "zerocopy_threshold": 0,
11233    "tls_version": 13,
11234    "enable_ktls": false,
11235    "psk_key": "1234567890ABCDEF",
11236    "psk_identity": "psk.spdk.io"
11237  }
11238}
11239~~~
11240
11241### sock_impl_set_options {#rpc_sock_impl_set_options}
11242
11243Set parameters for the socket layer implementation.
11244
11245#### Parameters
11246
11247Name                        | Optional | Type        | Description
11248--------------------------- | -------- | ----------- | -----------
11249impl_name                   | Required | string      | Name of socket implementation, e.g. posix
11250recv_buf_size               | Optional | number      | Size of socket receive buffer in bytes
11251send_buf_size               | Optional | number      | Size of socket send buffer in bytes
11252enable_recv_pipe            | Optional | boolean     | Enable or disable receive pipe
11253enable_quick_ack            | Optional | boolean     | Enable or disable quick ACK
11254enable_placement_id         | Optional | number      | Enable or disable placement_id. 0:disable,1:incoming_napi,2:incoming_cpu
11255enable_zerocopy_send_server | Optional | boolean     | Enable or disable zero copy on send for server sockets
11256enable_zerocopy_send_client | Optional | boolean     | Enable or disable zero copy on send for client sockets
11257zerocopy_threshold          | Optional | number      | Set zerocopy_threshold in bytes. A consecutive sequence of requests' iovecs
11258--                          | --       | --          | that fall below this threshold may be sent without zerocopy flag set
11259tls_version                 | Optional | number      | TLS protocol version, e.g. 13 for v1.3 (only applies when impl_name == ssl)
11260enable_ktls                 | Optional | boolean     | Enable or disable Kernel TLS (only applies when impl_name == ssl)
11261psk_key                     | Optional | string      | Default PSK KEY in hexadecimal digits, e.g. 1234567890ABCDEF (only applies when impl_name == ssl)
11262psk_identity                | Optional | string      | Default PSK ID, e.g. psk.spdk.io (only applies when impl_name == ssl)
11263
11264#### Response
11265
11266True if socket layer options were set successfully.
11267
11268#### Example
11269
11270Example request:
11271
11272~~~json
11273{
11274  "jsonrpc": "2.0",
11275  "method": "sock_impl_set_options",
11276  "id": 1,
11277  "params": {
11278    "impl_name": "posix",
11279    "recv_buf_size": 2097152,
11280    "send_buf_size": 2097152,
11281    "enable_recv_pipe": false,
11282    "enable_quick_ack": false,
11283    "enable_placement_id": 0,
11284    "enable_zerocopy_send_server": true,
11285    "enable_zerocopy_send_client": false,
11286    "zerocopy_threshold": 10240,
11287    "tls_version": 13,
11288    "enable_ktls": false,
11289    "psk_key": "1234567890ABCDEF",
11290    "psk_identity": "psk.spdk.io"
11291  }
11292}
11293~~~
11294
11295Example response:
11296
11297~~~json
11298{
11299  "jsonrpc": "2.0",
11300  "id": 1,
11301  "result": true
11302}
11303~~~
11304
11305### sock_set_default_impl {#rpc_sock_set_default_impl}
11306
11307Set the default sock implementation.
11308
11309#### Parameters
11310
11311Name                    | Optional | Type        | Description
11312----------------------- | -------- | ----------- | -----------
11313impl_name               | Required | string      | Name of socket implementation, e.g. posix
11314
11315#### Response
11316
11317True if the default socket layer configuration was set successfully.
11318
11319#### Example
11320
11321Example request:
11322
11323~~~json
11324{
11325  "jsonrpc": "2.0",
11326  "method": "sock_set_default_impl",
11327  "id": 1,
11328  "params": {
11329    "impl_name": "posix"
11330  }
11331}
11332~~~
11333
11334Example response:
11335
11336~~~json
11337{
11338  "jsonrpc": "2.0",
11339  "id": 1,
11340  "result": true
11341}
11342~~~
11343
11344## Miscellaneous RPC commands
11345
11346### bdev_nvme_send_cmd {#rpc_bdev_nvme_send_cmd}
11347
11348Send NVMe command directly to NVMe controller or namespace. Parameters and responses encoded by base64 urlsafe need further processing.
11349
11350Notice: bdev_nvme_send_cmd requires user to guarantee the correctness of NVMe command itself, and also optional parameters.
11351Illegal command contents or mismatching buffer size may result in unpredictable behavior.
11352
11353#### Parameters
11354
11355Name                    | Optional | Type        | Description
11356----------------------- | -------- | ----------- | -----------
11357name                    | Required | string      | Name of the operating NVMe controller
11358cmd_type                | Required | string      | Type of nvme cmd. Valid values are: admin, io
11359data_direction          | Required | string      | Direction of data transfer. Valid values are: c2h, h2c
11360cmdbuf                  | Required | string      | NVMe command encoded by base64 urlsafe
11361data                    | Optional | string      | Data transferring to controller from host, encoded by base64 urlsafe
11362metadata                | Optional | string      | Metadata transferring to controller from host, encoded by base64 urlsafe
11363data_len                | Optional | number      | Data length required to transfer from controller to host
11364metadata_len            | Optional | number      | Metadata length required to transfer from controller to host
11365timeout_ms              | Optional | number      | Command execution timeout value, in milliseconds
11366
11367#### Response
11368
11369Name                    | Type        | Description
11370----------------------- | ----------- | -----------
11371cpl                     | string      | NVMe completion queue entry, encoded by base64 urlsafe
11372data                    | string      | Data transferred from controller to host, encoded by base64 urlsafe
11373metadata                | string      | Metadata transferred from controller to host, encoded by base64 urlsafe
11374
11375#### Example
11376
11377Example request:
11378
11379~~~json
11380{
11381  "jsonrpc": "2.0",
11382  "method": "bdev_nvme_send_cmd",
11383  "id": 1,
11384  "params": {
11385    "name": "Nvme0",
11386    "cmd_type": "admin"
11387    "data_direction": "c2h",
11388    "cmdbuf": "BgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAsGUs9P5_AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
11389    "data_len": 60,
11390  }
11391}
11392~~~
11393
11394Example response:
11395
11396~~~json
11397{
11398  "jsonrpc": "2.0",
11399  "id": 1,
11400  "result":  {
11401    "cpl": "AAAAAAAAAAARAAAAWrmwABAA==",
11402    "data": "sIjg6AAAAACwiODoAAAAALCI4OgAAAAAAAYAAREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
11403  }
11404
11405}
11406~~~
11407
11408### vmd_enable {#rpc_enable_vmd}
11409
11410Enable VMD enumeration.
11411
11412#### Parameters
11413
11414This method has no parameters.
11415
11416#### Response
11417
11418Completion status of enumeration is returned as a boolean.
11419
11420### Example
11421
11422Example request:
11423
11424~~~json
11425{
11426  "jsonrpc": "2.0",
11427  "method": "vmd_enable",
11428  "id": 1
11429}
11430~~~
11431
11432Example response:
11433
11434~~~json
11435{
11436  "jsonrpc": "2.0",
11437  "id": 1,
11438  "result": true
11439}
11440~~~
11441
11442### vmd_remove_device {#rpc_vmd_remove_device}
11443
11444Remove a device behind a VMD.
11445
11446### Parameters
11447
11448Name                    | Optional | Type        | Description
11449----------------------- | -------- | ----------- | -----------
11450addr                    | Required | string      | Address of the device to remove.
11451
11452### Example
11453
11454~~~json
11455{
11456  "jsonrpc": "2.0",
11457  "method": "vmd_remove_device",
11458  "params": {
11459    "addr": "5d0505:01:00.0"
11460  }
11461  "id": 1
11462}
11463~~~
11464
11465Example response:
11466
11467~~~json
11468{
11469  "jsonrpc": "2.0",
11470  "id": 1,
11471  "result": true
11472}
11473~~~
11474
11475### vmd_rescan {#rpc_vmd_rescan}
11476
11477Force a rescan of the devices behind VMD.
11478
11479### Parameters
11480
11481This method has no parameters.
11482
11483#### Response
11484
11485The response is the number of new devices found.
11486
11487### Example
11488
11489~~~json
11490{
11491  "jsonrpc": "2.0",
11492  "method": "vmd_rescan",
11493  "id": 1
11494}
11495~~~
11496
11497Example response:
11498
11499~~~json
11500{
11501  "jsonrpc": "2.0",
11502  "id": 1,
11503  "result": {
11504    "count": 1
11505  }
11506}
11507~~~
11508
11509### spdk_get_version {#rpc_spdk_get_version}
11510
11511Get the version info of the running SPDK application.
11512
11513#### Parameters
11514
11515This method has no parameters.
11516
11517#### Response
11518
11519The response is the version number including major version number, minor version number, patch level number and suffix string.
11520
11521#### Example
11522
11523Example request:
11524
11525~~~json
11526{
11527  "jsonrpc": "2.0",
11528  "id": 1,
11529  "method": "spdk_get_version"
11530}
11531~~~
11532
11533Example response:
11534
11535~~~json
11536{
11537  "jsonrpc": "2.0",
11538  "id": 1,
11539  "result":  {
11540    "version": "19.04-pre",
11541    "fields" : {
11542      "major": 19,
11543      "minor": 4,
11544      "patch": 0,
11545      "suffix": "-pre"
11546    }
11547  }
11548}
11549~~~
11550
11551### framework_get_pci_devices
11552
11553List PCIe devices attached to an SPDK application and the contents of their config space.
11554
11555#### Parameters
11556
11557This method has no parameters.
11558
11559#### Response
11560
11561The response is an array of attached PCIe devices.
11562
11563#### Example
11564
11565Example request:
11566
11567~~~json
11568{
11569  "jsonrpc": "2.0",
11570  "id": 1,
11571  "method": "framework_get_pci_devices"
11572}
11573~~~
11574
11575Example response:
11576Note that the config space buffer was trimmed.
11577
11578~~~json
11579{
11580  "jsonrpc": "2.0",
11581  "id": 1,
11582  "result": {
11583    [
11584      {
11585        "address": "0000:00:04.0",
11586        "config_space": "8680455807051000...0000000000000000"
11587      },
11588      {
11589        "address": "0000:00:03.0",
11590        "config_space": "8680455807051000...0000000000000000"
11591      }
11592    ]
11593  }
11594}
11595~~~
11596
11597### bdev_nvme_add_error_injection {#rpc_bdev_nvme_add_error_injection}
11598
11599Add a NVMe command error injection for a bdev nvme controller.
11600
11601#### Parameters
11602
11603Name                    | Optional | Type        | Description
11604----------------------- | -------- | ----------- | -----------
11605name                    | Required | string      | Name of the operating NVMe controller
11606cmd_type                | Required | string      | Type of NVMe command. Valid values are: admin, io
11607opc                     | Required | number      | Opcode for which the error injection is applied
11608do_not_submit           | Optional | boolean     | Set to true if request should not be submitted to the controller (default false)
11609timeout_in_us           | Optional | number      | Wait specified microseconds when do_not_submit is true
11610err_count               | Optional | number      | Number of matching NVMe commands to inject errors
11611sct                     | Optional | number      | Status code type (default 0)
11612sc                      | Optional | number      | Status code (default 0)
11613
11614#### Response
11615
11616true on success
11617
11618#### Example
11619
11620Example request:
11621
11622~~~json
11623{
11624  "jsonrpc": "2.0",
11625  "method": "bdev_nvme_add_error_injection",
11626  "id": 1,
11627  "params": {
11628    "name": "HotInNvme0",
11629    "opc": 2,
11630    "cmd_type": "io",
11631    "err_count": 1111111,
11632    "sct": 11,
11633    "sc": 33
11634  }
11635}
11636
11637~~~
11638
11639Example response:
11640
11641~~~json
11642{
11643  "jsonrpc": "2.0",
11644  "id": 1,
11645  "result": true
11646}
11647
11648~~~
11649
11650### bdev_nvme_remove_error_injection {#rpc_bdev_nvme_remove_error_injection}
11651
11652Remove a NVMe command error injection.
11653
11654#### Parameters
11655
11656Name                    | Optional | Type        | Description
11657----------------------- | -------- | ----------- | -----------
11658name                    | Required | string      | Name of the operating NVMe controller
11659cmd_type                | Required | string      | Type of NVMe command. Valid values are: admin, io
11660opc                     | Required | number      | Opcode for which the error injection is applied
11661
11662#### Response
11663
11664true on success
11665
11666#### Example
11667
11668Example request:
11669
11670~~~json
11671{
11672  "jsonrpc": "2.0",
11673  "method": "bdev_nvme_remove_error_injection",
11674  "id": 1,
11675  "params": {
11676    "name": "HotInNvme0",
11677    "opc": 2,
11678    "cmd_type": "io"
11679  }
11680}
11681
11682
11683~~~
11684
11685Example response:
11686
11687~~~json
11688{
11689  "jsonrpc": "2.0",
11690  "id": 1,
11691  "result": true
11692}
11693
11694~~~
11695
11696### bdev_daos_create {#rpc_bdev_daos_create}
11697
11698Construct @ref bdev_config_daos
11699
11700#### Parameters
11701
11702Name                    | Optional | Type        | Description
11703----------------------- | -------- | ----------- | -----------
11704name                    | Required | string      | Bdev name to use
11705pool                    | Required | string      | DAOS pool label or its uuid
11706cont                    | Required | string      | DAOS cont label or its uuid
11707block_size              | Required | number      | Block size in bytes -must be multiple of 512
11708num_blocks              | Required | number      | Number of blocks
11709uuid                    | Optional | string      | UUID of new bdev
11710oclass                  | Optional | string      | DAOS object class (default SX)
11711
11712To find more about various object classes please visit [DAOS documentation](https://github.com/daos-stack/daos/blob/master/src/object/README.md).
11713Please note, that DAOS bdev module uses the same CLI flag notation as `dmg` and `daos` commands,
11714for instance, `SX` or `EC_4P2G2` rather than in DAOS header file `OC_SX` or `OC_EC_4P2G2`.
11715
11716#### Result
11717
11718Name of newly created bdev.
11719
11720#### Example
11721
11722Example request:
11723
11724~~~json
11725{
11726  "params": {
11727    "block_size": 4096,
11728    "num_blocks": 16384,
11729    "name": "daosdev0",
11730    "pool": "test-pool",
11731    "cont": "test-cont",
11732    "oclass": "EC_4P2G2"
11733  },
11734  "jsonrpc": "2.0",
11735  "method": "bdev_daos_create",
11736  "id": 1
11737}
11738~~~
11739
11740Example response:
11741
11742~~~json
11743{
11744  "jsonrpc": "2.0",
11745  "id": 1,
11746  "result": "daosdev0"
11747}
11748~~~
11749
11750### bdev_daos_delete {#rpc_bdev_daos_delete}
11751
11752Delete @ref bdev_config_daos
11753
11754#### Parameters
11755
11756Name                    | Optional | Type        | Description
11757----------------------- | -------- | ----------- | -----------
11758name                    | Required | string      | Bdev name
11759
11760#### Example
11761
11762Example request:
11763
11764~~~json
11765{
11766  "params": {
11767    "name": "daosdev0"
11768  },
11769  "jsonrpc": "2.0",
11770  "method": "bdev_daos_delete",
11771  "id": 1
11772}
11773~~~
11774
11775Example response:
11776
11777~~~json
11778{
11779  "jsonrpc": "2.0",
11780  "id": 1,
11781  "result": true
11782}
11783~~~
11784
11785### bdev_daos_resize {#rpc_bdev_daos_resize}
11786
11787Resize @ref bdev_config_daos.
11788
11789#### Parameters
11790
11791Name                    | Optional | Type        | Description
11792----------------------- | -------- | ----------- | -----------
11793name                    | Required | string      | Bdev name
11794new_size                | Required | number      | Bdev new capacity in MiB
11795
11796#### Example
11797
11798Example request:
11799
11800~~~json
11801{
11802  "params": {
11803    "name": "daosdev0",
11804    "new_size": 8192
11805  },
11806  "jsonrpc": "2.0",
11807  "method": "bdev_daos_resize",
11808  "id": 1
11809}
11810~~~
11811
11812Example response:
11813
11814~~~json
11815{
11816  "jsonrpc": "2.0",
11817  "id": 1,
11818  "result": true
11819}
11820~~~
11821
11822### iobuf_set_options {#rpc_iobuf_set_options}
11823
11824Set iobuf buffer pool options.
11825
11826#### Parameters
11827
11828Name                    | Optional | Type        | Description
11829----------------------- | -------- | ----------- | -----------
11830small_pool_count        | Optional | number      | Number of small buffers in the global pool
11831large_pool_count        | Optional | number      | Number of large buffers in the global pool
11832small_bufsize           | Optional | number      | Size of a small buffer
11833large_bufsize           | Optional | number      | Size of a small buffer
11834
11835#### Example
11836
11837Example request:
11838
11839~~~json
11840{
11841  "jsonrpc": "2.0",
11842  "id": 1,
11843  "method": "iobuf_set_options",
11844  "params": {
11845    "small_pool_count": 16383,
11846    "large_pool_count": 2047
11847  }
11848}
11849~~~
11850
11851Example response:
11852
11853~~~json
11854{
11855  "jsonrpc": "2.0",
11856  "id": 1,
11857  "result": true
11858}
11859~~~
11860
11861### bdev_nvme_start_mdns_discovery {#rpc_bdev_nvme_start_mdns_discovery}
11862
11863Starts an mDNS based discovery service for the specified service type for the
11864auto-discovery of discovery controllers (NVMe TP-8009).
11865
11866The discovery service will listen for the mDNS discovery events from the
11867Avahi-daemon and will connect to the newly learnt discovery controllers.
11868Then the discovery service will automatically attach to any subsystem found in the
11869discovery log page from the discovery controllers learnt using mDNS.
11870When determining a controller name to use when attaching, it will use
11871the 'name' parameter as a prefix, followed by a unique integer assigned for each of the
11872discovery controllers learnt through mDNS, followed by a unique integer for that discovery
11873service. If the discovery service identifies a subsystem that has been previously
11874attached but is listed with a different path, it will use the same controller name
11875as the previous entry, and connect as a multipath.
11876
11877When the discovery service sees that a subsystem entry has been removed
11878from the log page, it will automatically detach from that controller as well.
11879
11880The 'name' is also used to later stop the discovery service.
11881
11882#### Parameters
11883
11884Name                       | Optional | Type        | Description
11885-------------------------- | -------- | ----------- | -----------
11886name                       | Required | string      | Prefix for NVMe discovery services found
11887svcname                    | Required | string      | Service to discover: e.g. _nvme-disc._tcp
11888hostnqn                    | Optional | string      | NVMe-oF hostnqn
11889
11890#### Example
11891
11892Example request:
11893
11894~~~json
11895{
11896  "jsonrpc": "2.0",
11897  "method": "bdev_nvme_start_mdns_discovery",
11898  "id": 1,
11899  "params": {
11900    "name": "cdc_auto",
11901    "svcname": "_nvme-disc._tcp",
11902    "hostnqn": "nqn.2021-12.io.spdk:host1",
11903  }
11904}
11905~~~
11906
11907Example response:
11908
11909~~~json
11910{
11911  "jsonrpc": "2.0",
11912  "id": 1,
11913  "result": true
11914}
11915~~~
11916
11917### bdev_nvme_stop_mdns_discovery {#rpc_bdev_nvme_stop_mdns_discovery}
11918
11919Stops a mDNS discovery service. This includes detaching any controllers that were
11920discovered via the service that is being stopped.
11921
11922#### Parameters
11923
11924Name                       | Optional | Type        | Description
11925-------------------------- | -------- | ----------- | -----------
11926name                       | Required | string      | Name of mDNS discovery instance to stop
11927
11928#### Example
11929
11930Example request:
11931
11932~~~json
11933{
11934  "jsonrpc": "2.0",
11935  "method": "bdev_nvme_stop_mdns_discovery",
11936  "id": 1,
11937  "params": {
11938    "name": "cdc_auto"
11939  }
11940}
11941~~~
11942
11943Example response:
11944
11945~~~json
11946{
11947  "jsonrpc": "2.0",
11948  "id": 1,
11949  "result": true
11950}
11951~~~
11952
11953### bdev_nvme_get_mdns_discovery_info {#rpc_bdev_nvme_get_mdns_discovery_info}
11954
11955Get the information about the mDNS discovery service instances.
11956
11957#### Example
11958
11959Example request:
11960~~~json
11961{
11962  "jsonrpc": "2.0",
11963  "method": "bdev_nvme_get_mdns_discovery_info",
11964  "id": 1
11965}
11966~~~
11967
11968Example response:
11969
11970~~~json
11971[
11972  {
11973    "name": "cdc_auto",
11974    "svcname": "_nvme-disc._tcp",
11975    "referrals": [
11976      {
11977        "name": "cdc_auto0",
11978        "trid": {
11979          "trtype": "TCP",
11980          "adrfam": "IPv4",
11981          "traddr": "66.1.2.21",
11982          "trsvcid": "8009",
11983          "subnqn": "nqn.2014-08.org.nvmexpress.discovery"
11984        }
11985      },
11986      {
11987        "name": "cdc_auto1",
11988        "trid": {
11989          "trtype": "TCP",
11990          "adrfam": "IPv4",
11991          "traddr": "66.1.1.21",
11992          "trsvcid": "8009",
11993          "subnqn": "nqn.2014-08.org.nvmexpress.discovery"
11994        }
11995      }
11996    ]
11997  }
11998]
11999~~~
12000