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