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