xref: /spdk/doc/jsonrpc.md (revision c4d9daeb7bf491bc0eb6e8d417b75d44773cb009)
1# JSON-RPC Methods {#jsonrpc}
2
3# Overview {#jsonrpc_overview}
4
5SPDK implements a [JSON-RPC 2.0](http://www.jsonrpc.org/specification) server
6to allow external management tools to dynamically configure SPDK components.
7
8## Parameters
9
10Most of the commands can take parameters. If present, parameter is validated against its domain. If this check fail
11whole command will fail with response error message [Invalid params](@ref jsonrpc_error_message).
12
13### Required parameters
14
15These parameters are mandatory. If any required parameter is missing RPC command will fail with proper error response.
16
17### Optional parameters
18
19Those parameters might be omitted. If an optional parameter is present it must be valid otherwise command will fail
20proper error response.
21
22## Error response message {#jsonrpc_error_message}
23
24Each error response will contain proper message. As much as possible the message should indicate what went wrong during
25command processing.
26
27There is ongoing effort to customize this messages but some RPC methods just return "Invalid parameters" as message body
28for any kind of error.
29
30Code   | Description
31------ | -----------
32-1     | Invalid state - given method exists but it is not callable in [current runtime state](@ref rpc_start_subsystem_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# App Framework {#jsonrpc_components_app}
58
59## kill_instance {#rpc_kill_instance}
60
61Send a signal to the application.
62
63### Parameters
64
65Name                    | Optional | Type        | Description
66----------------------- | -------- | ----------- | -----------
67sig_name                | Required | string      | Signal to send (SIGINT, SIGTERM, SIGQUIT, SIGHUP, or SIGKILL)
68
69### Example
70
71Example request:
72
73~~~
74{
75  "jsonrpc": "2.0",
76  "id": 1,
77  "method": "kill_instance",
78  "params": {
79    "sig_name": "SIGINT"
80  }
81}
82~~~
83
84Example response:
85
86~~~
87{
88  "jsonrpc": "2.0",
89  "id": 1,
90  "result": true
91}
92~~~
93
94## context_switch_monitor {#rpc_context_switch_monitor}
95
96Query, enable, or disable the context switch monitoring functionality.
97
98### Parameters
99
100Name                    | Optional | Type        | Description
101----------------------- | -------- | ----------- | -----------
102enabled                 | Optional | boolean     | Enable (`true`) or disable (`false`) monitoring (omit this parameter to query the current state)
103
104### Response
105
106Name                    | Type        | Description
107----------------------- | ----------- | -----------
108enabled                 | boolean     | The current state of context switch monitoring
109
110### Example
111
112Example request:
113
114~~~
115{
116  "jsonrpc": "2.0",
117  "id": 1,
118  "method": "context_switch_monitor",
119  "params": {
120    "enabled": false
121  }
122}
123~~~
124
125Example response:
126
127~~~
128{
129  "jsonrpc": "2.0",
130  "id": 1,
131  "result": {
132    "enabled": false
133  }
134}
135~~~
136
137## start_subsystem_init {#rpc_start_subsystem_init}
138
139Start initialization of SPDK subsystems when it is deferred by starting SPDK application with option -w.
140During its deferral some RPCs can be used to set global parameters for SPDK subsystems.
141This RPC can be called only once.
142
143### Parameters
144
145This method has no parameters.
146
147### Response
148
149Completion status of SPDK subsystem initialization is returned as a boolean.
150
151### Example
152
153Example request:
154
155~~~
156{
157  "jsonrpc": "2.0",
158  "id": 1,
159  "method": "start_subsystem_init"
160}
161~~~
162
163Example response:
164
165~~~
166{
167  "jsonrpc": "2.0",
168  "id": 1,
169  "result": true
170}
171~~~
172
173## wait_subsystem_init {#rpc_wait_subsystem_init}
174
175Do not return until all subsystems have been initialized and the RPC system state is running.
176If the application is already running, this call will return immediately. This RPC can be called at any time.
177
178### Parameters
179
180This method has no parameters.
181
182### Response
183
184Returns True when subsystems have been initialized.
185
186### Example
187
188Example request:
189
190~~~
191{
192  "jsonrpc": "2.0",
193  "id": 1,
194  "method": "wait_subsystem_init"
195}
196~~~
197
198Example response:
199
200~~~
201{
202  "jsonrpc": "2.0",
203  "id": 1,
204  "result": true
205}
206~~~
207
208## get_rpc_methods {#rpc_get_rpc_methods}
209
210Get an array of supported RPC methods.
211
212### Parameters
213
214Name                    | Optional | Type        | Description
215----------------------- | -------- | ----------- | -----------
216current                 | Optional | boolean     | Get an array of RPC methods only callable in the current state.
217
218### Response
219
220The response is an array of supported RPC methods.
221
222### Example
223
224Example request:
225
226~~~
227{
228  "jsonrpc": "2.0",
229  "id": 1,
230  "method": "get_rpc_methods"
231}
232~~~
233
234Example response:
235
236~~~
237{
238  "jsonrpc": "2.0",
239  "id": 1,
240  "result": [
241    "start_subsystem_init",
242    "get_rpc_methods",
243    "get_scsi_devices",
244    "get_interfaces",
245    "delete_ip_address",
246    "add_ip_address",
247    "get_nbd_disks",
248    "stop_nbd_disk",
249    "start_nbd_disk",
250    "get_log_flags",
251    "clear_log_flag",
252    "set_log_flag",
253    "get_log_level",
254    "set_log_level",
255    "get_log_print_level",
256    "set_log_print_level",
257    "get_iscsi_global_params",
258    "target_node_add_lun",
259    "get_iscsi_connections",
260    "delete_portal_group",
261    "add_portal_group",
262    "get_portal_groups",
263    "delete_target_node",
264    "delete_pg_ig_maps",
265    "add_pg_ig_maps",
266    "construct_target_node",
267    "get_target_nodes",
268    "delete_initiator_group",
269    "delete_initiators_from_initiator_group",
270    "add_initiators_to_initiator_group",
271    "add_initiator_group",
272    "get_initiator_groups",
273    "set_iscsi_options",
274    "set_bdev_options",
275    "set_bdev_qos_limit",
276    "get_bdevs",
277    "get_bdevs_iostat",
278    "get_subsystem_config",
279    "get_subsystems",
280    "context_switch_monitor",
281    "kill_instance",
282    "scan_ioat_copy_engine",
283    "construct_virtio_dev",
284    "get_virtio_scsi_devs",
285    "remove_virtio_bdev",
286    "delete_aio_bdev",
287    "construct_aio_bdev",
288    "destruct_split_vbdev",
289    "construct_split_vbdev",
290    "bdev_inject_error",
291    "delete_error_bdev",
292    "construct_error_bdev",
293    "construct_passthru_bdev",
294    "apply_nvme_firmware",
295    "delete_nvme_controller",
296    "construct_nvme_bdev",
297    "construct_null_bdev",
298    "delete_malloc_bdev",
299    "construct_malloc_bdev",
300    "delete_ftl_bdev",
301    "construct_ftl_bdev",
302    "get_lvol_stores",
303    "destroy_lvol_bdev",
304    "resize_lvol_bdev",
305    "set_read_only_lvol_bdev",
306    "decouple_parent_lvol_bdev",
307    "inflate_lvol_bdev",
308    "rename_lvol_bdev",
309    "clone_lvol_bdev",
310    "snapshot_lvol_bdev",
311    "construct_lvol_bdev",
312    "destroy_lvol_store",
313    "rename_lvol_store",
314    "construct_lvol_store"
315  ]
316}
317~~~
318
319## get_subsystems {#rpc_get_subsystems}
320
321Get an array of name and dependency relationship of SPDK subsystems in initialization order.
322
323### Parameters
324
325None
326
327### Response
328
329The response is an array of name and dependency relationship of SPDK subsystems in initialization order.
330
331### Example
332
333Example request:
334
335~~~
336{
337  "jsonrpc": "2.0",
338  "id": 1,
339  "method": "get_subsystems"
340}
341~~~
342
343Example response:
344
345~~~
346{
347  "jsonrpc": "2.0",
348  "id": 1,
349  "result": [
350    {
351      "subsystem": "copy",
352      "depends_on": []
353    },
354    {
355      "subsystem": "interface",
356      "depends_on": []
357    },
358    {
359      "subsystem": "net_framework",
360      "depends_on": [
361        "interface"
362      ]
363    },
364    {
365      "subsystem": "bdev",
366      "depends_on": [
367        "copy"
368      ]
369    },
370    {
371      "subsystem": "nbd",
372      "depends_on": [
373        "bdev"
374      ]
375    },
376    {
377      "subsystem": "nvmf",
378      "depends_on": [
379        "bdev"
380      ]
381    },
382    {
383      "subsystem": "scsi",
384      "depends_on": [
385        "bdev"
386      ]
387    },
388    {
389      "subsystem": "vhost",
390      "depends_on": [
391        "scsi"
392      ]
393    },
394    {
395      "subsystem": "iscsi",
396      "depends_on": [
397        "scsi"
398      ]
399    }
400  ]
401}
402~~~
403
404## get_subsystem_config {#rpc_get_subsystem_config}
405
406Get current configuration of the specified SPDK subsystem
407
408### Parameters
409
410Name                    | Optional | Type        | Description
411----------------------- | -------- | ----------- | -----------
412name                    | Required | string      | SPDK subsystem name
413
414### Response
415
416The response is current configuration of the specified SPDK subsystem.
417Null is returned if it is not retrievable by the get_subsystem_config method and empty array is returned if it is empty.
418
419### Example
420
421Example request:
422
423~~~
424{
425  "jsonrpc": "2.0",
426  "id": 1,
427  "method": "get_subsystem_config",
428  "params": {
429    "name": "bdev"
430  }
431}
432~~~
433
434Example response:
435
436~~~
437{
438  "jsonrpc": "2.0",
439  "id": 1,
440  "result": [
441    {
442      "params": {
443        "base_bdev": "Malloc2",
444        "split_size_mb": 0,
445        "split_count": 2
446      },
447      "method": "construct_split_vbdev"
448    },
449    {
450      "params": {
451        "trtype": "PCIe",
452        "name": "Nvme1",
453        "traddr": "0000:01:00.0"
454      },
455      "method": "construct_nvme_bdev"
456    },
457    {
458      "params": {
459        "trtype": "PCIe",
460        "name": "Nvme2",
461        "traddr": "0000:03:00.0"
462      },
463      "method": "construct_nvme_bdev"
464    },
465    {
466      "params": {
467        "block_size": 512,
468        "num_blocks": 131072,
469        "name": "Malloc0",
470        "uuid": "913fc008-79a7-447f-b2c4-c73543638c31"
471      },
472      "method": "construct_malloc_bdev"
473    },
474    {
475      "params": {
476        "block_size": 512,
477        "num_blocks": 131072,
478        "name": "Malloc1",
479        "uuid": "dd5b8f6e-b67a-4506-b606-7fff5a859920"
480      },
481      "method": "construct_malloc_bdev"
482    }
483  ]
484}
485~~~
486
487# Block Device Abstraction Layer {#jsonrpc_components_bdev}
488
489## set_bdev_options {#rpc_set_bdev_options}
490
491Set global parameters for the block device (bdev) subsystem.  This RPC may only be called
492before SPDK subsystems have been initialized.
493
494### Parameters
495
496Name                    | Optional | Type        | Description
497----------------------- | -------- | ----------- | -----------
498bdev_io_pool_size       | Optional | number      | Number of spdk_bdev_io structures in shared buffer pool
499bdev_io_cache_size      | Optional | number      | Maximum number of spdk_bdev_io structures cached per thread
500
501### Example
502
503Example request:
504
505~~~
506{
507  "jsonrpc": "2.0",
508  "id": 1,
509  "method": "set_bdev_options",
510  "params": {
511    "bdev_io_pool_size": 65536,
512    "bdev_io_cache_size": 256
513  }
514}
515~~~
516
517Example response:
518
519~~~
520{
521  "jsonrpc": "2.0",
522  "id": 1,
523  "result": true
524}
525~~~
526
527## get_bdevs {#rpc_get_bdevs}
528
529Get information about block devices (bdevs).
530
531### Parameters
532
533The user may specify no parameters in order to list all block devices, or a block device may be
534specified by name.
535
536Name                    | Optional | Type        | Description
537----------------------- | -------- | ----------- | -----------
538name                    | Optional | string      | Block device name
539
540### Response
541
542The response is an array of objects containing information about the requested block devices.
543
544### Example
545
546Example request:
547
548~~~
549{
550  "jsonrpc": "2.0",
551  "id": 1,
552  "method": "get_bdevs",
553  "params": {
554    "name": "Malloc0"
555  }
556}
557~~~
558
559Example response:
560
561~~~
562{
563  "jsonrpc": "2.0",
564  "id": 1,
565  "result": [
566    {
567      "name": "Malloc0",
568      "product_name": "Malloc disk",
569      "block_size": 512,
570      "num_blocks": 20480,
571      "claimed": false,
572      "supported_io_types": {
573        "read": true,
574        "write": true,
575        "unmap": true,
576        "write_zeroes": true,
577        "flush": true,
578        "reset": true,
579        "nvme_admin": false,
580        "nvme_io": false
581      },
582      "driver_specific": {}
583    }
584  ]
585}
586~~~
587
588## get_bdevs_iostat {#rpc_get_bdevs_iostat}
589
590Get I/O statistics of block devices (bdevs).
591
592### Parameters
593
594The user may specify no parameters in order to list all block devices, or a block device may be
595specified by name.
596
597Name                    | Optional | Type        | Description
598----------------------- | -------- | ----------- | -----------
599name                    | Optional | string      | Block device name
600
601### Response
602
603The response is an array of objects containing I/O statistics of the requested block devices.
604
605### Example
606
607Example request:
608
609~~~
610{
611  "jsonrpc": "2.0",
612  "id": 1,
613  "method": "get_bdevs_iostat",
614  "params": {
615    "name": "Nvme0n1"
616  }
617}
618~~~
619
620Example response:
621
622~~~
623{
624  "jsonrpc": "2.0",
625  "id": 1,
626  "result": {
627    "tick_rate": 2200000000,
628    "bdevs" : [
629      {
630        "name": "Nvme0n1",
631        "bytes_read": 36864,
632        "num_read_ops": 2,
633        "bytes_written": 0,
634        "num_write_ops": 0,
635        "bytes_unmapped": 0,
636        "num_unmap_ops": 0,
637        "read_latency_ticks": 178904,
638        "write_latency_ticks": 0,
639        "unmap_latency_ticks": 0,
640        "queue_depth_polling_period": 2,
641        "queue_depth": 0,
642        "io_time": 0,
643        "weighted_io_time": 0
644      }
645    ]
646  }
647}
648~~~
649
650## enable_bdev_histogram {#rpc_enable_bdev_histogram}
651
652Control whether collecting data for histogram is enabled for specified bdev.
653
654### Parameters
655
656Name                    | Optional | Type        | Description
657----------------------- | -------- | ----------- | -----------
658name                    | Required | string      | Block device name
659enable                  | Required | boolean     | Enable or disable histogram on specified device
660
661### Example
662
663Example request:
664
665~~~
666{
667  "jsonrpc": "2.0",
668  "id": 1,
669  "method": "enable_bdev_histogram",
670  "params": {
671    "name": "Nvme0n1"
672    "enable": true
673  }
674}
675~~~
676
677Example response:
678
679~~~
680{
681  "jsonrpc": "2.0",
682  "id": 1,
683  "result": true
684}
685~~~
686
687## get_bdev_histogram {#rpc_get_bdev_histogram}
688
689Get latency histogram for specified bdev.
690
691### Parameters
692
693Name                    | Optional | Type        | Description
694----------------------- | -------- | ----------- | -----------
695name                    | Required | string      | Block device name
696
697### Result
698
699Name                    | Description
700------------------------| -----------
701histogram               | Base64 encoded histogram
702bucket_shift            | Granularity of the histogram buckets
703tsc_rate                | Ticks per second
704
705### Example
706
707Example request:
708
709~~~
710{
711  "jsonrpc": "2.0",
712  "id": 1,
713  "method": "get_bdev_histogram",
714  "params": {
715    "name": "Nvme0n1"
716  }
717}
718~~~
719
720Example response:
721Note that histogram field is trimmed, actual encoded histogram length is ~80kb.
722
723~~~
724{
725  "jsonrpc": "2.0",
726  "id": 1,
727  "result": {
728    "histogram": "AAAAAAAAAAAAAA...AAAAAAAAA==",
729    "tsc_rate": 2300000000,
730    "bucket_shift": 7
731  }
732}
733~~~
734
735## set_bdev_qos_limit {#rpc_set_bdev_qos_limit}
736
737Set the quality of service rate limit on a bdev.
738
739### Parameters
740
741Name                    | Optional | Type        | Description
742----------------------- | -------- | ----------- | -----------
743name                    | Required | string      | Block device name
744rw_ios_per_sec          | Optional | number      | Number of R/W I/Os per second to allow. 0 means unlimited.
745rw_mbytes_per_sec       | Optional | number      | Number of R/W megabytes per second to allow. 0 means unlimited.
746r_mbytes_per_sec        | Optional | number      | Number of Read megabytes per second to allow. 0 means unlimited.
747w_mbytes_per_sec        | Optional | number      | Number of Write megabytes per second to allow. 0 means unlimited.
748
749### Example
750
751Example request:
752
753~~~
754{
755  "jsonrpc": "2.0",
756  "id": 1,
757  "method": "set_bdev_qos_limit",
758  "params": {
759    "name": "Malloc0"
760    "rw_ios_per_sec": 20000
761    "rw_mbytes_per_sec": 100
762    "r_mbytes_per_sec": 50
763    "w_mbytes_per_sec": 50
764  }
765}
766~~~
767
768Example response:
769
770~~~
771{
772  "jsonrpc": "2.0",
773  "id": 1,
774  "result": true
775}
776~~~
777
778## construct_ocf_bdev {#rpc_construct_ocf_bdev}
779
780Construct new OCF bdev.
781Command accepts cache mode that is going to be used.
782Currently, we support Write-Through and Pass-Through OCF cache modes.
783
784### Parameters
785
786Name                    | Optional | Type        | Description
787----------------------- | -------- | ----------- | -----------
788name                    | Required | string      | Bdev name to use
789mode                    | Required | string      | OCF cache mode ('wt' or 'pt')
790cache_bdev_name         | Required | string      | Name of underlying cache bdev
791core_bdev_name          | Required | string      | Name of underlying core bdev
792
793### Result
794
795Name of newly created bdev.
796
797### Example
798
799Example request:
800
801~~~
802{
803  "params": {
804    "name": "ocf0",
805    "mode": "wt",
806    "cache_bdev_name": "Nvme0n1"
807    "core_bdev_name": "aio0"
808  },
809  "jsonrpc": "2.0",
810  "method": "construct_ocf_bdev",
811  "id": 1
812}
813~~~
814
815Example response:
816
817~~~
818{
819  "jsonrpc": "2.0",
820  "id": 1,
821  "result": "ocf0"
822}
823~~~
824
825## delete_ocf_bdev {#rpc_delete_ocf_bdev}
826
827Delete the OCF bdev
828
829### Parameters
830
831Name                    | Optional | Type        | Description
832----------------------- | -------- | ----------- | -----------
833name                    | Required | string      | Bdev name
834
835### Example
836
837Example request:
838
839~~~
840{
841  "params": {
842    "name": "ocf0"
843  },
844  "jsonrpc": "2.0",
845  "method": "delete_ocf_bdev",
846  "id": 1
847}
848~~~
849
850Example response:
851
852~~~
853{
854  "jsonrpc": "2.0",
855  "id": 1,
856  "result": true
857}
858~~~
859
860## get_ocf_stats {#rpc_get_ocf_stats}
861
862Get statistics of chosen OCF block device.
863
864### Parameters
865
866Name                    | Optional | Type        | Description
867----------------------- | -------- | ----------- | -----------
868name                    | Required | string      | Block device name
869
870### Response
871
872Statistics as json object.
873
874### Example
875
876Example request:
877
878~~~
879{
880  "jsonrpc": "2.0",
881  "method": "get_ocf_stats",
882  "id": 1
883}
884~~~
885
886Example response:
887
888~~~
889{
890  "jsonrpc": "2.0",
891  "id": 1,
892  "result": [
893  "usage": {
894    "clean": {
895      "count": 76033,
896      "units": "4KiB blocks",
897      "percentage": "100.0"
898    },
899    "free": {
900      "count": 767,
901      "units": "4KiB blocks",
902      "percentage": "0.9"
903    },
904    "occupancy": {
905      "count": 76033,
906      "units": "4KiB blocks",
907      "percentage": "99.0"
908    },
909    "dirty": {
910      "count": 0,
911      "units": "4KiB blocks",
912      "percentage": "0.0"
913    }
914  },
915  "requests": {
916    "rd_total": {
917      "count": 2,
918      "units": "Requests",
919      "percentage": "0.0"
920    },
921    "wr_full_misses": {
922      "count": 76280,
923      "units": "Requests",
924      "percentage": "35.6"
925    },
926    "rd_full_misses": {
927      "count": 1,
928      "units": "Requests",
929      "percentage": "0.0"
930    },
931    "rd_partial_misses": {
932      "count": 0,
933      "units": "Requests",
934      "percentage": "0.0"
935    },
936    "wr_total": {
937      "count": 212416,
938      "units": "Requests",
939      "percentage": "99.2"
940    },
941    "wr_pt": {
942      "count": 1535,
943      "units": "Requests",
944      "percentage": "0.7"
945    },
946    "wr_partial_misses": {
947      "count": 0,
948      "units": "Requests",
949      "percentage": "0.0"
950    },
951    "serviced": {
952      "count": 212418,
953      "units": "Requests",
954      "percentage": "99.2"
955    },
956    "rd_pt": {
957      "count": 0,
958      "units": "Requests",
959      "percentage": "0.0"
960    },
961    "total": {
962      "count": 213953,
963      "units": "Requests",
964      "percentage": "100.0"
965    },
966    "rd_hits": {
967      "count": 1,
968      "units": "Requests",
969      "percentage": "0.0"
970    },
971    "wr_hits": {
972      "count": 136136,
973      "units": "Requests",
974      "percentage": "63.6"
975    }
976  },
977  "errors": {
978    "total": {
979      "count": 0,
980      "units": "Requests",
981      "percentage": "0.0"
982    },
983    "cache_obj_total": {
984      "count": 0,
985      "units": "Requests",
986      "percentage": "0.0"
987    },
988    "core_obj_total": {
989      "count": 0,
990      "units": "Requests",
991      "percentage": "0.0"
992    },
993    "cache_obj_rd": {
994      "count": 0,
995      "units": "Requests",
996      "percentage": "0.0"
997    },
998    "core_obj_wr": {
999      "count": 0,
1000      "units": "Requests",
1001      "percentage": "0.0"
1002    },
1003    "core_obj_rd": {
1004      "count": 0,
1005      "units": "Requests",
1006      "percentage": "0.0"
1007    },
1008    "cache_obj_wr": {
1009      "count": 0,
1010      "units": "Requests",
1011      "percentage": "0.0"
1012    }
1013  },
1014  "blocks": {
1015    "volume_rd": {
1016      "count": 9,
1017      "units": "4KiB blocks",
1018      "percentage": "0.0"
1019    },
1020    "volume_wr": {
1021      "count": 213951,
1022      "units": "4KiB blocks",
1023      "percentage": "99.9"
1024    },
1025    "cache_obj_total": {
1026      "count": 212425,
1027      "units": "4KiB blocks",
1028      "percentage": "100.0"
1029    },
1030    "core_obj_total": {
1031      "count": 213959,
1032      "units": "4KiB blocks",
1033      "percentage": "100.0"
1034    },
1035    "cache_obj_rd": {
1036      "count": 1,
1037      "units": "4KiB blocks",
1038      "percentage": "0.0"
1039    },
1040    "core_obj_wr": {
1041      "count": 213951,
1042      "units": "4KiB blocks",
1043      "percentage": "99.9"
1044    },
1045    "volume_total": {
1046      "count": 213960,
1047      "units": "4KiB blocks",
1048      "percentage": "100.0"
1049    },
1050    "core_obj_rd": {
1051      "count": 8,
1052      "units": "4KiB blocks",
1053      "percentage": "0.0"
1054    },
1055    "cache_obj_wr": {
1056      "count": 212424,
1057      "units": "4KiB blocks",
1058      "percentage": "99.9"
1059    }
1060  ]
1061}
1062~~~
1063
1064## get_ocf_bdevs {#rpc_get_ocf_bdevs}
1065
1066Get list of OCF devices including unregistered ones.
1067
1068### Parameters
1069
1070Name                    | Optional | Type        | Description
1071----------------------- | -------- | ----------- | -----------
1072name                    | Optional | string      | Name of OCF vbdev or name of cache device or name of core device
1073
1074### Response
1075
1076Array of OCF devices with their current status, along with core and cache bdevs.
1077
1078### Example
1079
1080Example request:
1081
1082~~~
1083{
1084  "jsonrpc": "2.0",
1085  "method": "get_ocf_bdevs",
1086  "id": 1
1087}
1088~~~
1089
1090Example response:
1091
1092~~~
1093{
1094  "jsonrpc": "2.0",
1095  "id": 1,
1096  "result": [
1097    {
1098      "name": "PartCache",
1099      "started": false,
1100      "cache": {
1101        "name": "Malloc0",
1102        "attached": true
1103      },
1104      "core": {
1105        "name": "Malloc1",
1106        "attached": false
1107      }
1108    }
1109  ]
1110}
1111~~~
1112
1113## construct_malloc_bdev {#rpc_construct_malloc_bdev}
1114
1115Construct @ref bdev_config_malloc
1116
1117### Parameters
1118
1119Name                    | Optional | Type        | Description
1120----------------------- | -------- | ----------- | -----------
1121name                    | Optional | string      | Bdev name to use
1122block_size              | Required | number      | Block size in bytes -must be multiple of 512
1123num_blocks              | Required | number      | Number of blocks
1124uuid                    | Optional | string      | UUID of new bdev
1125
1126### Result
1127
1128Name of newly created bdev.
1129
1130### Example
1131
1132Example request:
1133
1134~~~
1135{
1136  "params": {
1137    "block_size": 4096,
1138    "num_blocks": 16384,
1139    "name": "Malloc0",
1140    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90"
1141  },
1142  "jsonrpc": "2.0",
1143  "method": "construct_malloc_bdev",
1144  "id": 1
1145}
1146~~~
1147
1148Example response:
1149
1150~~~
1151{
1152  "jsonrpc": "2.0",
1153  "id": 1,
1154  "result": "Malloc0"
1155}
1156~~~
1157
1158## delete_malloc_bdev {#rpc_delete_malloc_bdev}
1159
1160Delete @ref bdev_config_malloc
1161
1162### Parameters
1163
1164Name                    | Optional | Type        | Description
1165----------------------- | -------- | ----------- | -----------
1166name                    | Required | string      | Bdev name
1167
1168### Example
1169
1170Example request:
1171
1172~~~
1173{
1174  "params": {
1175    "name": "Malloc0"
1176  },
1177  "jsonrpc": "2.0",
1178  "method": "delete_malloc_bdev",
1179  "id": 1
1180}
1181~~~
1182
1183Example response:
1184
1185~~~
1186{
1187  "jsonrpc": "2.0",
1188  "id": 1,
1189  "result": true
1190}
1191~~~
1192
1193## construct_null_bdev {#rpc_construct_null_bdev}
1194
1195Construct @ref bdev_config_null
1196
1197### Parameters
1198
1199Name                    | Optional | Type        | Description
1200----------------------- | -------- | ----------- | -----------
1201name                    | Optional | string      | Bdev name to use
1202block_size              | Required | number      | Block size in bytes
1203num_blocks              | Required | number      | Number of blocks
1204uuid                    | Optional | string      | UUID of new bdev
1205
1206### Result
1207
1208Name of newly created bdev.
1209
1210### Example
1211
1212Example request:
1213
1214~~~
1215{
1216  "params": {
1217    "block_size": 4096,
1218    "num_blocks": 16384,
1219    "name": "Null0",
1220    "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90"
1221  },
1222  "jsonrpc": "2.0",
1223  "method": "construct_null_bdev",
1224  "id": 1
1225}
1226~~~
1227
1228Example response:
1229
1230~~~
1231{
1232  "jsonrpc": "2.0",
1233  "id": 1,
1234  "result": "Null0"
1235}
1236~~~
1237
1238## delete_null_bdev {#rpc_delete_null_bdev}
1239
1240Delete @ref bdev_config_null.
1241
1242### Parameters
1243
1244Name                    | Optional | Type        | Description
1245----------------------- | -------- | ----------- | -----------
1246name                    | Required | string      | Bdev name
1247
1248### Example
1249
1250Example request:
1251
1252~~~
1253{
1254  "params": {
1255    "name": "Null0"
1256  },
1257  "jsonrpc": "2.0",
1258  "method": "delete_null_bdev",
1259  "id": 1
1260}
1261~~~
1262
1263Example response:
1264
1265~~~
1266{
1267  "jsonrpc": "2.0",
1268  "id": 1,
1269  "result": true
1270}
1271~~~
1272
1273## construct_aio_bdev {#rpc_construct_aio_bdev}
1274
1275Construct @ref bdev_config_aio.
1276
1277### Parameters
1278
1279Name                    | Optional | Type        | Description
1280----------------------- | -------- | ----------- | -----------
1281name                    | Required | string      | Bdev name to use
1282filename                | Required | number      | Path to device or file
1283block_size              | Optional | number      | Block size in bytes
1284
1285### Result
1286
1287Name of newly created bdev.
1288
1289### Example
1290
1291Example request:
1292
1293~~~
1294{
1295  "params": {
1296    "block_size": 4096,
1297    "name": "Aio0",
1298    "filename": "/tmp/aio_bdev_file"
1299  },
1300  "jsonrpc": "2.0",
1301  "method": "construct_aio_bdev",
1302  "id": 1
1303}
1304~~~
1305
1306Example response:
1307
1308~~~
1309{
1310  "jsonrpc": "2.0",
1311  "id": 1,
1312  "result": "Aio0"
1313}
1314~~~
1315
1316## delete_aio_bdev {#rpc_delete_aio_bdev}
1317
1318Delete @ref bdev_config_aio.
1319
1320### Parameters
1321
1322Name                    | Optional | Type        | Description
1323----------------------- | -------- | ----------- | -----------
1324name                    | Required | string      | Bdev name
1325
1326### Example
1327
1328Example request:
1329
1330~~~
1331{
1332  "params": {
1333    "name": "Aio0"
1334  },
1335  "jsonrpc": "2.0",
1336  "method": "delete_aio_bdev",
1337  "id": 1
1338}
1339~~~
1340
1341Example response:
1342
1343~~~
1344{
1345  "jsonrpc": "2.0",
1346  "id": 1,
1347  "result": true
1348}
1349~~~
1350
1351## set_bdev_nvme_options {#rpc_set_bdev_nvme_options}
1352
1353Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized.
1354
1355### Parameters
1356
1357Name                       | Optional | Type        | Description
1358-------------------------- | -------- | ----------- | -----------
1359action_on_timeout          | Optional | string      | Action to take on command time out: none, reset or abort
1360timeout_us                 | Optional | number      | Timeout for each command, in microseconds. If 0, don't track timeouts
1361retry_count                | Optional | number      | The number of attempts per I/O before an I/O fails
1362nvme_adminq_poll_period_us | Optional | number      | How often the admin queue is polled for asynchronous events in microseconds
1363nvme_ioq_poll_period_us    | Optional | number      | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible).
1364
1365### Example
1366
1367Example request:
1368
1369~~~
1370request:
1371{
1372  "params": {
1373    "retry_count": 5,
1374    "nvme_adminq_poll_period_us": 2000,
1375    "timeout_us": 10000000,
1376    "action_on_timeout": "reset"
1377  },
1378  "jsonrpc": "2.0",
1379  "method": "set_bdev_nvme_options",
1380  "id": 1
1381}
1382~~~
1383
1384Example response:
1385
1386~~~
1387{
1388  "jsonrpc": "2.0",
1389  "id": 1,
1390  "result": true
1391}
1392~~~
1393
1394## set_bdev_nvme_hotplug {#rpc_set_bdev_nvme_hotplug}
1395
1396Change settings of the NVMe hotplug feature. If enabled, PCIe NVMe bdevs will be automatically discovered on insertion
1397and deleted on removal.
1398
1399### Parameters
1400
1401Name                    | Optional | Type        | Description
1402----------------------- | -------- | ----------- | -----------
1403enabled                 | Required | string      | True to enable, false to disable
1404period_us               | Optional | number      | How often to poll for hot-insert and hot-remove events. Values: 0 - reset/use default or 1 to 10000000.
1405
1406### Example
1407
1408Example request:
1409
1410~~~
1411request:
1412{
1413  "params": {
1414    "enabled": true,
1415    "period_us": 2000
1416  },
1417  "jsonrpc": "2.0",
1418  "method": "set_bdev_nvme_hotplug",
1419  "id": 1
1420}
1421~~~
1422
1423Example response:
1424
1425~~~
1426{
1427  "jsonrpc": "2.0",
1428  "id": 1,
1429  "result": true
1430}
1431~~~
1432
1433## construct_nvme_bdev {#rpc_construct_nvme_bdev}
1434
1435Construct @ref bdev_config_nvme
1436
1437### Result
1438
1439Array of names of newly created bdevs.
1440
1441### Parameters
1442
1443Name                    | Optional | Type        | Description
1444----------------------- | -------- | ----------- | -----------
1445name                    | Required | string      | Name of the NVMe controller, prefix for each bdev name
1446trtype                  | Required | string      | NVMe-oF target trtype: rdma or pcie
1447traddr                  | Required | string      | NVMe-oF target address: ip or BDF
1448adrfam                  | Optional | string      | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host
1449trsvcid                 | Optional | string      | NVMe-oF target trsvcid: port number
1450subnqn                  | Optional | string      | NVMe-oF target subnqn
1451hostnqn                 | Optional | string      | NVMe-oF target hostnqn
1452hostaddr                | Optional | string      | NVMe-oF host address: ip address
1453hostsvcid               | Optional | string      | NVMe-oF host trsvcid: port number
1454prchk_reftag            | Optional | bool        | Enable checking of PI reference tag for I/O processing
1455prchk_guard             | Optional | bool        | Enable checking of PI guard for I/O processing
1456
1457### Example
1458
1459Example request:
1460
1461~~~
1462{
1463  "params": {
1464    "trtype": "pcie",
1465    "name": "Nvme0",
1466    "traddr": "0000:0a:00.0"
1467  },
1468  "jsonrpc": "2.0",
1469  "method": "construct_nvme_bdev",
1470  "id": 1
1471}
1472~~~
1473
1474Example response:
1475
1476~~~
1477{
1478  "jsonrpc": "2.0",
1479  "id": 1,
1480  "result": [
1481    "Nvme0n1"
1482  ]
1483}
1484~~~
1485
1486## get_nvme_controllers {#rpc_get_nvme_controllers}
1487
1488Get information about NVMe controllers.
1489
1490### Parameters
1491
1492The user may specify no parameters in order to list all NVMe controllers, or one NVMe controller may be
1493specified by name.
1494
1495Name                    | Optional | Type        | Description
1496----------------------- | -------- | ----------- | -----------
1497name                    | Optional | string      | NVMe controller name
1498
1499### Response
1500
1501The response is an array of objects containing information about the requested NVMe controllers.
1502
1503### Example
1504
1505Example request:
1506
1507~~~
1508{
1509  "jsonrpc": "2.0",
1510  "id": 1,
1511  "method": "get_nvme_controllers",
1512  "params": {
1513    "name": "Nvme0"
1514  }
1515}
1516~~~
1517
1518Example response:
1519
1520~~~
1521{
1522  "jsonrpc": "2.0",
1523  "id": 1,
1524  "result": [
1525    {
1526      "name": "Nvme0",
1527      "trid": {
1528        "trtype": "PCIe",
1529        "traddr": "0000:05:00.0"
1530      }
1531    }
1532  ]
1533}
1534~~~
1535
1536## delete_nvme_controller {#rpc_delete_nvme_controller}
1537
1538Delete NVMe controller.
1539
1540### Parameters
1541
1542Name                    | Optional | Type        | Description
1543----------------------- | -------- | ----------- | -----------
1544name                    | Required | string      | Controller name
1545
1546### Example
1547
1548Example requests:
1549
1550~~~
1551{
1552  "params": {
1553    "name": "Nvme0"
1554  },
1555  "jsonrpc": "2.0",
1556  "method": "delete_nvme_controller",
1557  "id": 1
1558}
1559~~~
1560
1561Example response:
1562
1563~~~
1564{
1565  "jsonrpc": "2.0",
1566  "id": 1,
1567  "result": true
1568}
1569~~~
1570
1571## construct_rbd_bdev {#rpc_construct_rbd_bdev}
1572
1573Construct @ref bdev_config_rbd bdev
1574
1575This method is available only if SPDK was build with Ceph RBD support.
1576
1577### Parameters
1578
1579Name                    | Optional | Type        | Description
1580----------------------- | -------- | ----------- | -----------
1581name                    | Optional | string      | Bdev name
1582user_id                 | Optional | string      | Ceph ID (i.e. admin, not client.admin)
1583pool_name               | Required | string      | Pool name
1584rbd_name                | Required | string      | Image name
1585block_size              | Required | number      | Block size
1586config                  | Optional | string map  | Explicit librados configuration
1587
1588If no config is specified, Ceph configuration files must exist with
1589all relevant settings for accessing the pool. If a config map is
1590passed, the configuration files are ignored and instead all key/value
1591pairs are passed to rados_conf_set to configure cluster access. In
1592practice, "mon_host" (= list of monitor address+port) and "key" (= the
1593secret key stored in Ceph keyrings) are enough.
1594
1595When accessing the image as some user other than "admin" (the
1596default), the "user_id" has to be set.
1597
1598### Result
1599
1600Name of newly created bdev.
1601
1602### Example
1603
1604Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`:
1605
1606~~~
1607{
1608  "params": {
1609    "pool_name": "rbd",
1610    "rbd_name": "foo",
1611    "config": {
1612      "mon_host": "192.168.7.1:6789,192.168.7.2:6789",
1613      "key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ==",
1614    }
1615    "block_size": 4096
1616  },
1617  "jsonrpc": "2.0",
1618  "method": "construct_rbd_bdev",
1619  "id": 1
1620}
1621~~~
1622
1623Example response:
1624
1625~~~
1626response:
1627{
1628  "jsonrpc": "2.0",
1629  "id": 1,
1630  "result": "Ceph0"
1631}
1632~~~
1633
1634## delete_rbd_bdev {#rpc_delete_rbd_bdev}
1635
1636Delete @ref bdev_config_rbd bdev
1637
1638This method is available only if SPDK was build with Ceph RBD support.
1639
1640### Result
1641
1642`true` if bdev with provided name was deleted or `false` otherwise.
1643
1644### Parameters
1645
1646Name                    | Optional | Type        | Description
1647----------------------- | -------- | ----------- | -----------
1648name                    | Required | string      | Bdev name
1649
1650### Example
1651
1652Example request:
1653
1654~~~
1655{
1656  "params": {
1657    "name": "Rbd0"
1658  },
1659  "jsonrpc": "2.0",
1660  "method": "delete_rbd_bdev",
1661  "id": 1
1662}
1663~~~
1664
1665Example response:
1666
1667~~~
1668{
1669  "jsonrpc": "2.0",
1670  "id": 1,
1671  "result": true
1672}
1673~~~
1674
1675## construct_error_bdev {#rpc_construct_error_bdev}
1676
1677Construct error bdev.
1678
1679### Parameters
1680
1681Name                    | Optional | Type        | Description
1682----------------------- | -------- | ----------- | -----------
1683base_name               | Required | string      | Base bdev name
1684
1685### Example
1686
1687Example request:
1688
1689~~~
1690{
1691  "params": {
1692    "base_name": "Malloc0"
1693  },
1694  "jsonrpc": "2.0",
1695  "method": "construct_error_bdev",
1696  "id": 1
1697}
1698~~~
1699
1700Example response:
1701
1702~~~
1703{
1704  "jsonrpc": "2.0",
1705  "id": 1,
1706  "result": true
1707}
1708~~~
1709
1710## delete_error_bdev {#rpc_delete_error_bdev}
1711
1712Delete error bdev
1713
1714### Result
1715
1716`true` if bdev with provided name was deleted or `false` otherwise.
1717
1718### Parameters
1719
1720Name                    | Optional | Type        | Description
1721----------------------- | -------- | ----------- | -----------
1722name                    | Required | string      | Error bdev name
1723
1724### Example
1725
1726Example request:
1727
1728~~~
1729{
1730  "params": {
1731    "name": "EE_Malloc0"
1732  },
1733  "jsonrpc": "2.0",
1734  "method": "delete_error_bdev",
1735  "id": 1
1736}
1737~~~
1738
1739Example response:
1740
1741~~~
1742{
1743  "jsonrpc": "2.0",
1744  "id": 1,
1745  "result": true
1746}
1747~~~
1748
1749## construct_iscsi_bdev {#rpc_construct_iscsi_bdev}
1750
1751Connect to iSCSI target and create bdev backed by this connection.
1752
1753This method is available only if SPDK was build with iSCSI initiator support.
1754
1755### Parameters
1756
1757Name                    | Optional | Type        | Description
1758----------------------- | -------- | ----------- | -----------
1759name                    | Required | string      | Bdev name
1760initiator_iqn           | Required | string      | IQN name used during connection
1761url                     | Required | string      | iSCSI resource URI
1762
1763### Result
1764
1765Name of newly created bdev.
1766
1767### Example
1768
1769Example request:
1770
1771~~~
1772{
1773  "params": {
1774    "url": "iscsi://127.0.0.1/iqn.2016-06.io.spdk:disk1/0",
1775    "initiator_iqn": "iqn.2016-06.io.spdk:init",
1776    "name": "iSCSI0"
1777  },
1778  "jsonrpc": "2.0",
1779  "method": "construct_iscsi_bdev",
1780  "id": 1
1781}
1782~~~
1783
1784Example response:
1785
1786~~~
1787{
1788  "jsonrpc": "2.0",
1789  "id": 1,
1790  "result": "iSCSI0"
1791}
1792~~~
1793
1794## delete_iscsi_bdev {#rpc_delete_iscsi_bdev}
1795
1796Delete iSCSI bdev and terminate connection to target.
1797
1798This method is available only if SPDK was built with iSCSI initiator support.
1799
1800### Parameters
1801
1802Name                    | Optional | Type        | Description
1803----------------------- | -------- | ----------- | -----------
1804name                    | Required | string      | Bdev name
1805
1806### Example
1807
1808Example request:
1809
1810~~~
1811{
1812  "params": {
1813    "name": "iSCSI0"
1814  },
1815  "jsonrpc": "2.0",
1816  "method": "delete_iscsi_bdev",
1817  "id": 1
1818}
1819~~~
1820
1821Example response:
1822
1823~~~
1824{
1825  "jsonrpc": "2.0",
1826  "id": 1,
1827  "result": true
1828}
1829~~~
1830
1831## construct_ftl_bdev {#rpc_construct_ftl_bdev}
1832
1833Create FTL bdev.
1834
1835This RPC is subject to change.
1836
1837### Parameters
1838
1839Name                    | Optional | Type        | Description
1840----------------------- | -------- | ----------- | -----------
1841name                    | Required | string      | Bdev name
1842trtype                  | Required | string      | Transport type
1843traddr                  | Required | string      | NVMe target address
1844punits                  | Required | string      | Parallel unit range in the form of start-end e.g 4-8
1845uuid                    | Optional | string      | UUID of restored bdev (not applicable when creating new instance)
1846cache                   | Optional | string      | Name of the bdev to be used as a write buffer cache
1847
1848### Result
1849
1850Name of newly created bdev.
1851
1852### Example
1853
1854Example request:
1855
1856~~~
1857{
1858  "params": {
1859    "name": "nvme0"
1860    "trtype" "pcie"
1861    "traddr": "0000:00:04.0"
1862    "punits": "0-3"
1863    "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
1864  },
1865  "jsonrpc": "2.0",
1866  "method": "construct_ftl_bdev",
1867  "id": 1
1868}
1869~~~
1870
1871Example response:
1872
1873~~~
1874{
1875  "jsonrpc": "2.0",
1876  "id": 1,
1877  "result": {
1878      "name" : "nvme0"
1879      "uuid" : "4a7481ce-786f-41a0-9b86-8f7465c8f4d3"
1880  }
1881}
1882~~~
1883
1884## delete_ftl_bdev {#rpc_delete_ftl_bdev}
1885
1886Delete FTL bdev.
1887
1888This RPC is subject to change.
1889
1890### Parameters
1891
1892Name                    | Optional | Type        | Description
1893----------------------- | -------- | ----------- | -----------
1894name                    | Required | string      | Bdev name
1895
1896### Example
1897
1898Example request:
1899
1900~~~
1901{
1902  "params": {
1903    "name": "nvme0"
1904  },
1905  "jsonrpc": "2.0",
1906  "method": "delete_ftl_bdev",
1907  "id": 1
1908}
1909~~~
1910
1911Example response:
1912
1913~~~
1914{
1915  "jsonrpc": "2.0",
1916  "id": 1,
1917  "result": true
1918}
1919~~~
1920
1921
1922## create_pmem_pool {#rpc_create_pmem_pool}
1923
1924Create a @ref bdev_config_pmem blk pool file. It is equivalent of following `pmempool create` command:
1925
1926~~~
1927pmempool create -s $((num_blocks * block_size)) blk $block_size $pmem_file
1928~~~
1929
1930This method is available only if SPDK was built with PMDK support.
1931
1932### Parameters
1933
1934Name                    | Optional | Type        | Description
1935----------------------- | -------- | ----------- | -----------
1936pmem_file               | Required | string      | Path to new pmem file
1937num_blocks              | Required | number      | Number of blocks
1938block_size              | Required | number      | Size of each block in bytes
1939
1940### Example
1941
1942Example request:
1943
1944~~~
1945{
1946  "params": {
1947    "block_size": 512,
1948    "num_blocks": 131072,
1949    "pmem_file": "/tmp/pmem_file"
1950  },
1951  "jsonrpc": "2.0",
1952  "method": "create_pmem_pool",
1953  "id": 1
1954}
1955~~~
1956
1957Example response:
1958
1959~~~
1960{
1961  "jsonrpc": "2.0",
1962  "id": 1,
1963  "result": true
1964}
1965~~~
1966
1967## pmem_pool_info {#rpc_pmem_pool_info}
1968
1969Retrieve basic information about PMDK memory pool.
1970
1971This method is available only if SPDK was built with PMDK support.
1972
1973### Parameters
1974
1975Name                    | Optional | Type        | Description
1976----------------------- | -------- | ----------- | -----------
1977pmem_file               | Required | string      | Path to existing pmem file
1978
1979### Result
1980
1981Array of objects describing memory pool:
1982
1983Name                    | Type        | Description
1984----------------------- | ----------- | -----------
1985num_blocks              | number      | Number of blocks
1986block_size              | number      | Size of each block in bytes
1987
1988### Example
1989
1990Example request:
1991
1992~~~
1993request:
1994{
1995  "params": {
1996    "pmem_file": "/tmp/pmem_file"
1997  },
1998  "jsonrpc": "2.0",
1999  "method": "pmem_pool_info",
2000  "id": 1
2001}
2002~~~
2003
2004Example response:
2005
2006~~~
2007{
2008  "jsonrpc": "2.0",
2009  "id": 1,
2010  "result": [
2011    {
2012      "block_size": 512,
2013      "num_blocks": 129728
2014    }
2015  ]
2016}
2017~~~
2018
2019## delete_pmem_pool {#rpc_delete_pmem_pool}
2020
2021Delete pmem pool by removing file `pmem_file`. This method will fail if `pmem_file` is not a
2022valid pmem pool file.
2023
2024This method is available only if SPDK was built with PMDK support.
2025
2026### Parameters
2027
2028Name                    | Optional | Type        | Description
2029----------------------- | -------- | ----------- | -----------
2030pmem_file               | Required | string      | Path to new pmem file
2031
2032### Example
2033
2034Example request:
2035
2036~~~
2037{
2038  "params": {
2039    "pmem_file": "/tmp/pmem_file"
2040  },
2041  "jsonrpc": "2.0",
2042  "method": "delete_pmem_pool",
2043  "id": 1
2044}
2045~~~
2046
2047Example response:
2048
2049~~~
2050{
2051  "jsonrpc": "2.0",
2052  "id": 1,
2053  "result": true
2054}
2055~~~
2056
2057## construct_pmem_bdev {#rpc_construct_pmem_bdev}
2058
2059Construct @ref bdev_config_pmem bdev.
2060
2061This method is available only if SPDK was built with PMDK support.
2062
2063### Parameters
2064
2065Name                    | Optional | Type        | Description
2066----------------------- | -------- | ----------- | -----------
2067name                    | Required | string      | Bdev name
2068pmem_file               | Required | string      | Path to existing pmem blk pool file
2069
2070### Result
2071
2072Name of newly created bdev.
2073
2074### Example
2075
2076Example request:
2077
2078~~~
2079{
2080  "params": {
2081    "pmem_file": "/tmp/pmem_file",
2082    "name": "Pmem0"
2083  },
2084  "jsonrpc": "2.0",
2085  "method": "construct_pmem_bdev",
2086  "id": 1
2087}
2088~~~
2089
2090Example response:
2091
2092~~~
2093{
2094  "jsonrpc": "2.0",
2095  "id": 1,
2096  "result": "Pmem0"
2097}
2098~~~
2099
2100## delete_pmem_bdev {#rpc_delete_pmem_bdev}
2101
2102Delete @ref bdev_config_pmem bdev. This call will not remove backing pool files.
2103
2104This method is available only if SPDK was built with PMDK support.
2105
2106### Result
2107
2108`true` if bdev with provided name was deleted or `false` otherwise.
2109
2110### Parameters
2111
2112Name                    | Optional | Type        | Description
2113----------------------- | -------- | ----------- | -----------
2114name                    | Required | string      | Bdev name
2115
2116### Example
2117
2118Example request:
2119
2120~~~
2121{
2122  "params": {
2123    "name": "Pmem0"
2124  },
2125  "jsonrpc": "2.0",
2126  "method": "delete_pmem_bdev",
2127  "id": 1
2128}
2129~~~
2130
2131Example response:
2132
2133~~~
2134{
2135  "jsonrpc": "2.0",
2136  "id": 1,
2137  "result": true
2138}
2139~~~
2140
2141## construct_passthru_bdev {#rpc_construct_passthru_bdev}
2142
2143Create passthru bdev. This bdev type redirects all IO to it's base bdev. It has no other purpose than being an example
2144and a starting point in development of new bdev type.
2145
2146### Parameters
2147
2148Name                    | Optional | Type        | Description
2149----------------------- | -------- | ----------- | -----------
2150name                    | Required | string      | Bdev name
2151base_bdev_name          | Required | string      | Base bdev name
2152
2153### Result
2154
2155Name of newly created bdev.
2156
2157### Example
2158
2159Example request:
2160
2161~~~
2162{
2163  "params": {
2164    "base_bdev_name": "Malloc0",
2165    "name": "Passsthru0"
2166  },
2167  "jsonrpc": "2.0",
2168  "method": "construct_passthru_bdev",
2169  "id": 1
2170}
2171~~~
2172
2173Example response:
2174
2175~~~
2176{
2177  "jsonrpc": "2.0",
2178  "id": 1,
2179  "result": "Passsthru0"
2180}
2181~~~
2182
2183## delete_passthru_bdev {#rpc_delete_passthru_bdev}
2184
2185Delete passthru bdev.
2186
2187### Parameters
2188
2189Name                    | Optional | Type        | Description
2190----------------------- | -------- | ----------- | -----------
2191name                    | Required | string      | Bdev name
2192
2193### Example
2194
2195Example request:
2196
2197~~~
2198{
2199  "params": {
2200    "name": "Passsthru0"
2201  },
2202  "jsonrpc": "2.0",
2203  "method": "delete_passthru_bdev",
2204  "id": 1
2205}
2206
2207~~~
2208
2209Example response:
2210
2211~~~
2212{
2213  "jsonrpc": "2.0",
2214  "id": 1,
2215  "result": true
2216}
2217~~~
2218
2219## construct_virtio_dev {#rpc_construct_virtio_dev}
2220
2221Create new initiator @ref bdev_config_virtio_scsi or @ref bdev_config_virtio_blk and expose all found bdevs.
2222
2223### Parameters
2224
2225Name                    | Optional | Type        | Description
2226----------------------- | -------- | ----------- | -----------
2227name                    | Required | string      | Virtio SCSI base bdev name or Virtio Blk bdev name
2228trtype                  | Required | string      | Virtio target trtype: pci or user
2229traddr                  | Required | string      | target address: BDF or UNIX socket file path
2230dev_type                | Required | string      | Virtio device type: blk or scsi
2231vq_count                | Optional | number      | Number of queues this controller will utilize (default: 1)
2232vq_size                 | Optional | number      | Size of each queue. Must be power of 2. (default: 512)
2233
2234In case of Virtio SCSI the `name` parameter will be base name for new created bdevs. For Virtio Blk `name` will be the
2235name of created bdev.
2236
2237`vq_count` and `vq_size` parameters are valid only if `trtype` is `user`.
2238
2239### Result
2240
2241Array of names of newly created bdevs.
2242
2243### Example
2244
2245Example request:
2246
2247~~~
2248{
2249  "params": {
2250    "name": "VirtioScsi0",
2251    "trtype": "user",
2252    "vq_size": 128,
2253    "dev_type": "scsi",
2254    "traddr": "/tmp/VhostScsi0",
2255    "vq_count": 4
2256  },
2257  "jsonrpc": "2.0",
2258  "method": "construct_virtio_dev",
2259  "id": 1
2260}
2261~~~
2262
2263Example response:
2264
2265~~~
2266{
2267  "jsonrpc": "2.0",
2268  "id": 1,
2269  "result": ["VirtioScsi0t2", "VirtioScsi0t4"]
2270}
2271~~~
2272
2273## get_virtio_scsi_devs {#rpc_get_virtio_scsi_devs}
2274
2275Show information about all available Virtio SCSI devices.
2276
2277### Parameters
2278
2279This method has no parameters.
2280
2281### Result
2282
2283Array of Virtio SCSI information objects.
2284
2285### Example
2286
2287Example request:
2288
2289~~~
2290{
2291  "jsonrpc": "2.0",
2292  "method": "get_virtio_scsi_devs",
2293  "id": 1
2294}
2295~~~
2296
2297Example response:
2298
2299~~~
2300{
2301  "jsonrpc": "2.0",
2302  "id": 1,
2303  "result": [
2304    {
2305      "name": "VirtioScsi0",
2306      "virtio": {
2307          "vq_size": 128,
2308          "vq_count": 4,
2309          "type": "user",
2310          "socket": "/tmp/VhostScsi0"
2311      }
2312    }
2313  ]
2314}
2315~~~
2316
2317## remove_virtio_bdev {#rpc_remove_virtio_bdev}
2318
2319Remove a Virtio device. This command can be used to remove any type of virtio device.
2320
2321### Parameters
2322
2323Name                    | Optional | Type        | Description
2324----------------------- | -------- | ----------- | -----------
2325name                    | Required | string      | Virtio name
2326
2327### Example
2328
2329Example request:
2330
2331~~~
2332{
2333  "params": {
2334    "name": "VirtioUser0"
2335  },
2336  "jsonrpc": "2.0",
2337  "method": "remove_virtio_bdev",
2338  "id": 1
2339}
2340
2341~~~
2342
2343Example response:
2344
2345~~~
2346{
2347  "jsonrpc": "2.0",
2348  "id": 1,
2349  "result": true
2350}
2351~~~
2352
2353# iSCSI Target {#jsonrpc_components_iscsi_tgt}
2354
2355## set_iscsi_options method {#rpc_set_iscsi_options}
2356
2357Set global parameters for iSCSI targets.
2358
2359This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once.
2360
2361### Parameters
2362
2363Name                        | Optional | Type    | Description
2364--------------------------- | -------- | ------- | -----------
2365auth_file                   | Optional | string  | Path to CHAP shared secret file (default: "")
2366node_base                   | Optional | string  | Prefix of the name of iSCSI target node (default: "iqn.2016-06.io.spdk")
2367nop_timeout                 | Optional | number  | Timeout in seconds to nop-in request to the initiator (default: 60)
2368nop_in_interval             | Optional | number  | Time interval in secs between nop-in requests by the target (default: 30)
2369disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
2370require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
2371mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
2372chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
2373max_sessions                | Optional | number  | Maximum number of sessions in the host (default: 128)
2374max_queue_depth             | Optional | number  | Maximum number of outstanding I/Os per queue (default: 64)
2375max_connections_per_session | Optional | number  | Session specific parameter, MaxConnections (default: 2)
2376default_time2wait           | Optional | number  | Session specific parameter, DefaultTime2Wait (default: 2)
2377default_time2retain         | Optional | number  | Session specific parameter, DefaultTime2Retain (default: 20)
2378first_burst_length          | Optional | number  | Session specific parameter, FirstBurstLength (default: 8192)
2379immediate_data              | Optional | boolean | Session specific parameter, ImmediateData (default: `true`)
2380error_recovery_level        | Optional | number  | Session specific parameter, ErrorRecoveryLevel (default: 0)
2381allow_duplicated_isid       | Optional | boolean | Allow duplicated initiator session ID (default: `false`)
2382
2383To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`.
2384
2385Parameters `disable_chap` and `require_chap` are mutually exclusive. Parameters `no_discovery_auth`, `req_discovery_auth`, `req_discovery_auth_mutual`, and `discovery_auth_group` are still available instead of `disable_chap`, `require_chap`, `mutual_chap`, and `chap_group`, respectivey but will be removed in future releases.
2386
2387### Example
2388
2389Example request:
2390
2391~~~
2392{
2393  "params": {
2394    "allow_duplicated_isid": true,
2395    "default_time2retain": 60,
2396    "first_burst_length": 8192,
2397    "immediate_data": true,
2398    "node_base": "iqn.2016-06.io.spdk",
2399    "max_sessions": 128,
2400    "nop_timeout": 30,
2401    "nop_in_interval": 30,
2402    "auth_file": "/usr/local/etc/spdk/auth.conf",
2403    "disable_chap": true,
2404    "default_time2wait": 2
2405  },
2406  "jsonrpc": "2.0",
2407  "method": "set_iscsi_options",
2408  "id": 1
2409}
2410~~~
2411
2412Example response:
2413
2414~~~
2415{
2416  "jsonrpc": "2.0",
2417  "id": 1,
2418  "result": true
2419}
2420~~~
2421
2422## get_iscsi_global_params method {#rpc_get_iscsi_global_params}
2423
2424Show global parameters of iSCSI targets.
2425
2426### Parameters
2427
2428This method has no parameters.
2429
2430### Example
2431
2432Example request:
2433
2434~~~
2435request:
2436{
2437  "jsonrpc": "2.0",
2438  "method": "get_iscsi_global_params",
2439  "id": 1
2440}
2441~~~
2442
2443Example response:
2444
2445~~~
2446{
2447  "jsonrpc": "2.0",
2448  "id": 1,
2449  "result": {
2450    "allow_duplicated_isid": true,
2451    "default_time2retain": 60,
2452    "first_burst_length": 8192,
2453    "immediate_data": true,
2454    "node_base": "iqn.2016-06.io.spdk",
2455    "mutual_chap": false,
2456    "nop_in_interval": 30,
2457    "chap_group": 0,
2458    "max_connections_per_session": 2,
2459    "max_queue_depth": 64,
2460    "nop_timeout": 30,
2461    "max_sessions": 128,
2462    "error_recovery_level": 0,
2463    "auth_file": "/usr/local/etc/spdk/auth.conf",
2464    "disable_chap": true,
2465    "default_time2wait": 2,
2466    "require_chap": false
2467  }
2468}
2469~~~
2470## set_iscsi_discovery_auth method {#rpc_set_iscsi_discovery_auth}
2471
2472Set CHAP authentication for sessions dynamically.
2473
2474### Parameters
2475
2476Name                        | Optional | Type    | Description
2477--------------------------- | -------- | --------| -----------
2478disable_chap                | Optional | boolean | CHAP for discovery session should be disabled (default: `false`)
2479require_chap                | Optional | boolean | CHAP for discovery session should be required (default: `false`)
2480mutual_chap                 | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`)
2481chap_group                  | Optional | number  | CHAP group ID for discovery session (default: 0)
2482
2483Parameters `disable_chap` and `require_chap` are mutually exclusive.
2484
2485### Example
2486
2487Example request:
2488
2489~~~
2490request:
2491{
2492  "params": {
2493    "chap_group": 1,
2494    "require_chap": true,
2495    "mutual_chap": true
2496  },
2497  "jsonrpc": "2.0",
2498  "method": "set_iscsi_discovery_auth",
2499  "id": 1
2500}
2501~~~
2502
2503Example response:
2504
2505~~~
2506{
2507  "jsonrpc": "2.0",
2508  "id": 1,
2509  "result": true
2510}
2511~~~
2512
2513## add_iscsi_auth_group method {#rpc_add_iscsi_auth_group}
2514
2515Add an authentication group for CHAP authentication.
2516
2517### Parameters
2518
2519Name                        | Optional | Type    | Description
2520--------------------------- | -------- | --------| -----------
2521tag                         | Required | number  | Authentication group tag (unique, integer > 0)
2522secrets                     | Optional | array   | Array of @ref rpc_add_iscsi_auth_group_secret objects
2523
2524### secret {#rpc_add_iscsi_auth_group_secret}
2525
2526Name                        | Optional | Type    | Description
2527--------------------------- | ---------| --------| -----------
2528user                        | Required | string  | Unidirectional CHAP name
2529secret                      | Required | string  | Unidirectional CHAP secret
2530muser                       | Optional | string  | Bidirectional CHAP name
2531msecret                     | Optional | string  | Bidirectional CHAP secret
2532
2533### Example
2534
2535Example request:
2536
2537~~~
2538{
2539  "params": {
2540    "secrets": [
2541      {
2542        "muser": "mu1",
2543        "secret": "s1",
2544        "user": "u1",
2545        "msecret": "ms1"
2546      }
2547    ],
2548    "tag": 2
2549  },
2550  "jsonrpc": "2.0",
2551  "method": "add_iscsi_auth_group",
2552  "id": 1
2553}
2554~~~
2555
2556Example response:
2557
2558~~~
2559{
2560  "jsonrpc": "2.0",
2561  "id": 1,
2562  "result": true
2563}
2564~~~
2565
2566## delete_iscsi_auth_group method {#rpc_delete_iscsi_auth_group}
2567
2568Delete an existing authentication group for CHAP authentication.
2569
2570### Parameters
2571
2572Name                        | Optional | Type    | Description
2573--------------------------- | -------- | --------| -----------
2574tag                         | Required | number  | Authentication group tag (unique, integer > 0)
2575
2576### Example
2577
2578Example request:
2579
2580~~~
2581{
2582  "params": {
2583    "tag": 2
2584  },
2585  "jsonrpc": "2.0",
2586  "method": "delete_iscsi_auth_group",
2587  "id": 1
2588}
2589~~~
2590
2591Example response:
2592
2593~~~
2594{
2595  "jsonrpc": "2.0",
2596  "id": 1,
2597  "result": true
2598}
2599~~~
2600
2601## get_iscsi_auth_groups {#rpc_get_iscsi_auth_groups}
2602
2603Show information about all existing authentication group for CHAP authentication.
2604
2605### Parameters
2606
2607This method has no parameters.
2608
2609### Result
2610
2611Array of objects describing authentication group.
2612
2613Name                        | Type    | Description
2614--------------------------- | --------| -----------
2615tag                         | number  | Authentication group tag
2616secrets                     | array   | Array of @ref rpc_add_iscsi_auth_group_secret objects
2617
2618### Example
2619
2620Example request:
2621
2622~~~
2623{
2624  "jsonrpc": "2.0",
2625  "method": "get_iscsi_auth_groups",
2626  "id": 1
2627}
2628~~~
2629Example response:
2630
2631~~~
2632{
2633  "jsonrpc": "2.0",
2634  "id": 1,
2635  "result": [
2636    {
2637      "secrets": [
2638        {
2639          "muser": "mu1",
2640          "secret": "s1",
2641          "user": "u1",
2642          "msecret": "ms1"
2643        }
2644      ],
2645      "tag": 1
2646    },
2647    {
2648      "secrets": [
2649        {
2650          "secret": "s2",
2651          "user": "u2"
2652        }
2653      ],
2654      "tag": 2
2655    }
2656  ]
2657}
2658~~~
2659
2660## add_secret_to_iscsi_auth_group {#rpc_add_secret_to_iscsi_auth_group}
2661
2662Add a secret to an existing authentication group for CHAP authentication.
2663
2664### Parameters
2665
2666Name                        | Optional | Type    | Description
2667--------------------------- | -------- | --------| -----------
2668tag                         | Required | number  | Authentication group tag (unique, integer > 0)
2669user                        | Required | string  | Unidirectional CHAP name
2670secret                      | Required | string  | Unidirectional CHAP secret
2671muser                       | Optional | string  | Bidirectional CHAP name
2672msecret                     | Optional | string  | Bidirectional CHAP secret
2673
2674### Example
2675
2676Example request:
2677
2678~~~
2679{
2680  "params": {
2681    "muser": "mu3",
2682    "secret": "s3",
2683    "tag": 2,
2684    "user": "u3",
2685    "msecret": "ms3"
2686  },
2687  "jsonrpc": "2.0",
2688  "method": "add_secret_to_iscsi_auth_group",
2689  "id": 1
2690}
2691~~~
2692
2693Example response:
2694
2695~~~
2696{
2697  "jsonrpc": "2.0",
2698  "id": 1,
2699  "result": true
2700}
2701~~~
2702
2703## delete_secret_from_iscsi_auth_group {#rpc_delete_secret_from_iscsi_auth_group}
2704
2705Delete a secret from an existing authentication group for CHAP authentication.
2706
2707### Parameters
2708
2709Name                        | Optional | Type    | Description
2710--------------------------- | -------- | --------| -----------
2711tag                         | Required | number  | Authentication group tag (unique, integer > 0)
2712user                        | Required | string  | Unidirectional CHAP name
2713
2714### Example
2715
2716Example request:
2717
2718~~~
2719{
2720  "params": {
2721    "tag": 2,
2722    "user": "u3"
2723  },
2724  "jsonrpc": "2.0",
2725  "method": "delete_secret_from_iscsi_auth_group",
2726  "id": 1
2727}
2728~~~
2729
2730Example response:
2731
2732~~~
2733{
2734  "jsonrpc": "2.0",
2735  "id": 1,
2736  "result": true
2737}
2738~~~
2739
2740## get_initiator_groups method {#rpc_get_initiator_groups}
2741
2742Show information about all available initiator groups.
2743
2744### Parameters
2745
2746This method has no parameters.
2747
2748### Result
2749
2750Array of objects describing initiator groups.
2751
2752Name                        | Type    | Description
2753--------------------------- | --------| -----------
2754tag                         | number  | Initiator group tag
2755initiators                  | array   | Array of initiator hostnames or IP addresses
2756netmasks                    | array   | Array of initiator netmasks
2757
2758### Example
2759
2760Example request:
2761
2762~~~
2763{
2764  "jsonrpc": "2.0",
2765  "method": "get_initiator_groups",
2766  "id": 1
2767}
2768~~~
2769
2770Example response:
2771
2772~~~
2773{
2774  "jsonrpc": "2.0",
2775  "id": 1,
2776  "result": [
2777    {
2778      "initiators": [
2779        "iqn.2016-06.io.spdk:host1",
2780        "iqn.2016-06.io.spdk:host2"
2781      ],
2782      "tag": 1,
2783      "netmasks": [
2784        "192.168.1.0/24"
2785      ]
2786    }
2787  ]
2788}
2789~~~
2790
2791## add_initiator_group method {#rpc_add_initiator_group}
2792
2793Add an initiator group.
2794
2795### Parameters
2796
2797Name                        | Optional | Type    | Description
2798--------------------------- | -------- | --------| -----------
2799tag                         | Required | number  | Initiator group tag (unique, integer > 0)
2800initiators                  | Required | array   | Not empty array of initiator hostnames or IP addresses
2801netmasks                    | Required | array   | Not empty array of initiator netmasks
2802
2803### Example
2804
2805Example request:
2806
2807~~~
2808{
2809  "params": {
2810    "initiators": [
2811      "iqn.2016-06.io.spdk:host1",
2812      "iqn.2016-06.io.spdk:host2"
2813    ],
2814    "tag": 1,
2815    "netmasks": [
2816      "192.168.1.0/24"
2817    ]
2818  },
2819  "jsonrpc": "2.0",
2820  "method": "add_initiator_group",
2821  "id": 1
2822}
2823~~~
2824
2825Example response:
2826
2827~~~
2828response:
2829{
2830  "jsonrpc": "2.0",
2831  "id": 1,
2832  "result": true
2833}
2834~~~
2835
2836## delete_initiator_group method {#rpc_delete_initiator_group}
2837
2838Delete an existing initiator group.
2839
2840### Parameters
2841
2842Name                        | Optional | Type    | Description
2843--------------------------- | -------- | --------| -----------
2844tag                         | Required | number  | Initiator group tag (unique, integer > 0)
2845
2846### Example
2847
2848Example request:
2849
2850~~~
2851{
2852  "params": {
2853    "tag": 1
2854  },
2855  "jsonrpc": "2.0",
2856  "method": "delete_initiator_group",
2857  "id": 1
2858}
2859~~~
2860
2861Example response:
2862
2863~~~
2864{
2865  "jsonrpc": "2.0",
2866  "id": 1,
2867  "result": true
2868}
2869~~~
2870
2871## add_initiators_to_initiator_group method {#rpc_add_initiators_to_initiator_group}
2872
2873Add initiators to an existing initiator group.
2874
2875### Parameters
2876
2877Name                        | Optional | Type    | Description
2878--------------------------- | -------- | --------| -----------
2879tag                         | Required | number  | Existing initiator group tag.
2880initiators                  | Optional | array   | Array of initiator hostnames or IP addresses
2881netmasks                    | Optional | array   | Array of initiator netmasks
2882
2883### Example
2884
2885Example request:
2886
2887~~~
2888request:
2889{
2890  "params": {
2891    "initiators": [
2892      "iqn.2016-06.io.spdk:host3"
2893    ],
2894    "tag": 1,
2895    "netmasks": [
2896      "255.255.255.1"
2897    ]
2898  },
2899  "jsonrpc": "2.0",
2900  "method": "add_initiators_to_initiator_group",
2901  "id": 1
2902}
2903~~~
2904
2905Example response:
2906
2907~~~
2908response:
2909{
2910  "jsonrpc": "2.0",
2911  "id": 1,
2912  "result": true
2913}
2914~~~
2915
2916## get_target_nodes method {#rpc_get_target_nodes}
2917
2918Show information about all available iSCSI target nodes.
2919
2920### Parameters
2921
2922This method has no parameters.
2923
2924### Result
2925
2926Array of objects describing target node.
2927
2928Name                        | Type    | Description
2929--------------------------- | --------| -----------
2930name                        | string  | Target node name (ASCII)
2931alias_name                  | string  | Target node alias name (ASCII)
2932pg_ig_maps                  | array   | Array of Portal_Group_Tag:Initiator_Group_Tag mappings
2933luns                        | array   | Array of Bdev names to LUN ID mappings
2934queue_depth                 | number  | Target queue depth
2935disable_chap                | boolean | CHAP authentication should be disabled for this target
2936require_chap                | boolean | CHAP authentication should be required for this target
2937mutual_chap                 | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
2938chap_group                  | number  | Authentication group ID for this target node
2939header_digest               | boolean | Header Digest should be required for this target node
2940data_digest                 | boolean | Data Digest should be required for this target node
2941
2942### Example
2943
2944Example request:
2945
2946~~~
2947{
2948  "jsonrpc": "2.0",
2949  "method": "get_target_nodes",
2950  "id": 1
2951}
2952~~~
2953
2954Example response:
2955
2956~~~
2957{
2958  "jsonrpc": "2.0",
2959  "id": 1,
2960  "result": [
2961    {
2962      "luns": [
2963        {
2964          "lun_id": 0,
2965          "bdev_name": "Nvme0n1"
2966        }
2967      ],
2968      "mutual_chap": false,
2969      "name": "iqn.2016-06.io.spdk:target1",
2970      "alias_name": "iscsi-target1-alias",
2971      "require_chap": false,
2972      "chap_group": 0,
2973      "pg_ig_maps": [
2974        {
2975          "ig_tag": 1,
2976          "pg_tag": 1
2977        }
2978      ],
2979      "data_digest": false,
2980      "disable_chap": false,
2981      "header_digest": false,
2982      "queue_depth": 64
2983    }
2984  ]
2985}
2986~~~
2987
2988## construct_target_node method {#rpc_construct_target_node}
2989
2990Add a iSCSI target node.
2991
2992### Parameters
2993
2994Name                        | Optional | Type    | Description
2995--------------------------- | -------- | --------| -----------
2996name                        | Required | string  | Target node name (ASCII)
2997alias_name                  | Required | string  | Target node alias name (ASCII)
2998pg_ig_maps                  | Required | array   | Array of (Portal_Group_Tag:Initiator_Group_Tag) mappings
2999luns                        | Required | array   | Array of Bdev names to LUN ID mappings
3000queue_depth                 | Required | number  | Target queue depth
3001disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
3002require_chap                | Optional | boolean | CHAP authentication should be required for this target
3003mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
3004chap_group                  | Optional | number  | Authentication group ID for this target node
3005header_digest               | Optional | boolean | Header Digest should be required for this target node
3006data_digest                 | Optional | boolean | Data Digest should be required for this target node
3007
3008Parameters `disable_chap` and `require_chap` are mutually exclusive.
3009
3010### Example
3011
3012Example request:
3013
3014~~~
3015{
3016  "params": {
3017    "luns": [
3018      {
3019        "lun_id": 0,
3020        "bdev_name": "Nvme0n1"
3021      }
3022    ],
3023    "mutual_chap": true,
3024    "name": "target2",
3025    "alias_name": "iscsi-target2-alias",
3026    "pg_ig_maps": [
3027      {
3028        "ig_tag": 1,
3029        "pg_tag": 1
3030      },
3031      {
3032        "ig_tag": 2,
3033        "pg_tag": 2
3034      }
3035    ],
3036    "data_digest": true,
3037    "disable_chap": true,
3038    "header_digest": true,
3039    "queue_depth": 24
3040  },
3041  "jsonrpc": "2.0",
3042  "method": "construct_target_node",
3043  "id": 1
3044}
3045~~~
3046
3047Example response:
3048
3049~~~
3050{
3051  "jsonrpc": "2.0",
3052  "id": 1,
3053  "result": true
3054}
3055~~~
3056
3057## set_iscsi_target_node_auth method {#rpc_set_iscsi_target_node_auth}
3058
3059Set CHAP authentication to an existing iSCSI target node.
3060
3061### Parameters
3062
3063Name                        | Optional | Type    | Description
3064--------------------------- | -------- | --------| -----------
3065name                        | Required | string  | Target node name (ASCII)
3066disable_chap                | Optional | boolean | CHAP authentication should be disabled for this target
3067require_chap                | Optional | boolean | CHAP authentication should be required for this target
3068mutual_chap                 | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`)
3069chap_group                  | Optional | number  | Authentication group ID for this target node
3070
3071Parameters `disable_chap` and `require_chap` are mutually exclusive.
3072
3073### Example
3074
3075Example request:
3076
3077~~~
3078{
3079  "params": {
3080    "chap_group": 1,
3081    "require_chap": true,
3082    "name": "iqn.2016-06.io.spdk:target1",
3083    "mutual_chap": true
3084  },
3085  "jsonrpc": "2.0",
3086  "method": "set_iscsi_target_node_auth",
3087  "id": 1
3088}
3089~~~
3090
3091Example response:
3092
3093~~~
3094{
3095  "jsonrpc": "2.0",
3096  "id": 1,
3097  "result": true
3098}
3099~~~
3100
3101## add_pg_ig_maps method {#rpc_add_pg_ig_maps}
3102
3103Add initiator group to portal group mappings to an existing iSCSI target node.
3104
3105### Parameters
3106
3107Name                        | Optional | Type    | Description
3108--------------------------- | -------- | --------| -----------
3109name                        | Required | string  | Target node name (ASCII)
3110pg_ig_maps                  | Required | array   | Not empty array of initiator to portal group mappings objects
3111
3112Portal to Initiator group mappings object:
3113
3114Name                        | Optional | Type    | Description
3115--------------------------- | -------- | --------| -----------
3116ig_tag                      | Required | number  | Existing initiator group tag
3117pg_tag                      | Required | number  | Existing portal group tag
3118
3119### Example
3120
3121Example request:
3122
3123~~~
3124{
3125  "params": {
3126    "pg_ig_maps": [
3127      {
3128        "ig_tag": 1,
3129        "pg_tag": 1
3130      },
3131      {
3132        "ig_tag": 2,
3133        "pg_tag": 2
3134      },
3135      {
3136        "ig_tag": 3,
3137        "pg_tag": 3
3138      }
3139    ],
3140    "name": "iqn.2016-06.io.spdk:target3"
3141  },
3142  "jsonrpc": "2.0",
3143  "method": "add_pg_ig_maps",
3144  "id": 1
3145}
3146~~~
3147
3148Example response:
3149
3150~~~
3151{
3152  "jsonrpc": "2.0",
3153  "id": 1,
3154  "result": true
3155}
3156~~~
3157
3158## delete_pg_ig_maps method {#rpc_delete_pg_ig_maps}
3159
3160Delete initiator group to portal group mappings from an existing iSCSI target node.
3161
3162### Parameters
3163
3164Name                        | Optional | Type    | Description
3165--------------------------- | -------- | --------| -----------
3166name                        | Required | string  | Target node name (ASCII)
3167pg_ig_maps                  | Required | array   | Not empty array of Portal to Initiator group mappings objects
3168
3169Portal to Initiator group mappings object:
3170
3171Name                        | Optional | Type    | Description
3172--------------------------- | -------- | --------| -----------
3173ig_tag                      | Required | number  | Existing initiator group tag
3174pg_tag                      | Required | number  | Existing portal group tag
3175
3176### Example
3177
3178Example request:
3179
3180~~~
3181{
3182  "params": {
3183    "pg_ig_maps": [
3184      {
3185        "ig_tag": 1,
3186        "pg_tag": 1
3187      },
3188      {
3189        "ig_tag": 2,
3190        "pg_tag": 2
3191      },
3192      {
3193        "ig_tag": 3,
3194        "pg_tag": 3
3195      }
3196    ],
3197    "name": "iqn.2016-06.io.spdk:target3"
3198  },
3199  "jsonrpc": "2.0",
3200  "method": "delete_pg_ig_maps",
3201  "id": 1
3202}
3203~~~
3204
3205Example response:
3206
3207~~~
3208{
3209  "jsonrpc": "2.0",
3210  "id": 1,
3211  "result": true
3212}
3213~~~
3214
3215## delete_target_node method {#rpc_delete_target_node}
3216
3217Delete a iSCSI target node.
3218
3219### Parameters
3220
3221Name                        | Optional | Type    | Description
3222--------------------------- | -------- | --------| -----------
3223name                        | Required | string  | Target node name (ASCII)
3224
3225### Example
3226
3227Example request:
3228
3229~~~
3230{
3231  "params": {
3232    "name": "iqn.2016-06.io.spdk:target1"
3233  },
3234  "jsonrpc": "2.0",
3235  "method": "delete_target_node",
3236  "id": 1
3237}
3238~~~
3239
3240Example response:
3241
3242~~~
3243{
3244  "jsonrpc": "2.0",
3245  "id": 1,
3246  "result": true
3247}
3248~~~
3249
3250## get_portal_groups method {#rpc_get_portal_groups}
3251
3252Show information about all available portal groups.
3253
3254### Parameters
3255
3256This method has no parameters.
3257
3258### Example
3259
3260Example request:
3261
3262~~~
3263request:
3264{
3265  "jsonrpc": "2.0",
3266  "method": "get_portal_groups",
3267  "id": 1
3268}
3269~~~
3270
3271Example response:
3272
3273~~~
3274{
3275  "jsonrpc": "2.0",
3276  "id": 1,
3277  "result": [
3278    {
3279      "portals": [
3280        {
3281          "cpumask": "0x2",
3282          "host": "127.0.0.1",
3283          "port": "3260"
3284        }
3285      ],
3286      "tag": 1
3287    }
3288  ]
3289}
3290~~~
3291
3292## add_portal_group method {#rpc_add_portal_group}
3293
3294Add a portal group.
3295
3296### Parameters
3297
3298Name                        | Optional | Type    | Description
3299--------------------------- | -------- | --------| -----------
3300tag                         | Required | number  | Portal group tag
3301portals                     | Required | array   | Not empty array of portals
3302
3303Portal object
3304
3305Name                        | Optional | Type    | Description
3306--------------------------- | -------- | --------| -----------
3307host                        | Required | string  | Hostname or IP address
3308port                        | Required | string  | Port number
3309
3310### Example
3311
3312Example request:
3313
3314~~~
3315{
3316  "params": {
3317    "portals": [
3318      {
3319        "host": "127.0.0.1",
3320        "port": "3260"
3321      }
3322    ],
3323    "tag": 1
3324  },
3325  "jsonrpc": "2.0",
3326  "method": "add_portal_group",
3327  "id": 1
3328}
3329~~~
3330
3331Example response:
3332
3333~~~
3334{
3335  "jsonrpc": "2.0",
3336  "id": 1,
3337  "result": true
3338}
3339~~~
3340
3341## delete_portal_group method {#rpc_delete_portal_group}
3342
3343Delete an existing portal group.
3344
3345### Parameters
3346
3347Name                        | Optional | Type    | Description
3348--------------------------- | -------- | --------| -----------
3349tag                         | Required | number  | Existing portal group tag
3350
3351### Example
3352
3353Example request:
3354
3355~~~
3356{
3357  "params": {
3358    "tag": 1
3359  },
3360  "jsonrpc": "2.0",
3361  "method": "delete_portal_group",
3362  "id": 1
3363}
3364~~~
3365
3366Example response:
3367
3368~~~
3369{
3370  "jsonrpc": "2.0",
3371  "id": 1,
3372  "result": true
3373}
3374~~~
3375
3376## get_iscsi_connections method {#rpc_get_iscsi_connections}
3377
3378Show information about all active connections.
3379
3380### Parameters
3381
3382This method has no parameters.
3383
3384### Results
3385
3386Array of objects describing iSCSI connection.
3387
3388Name                        | Type    | Description
3389--------------------------- | --------| -----------
3390id                          | number  | Index (used for TTT - Target Transfer Tag)
3391cid                         | number  | CID (Connection ID)
3392tsih                        | number  | TSIH (Target Session Identifying Handle)
3393lcore_id                    | number  | Core number on which the iSCSI connection runs
3394initiator_addr              | string  | Initiator address
3395target_addr                 | string  | Target address
3396target_node_name            | string  | Target node name (ASCII) without prefix
3397
3398### Example
3399
3400Example request:
3401
3402~~~
3403{
3404  "jsonrpc": "2.0",
3405  "method": "get_iscsi_connections",
3406  "id": 1
3407}
3408~~~
3409
3410Example response:
3411
3412~~~
3413{
3414  "jsonrpc": "2.0",
3415  "id": 1,
3416  "result": [
3417    {
3418      "tsih": 4,
3419      "cid": 0,
3420      "target_node_name": "target1",
3421      "lcore_id": 0,
3422      "initiator_addr": "10.0.0.2",
3423      "target_addr": "10.0.0.1",
3424      "id": 0
3425    }
3426  ]
3427}
3428~~~
3429
3430## target_node_add_lun method {#rpc_target_node_add_lun}
3431
3432Add an LUN to an existing iSCSI target node.
3433
3434### Parameters
3435
3436Name                        | Optional | Type    | Description
3437--------------------------- | -------- | --------| -----------
3438name                        | Required | string  | Target node name (ASCII)
3439bdev_name                   | Required | string  | bdev name to be added as a LUN
3440lun_id                      | Optional | number  | LUN ID (default: first free ID)
3441
3442### Example
3443
3444Example request:
3445
3446~~~
3447{
3448  "params": {
3449    "lun_id": 2,
3450    "name": "iqn.2016-06.io.spdk:target1",
3451    "bdev_name": "Malloc0"
3452  },
3453  "jsonrpc": "2.0",
3454  "method": "target_node_add_lun",
3455  "id": 1
3456}
3457~~~
3458
3459Example response:
3460
3461~~~
3462{
3463  "jsonrpc": "2.0",
3464  "id": 1,
3465  "result": true
3466}
3467~~~
3468
3469# NVMe-oF Target {#jsonrpc_components_nvmf_tgt}
3470
3471## nvmf_create_transport method {#rpc_nvmf_create_transport}
3472
3473Initialize an NVMe-oF transport with the given options.
3474
3475### Parameters
3476
3477Name                        | Optional | Type    | Description
3478--------------------------- | -------- | --------| -----------
3479trtype                      | Required | string  | Transport type (ex. RDMA)
3480max_queue_depth             | Optional | number  | Max number of outstanding I/O per queue
3481max_qpairs_per_ctrlr        | Optional | number  | Max number of SQ and CQ per controller
3482in_capsule_data_size        | Optional | number  | Max number of in-capsule data size
3483max_io_size                 | Optional | number  | Max I/O size (bytes)
3484io_unit_size                | Optional | number  | I/O unit size (bytes)
3485max_aq_depth                | Optional | number  | Max number of admin cmds per AQ
3486num_shared_buffers          | Optional | number  | The number of pooled data buffers available to the transport
3487buf_cache_size              | Optional | number  | The number of shared buffers to reserve for each poll group
3488max_srq_depth               | Optional | number  | The number of elements in a per-thread shared receive queue (RDMA only)
3489no_srq                      | Optional | boolean | Disable shared receive queue even for devices that support it. (RDMA only)
3490
3491### Example:
3492
3493Example request:
3494
3495~~~
3496{
3497  "jsonrpc": "2.0",
3498  "method": "nvmf_create_transport",
3499  "id": 1,
3500  "params": {
3501    "trtype": "RDMA",
3502    "max_queue_depth": 32
3503  }
3504}
3505~~~
3506
3507Example response:
3508
3509~~~
3510{
3511  "jsonrpc": "2.0",
3512  "id": 1,
3513  "result": true
3514}
3515~~~
3516
3517## get_nvmf_subsystems method {#rpc_get_nvmf_subsystems}
3518
3519### Parameters
3520
3521This method has no parameters.
3522
3523### Example
3524
3525Example request:
3526
3527~~~
3528{
3529  "jsonrpc": "2.0",
3530  "id": 1,
3531  "method": "get_nvmf_subsystems"
3532}
3533~~~
3534
3535Example response:
3536
3537~~~
3538{
3539  "jsonrpc": "2.0",
3540  "id": 1,
3541  "result": [
3542    {
3543      "nqn": "nqn.2014-08.org.nvmexpress.discovery",
3544      "subtype": "Discovery"
3545      "listen_addresses": [],
3546      "hosts": [],
3547      "allow_any_host": true
3548    },
3549    {
3550      "nqn": "nqn.2016-06.io.spdk:cnode1",
3551      "subtype": "NVMe",
3552      "listen_addresses": [
3553        {
3554          "trtype": "RDMA",
3555          "adrfam": "IPv4",
3556          "traddr": "192.168.0.123",
3557          "trsvcid": "4420"
3558        }
3559      ],
3560      "hosts": [
3561        {"nqn": "nqn.2016-06.io.spdk:host1"}
3562      ],
3563      "allow_any_host": false,
3564      "serial_number": "abcdef",
3565      "model_number": "ghijklmnop",
3566      "namespaces": [
3567        {"nsid": 1, "name": "Malloc2"},
3568        {"nsid": 2, "name": "Nvme0n1"}
3569      ]
3570    }
3571  ]
3572}
3573~~~
3574
3575## nvmf_subsystem_create method {#rpc_nvmf_subsystem_create}
3576
3577Construct an NVMe over Fabrics target subsystem.
3578
3579### Parameters
3580
3581Name                    | Optional | Type        | Description
3582----------------------- | -------- | ----------- | -----------
3583nqn                     | Required | string      | Subsystem NQN
3584serial_number           | Optional | string      | Serial number of virtual controller
3585model_number            | Optional | string      | Model number of virtual controller
3586max_namespaces          | Optional | number      | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited)
3587allow_any_host          | Optional | boolean     | Allow any host (`true`) or enforce allowed host whitelist (`false`). Default: `false`.
3588
3589### Example
3590
3591Example request:
3592
3593~~~
3594{
3595  "jsonrpc": "2.0",
3596  "id": 1,
3597  "method": "nvmf_subsystem_create",
3598  "params": {
3599    "nqn": "nqn.2016-06.io.spdk:cnode1",
3600    "allow_any_host": false,
3601    "serial_number": "abcdef",
3602    "model_number": "ghijklmnop"
3603  }
3604}
3605~~~
3606
3607Example response:
3608
3609~~~
3610{
3611  "jsonrpc": "2.0",
3612  "id": 1,
3613  "result": true
3614}
3615~~~
3616
3617## delete_nvmf_subsystem method {#rpc_delete_nvmf_subsystem}
3618
3619Delete an existing NVMe-oF subsystem.
3620
3621### Parameters
3622
3623Parameter              | Optional | Type        | Description
3624---------------------- | -------- | ----------- | -----------
3625nqn                    | Required | string      | Subsystem NQN to delete.
3626
3627### Example
3628
3629Example request:
3630
3631~~~
3632{
3633  "jsonrpc": "2.0",
3634  "id": 1,
3635  "method": "delete_nvmf_subsystem",
3636  "params": {
3637    "nqn": "nqn.2016-06.io.spdk:cnode1"
3638  }
3639}
3640~~~
3641
3642Example response:
3643
3644~~~
3645{
3646  "jsonrpc": "2.0",
3647  "id": 1,
3648  "result": true
3649}
3650~~~
3651
3652## nvmf_subsystem_add_listener  method {#rpc_nvmf_subsystem_add_listener}
3653
3654Add a new listen address to an NVMe-oF subsystem.
3655
3656### Parameters
3657
3658Name                    | Optional | Type        | Description
3659----------------------- | -------- | ----------- | -----------
3660nqn                     | Required | string      | Subsystem NQN
3661listen_address          | Required | object      | @ref rpc_nvmf_listen_address object
3662
3663### listen_address {#rpc_nvmf_listen_address}
3664
3665Name                    | Optional | Type        | Description
3666----------------------- | -------- | ----------- | -----------
3667trtype                  | Required | string      | Transport type ("RDMA")
3668adrfam                  | Required | string      | Address family ("IPv4", "IPv6", "IB", or "FC")
3669traddr                  | Required | string      | Transport address
3670trsvcid                 | Required | string      | Transport service ID
3671
3672### Example
3673
3674Example request:
3675
3676~~~
3677{
3678  "jsonrpc": "2.0",
3679  "id": 1,
3680  "method": "nvmf_subsystem_add_listener",
3681  "params": {
3682    "nqn": "nqn.2016-06.io.spdk:cnode1",
3683    "listen_address": {
3684      "trtype": "RDMA",
3685      "adrfam": "IPv4",
3686      "traddr": "192.168.0.123",
3687      "trsvcid: "4420"
3688    }
3689  }
3690}
3691~~~
3692
3693Example response:
3694
3695~~~
3696{
3697  "jsonrpc": "2.0",
3698  "id": 1,
3699  "result": true
3700}
3701~~~
3702
3703## nvmf_subsystem_add_ns method {#rpc_nvmf_subsystem_add_ns}
3704
3705Add a namespace to a subsystem. The namespace ID is returned as the result.
3706
3707### Parameters
3708
3709Name                    | Optional | Type        | Description
3710----------------------- | -------- | ----------- | -----------
3711nqn                     | Required | string      | Subsystem NQN
3712namespace               | Required | object      | @ref rpc_nvmf_namespace object
3713
3714### namespace {#rpc_nvmf_namespace}
3715
3716Name                    | Optional | Type        | Description
3717----------------------- | -------- | ----------- | -----------
3718nsid                    | Optional | number      | Namespace ID between 1 and 4294967294, inclusive. Default: Automatically assign NSID.
3719bdev_name               | Required | string      | Name of bdev to expose as a namespace.
3720nguid                   | Optional | string      | 16-byte namespace globally unique identifier in hexadecimal (e.g. "ABCDEF0123456789ABCDEF0123456789")
3721eui64                   | Optional | string      | 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789")
3722uuid                    | Optional | string      | RFC 4122 UUID (e.g. "ceccf520-691e-4b46-9546-34af789907c5")
3723
3724### Example
3725
3726Example request:
3727
3728~~~
3729{
3730  "jsonrpc": "2.0",
3731  "id": 1,
3732  "method": "nvmf_subsystem_add_ns",
3733  "params": {
3734    "nqn": "nqn.2016-06.io.spdk:cnode1",
3735    "namespace": {
3736      "nsid": 3,
3737      "bdev_name": "Nvme0n1"
3738    }
3739  }
3740}
3741~~~
3742
3743Example response:
3744
3745~~~
3746{
3747  "jsonrpc": "2.0",
3748  "id": 1,
3749  "result": 3
3750}
3751~~~
3752
3753## nvmf_subsystem_remove_ns method {#rpc_nvmf_subsystem_remove_ns}
3754
3755Remove a namespace from a subsystem.
3756
3757### Parameters
3758
3759Name                    | Optional | Type        | Description
3760----------------------- | -------- | ----------- | -----------
3761nqn                     | Required | string      | Subsystem NQN
3762nsid                    | Required | number      | Namespace ID
3763
3764### Example
3765
3766Example request:
3767
3768~~~
3769{
3770  "jsonrpc": "2.0",
3771  "id": 1,
3772  "method": "nvmf_subsystem_remove_ns",
3773  "params": {
3774    "nqn": "nqn.2016-06.io.spdk:cnode1",
3775    "nsid": 1
3776  }
3777}
3778~~~
3779
3780Example response:
3781
3782~~~
3783{
3784  "jsonrpc": "2.0",
3785  "id": 1,
3786  "result": true
3787}
3788~~~
3789
3790## nvmf_subsystem_add_host method {#rpc_nvmf_subsystem_add_host}
3791
3792Add a host NQN to the whitelist of allowed hosts.
3793
3794### Parameters
3795
3796Name                    | Optional | Type        | Description
3797----------------------- | -------- | ----------- | -----------
3798nqn                     | Required | string      | Subsystem NQN
3799host                    | Required | string      | Host NQN to add to the list of allowed host NQNs
3800
3801### Example
3802
3803Example request:
3804
3805~~~
3806{
3807  "jsonrpc": "2.0",
3808  "id": 1,
3809  "method": "nvmf_subsystem_add_host",
3810  "params": {
3811    "nqn": "nqn.2016-06.io.spdk:cnode1",
3812    "host": "nqn.2016-06.io.spdk:host1"
3813  }
3814}
3815~~~
3816
3817Example response:
3818
3819~~~
3820{
3821  "jsonrpc": "2.0",
3822  "id": 1,
3823  "result": true
3824}
3825~~~
3826
3827## nvmf_subsystem_remove_host method {#rpc_nvmf_subsystem_remove_host}
3828
3829Remove a host NQN from the whitelist of allowed hosts.
3830
3831### Parameters
3832
3833Name                    | Optional | Type        | Description
3834----------------------- | -------- | ----------- | -----------
3835nqn                     | Required | string      | Subsystem NQN
3836host                    | Required | string      | Host NQN to remove from the list of allowed host NQNs
3837
3838### Example
3839
3840Example request:
3841
3842~~~
3843{
3844  "jsonrpc": "2.0",
3845  "id": 1,
3846  "method": "nvmf_subsystem_remove_host",
3847  "params": {
3848    "nqn": "nqn.2016-06.io.spdk:cnode1",
3849    "host": "nqn.2016-06.io.spdk:host1"
3850  }
3851}
3852~~~
3853
3854Example response:
3855
3856~~~
3857{
3858  "jsonrpc": "2.0",
3859  "id": 1,
3860  "result": true
3861}
3862~~~
3863
3864## nvmf_subsystem_allow_any_host method {#rpc_nvmf_subsystem_allow_any_host}
3865
3866Configure a subsystem to allow any host to connect or to enforce the host NQN whitelist.
3867
3868### Parameters
3869
3870Name                    | Optional | Type        | Description
3871----------------------- | -------- | ----------- | -----------
3872nqn                     | Required | string      | Subsystem NQN
3873allow_any_host          | Required | boolean     | Allow any host (`true`) or enforce allowed host whitelist (`false`).
3874
3875### Example
3876
3877Example request:
3878
3879~~~
3880{
3881  "jsonrpc": "2.0",
3882  "id": 1,
3883  "method": "nvmf_subsystem_allow_any_host",
3884  "params": {
3885    "nqn": "nqn.2016-06.io.spdk:cnode1",
3886    "allow_any_host": true
3887  }
3888}
3889~~~
3890
3891Example response:
3892
3893~~~
3894{
3895  "jsonrpc": "2.0",
3896  "id": 1,
3897  "result": true
3898}
3899~~~
3900
3901## set_nvmf_target_max_subsystems {#rpc_set_nvmf_target_max_subsystems}
3902
3903Set the maximum allowed subsystems for the NVMe-oF target.  This RPC may only be called
3904before SPDK subsystems have been initialized.
3905
3906### Parameters
3907
3908Name                    | Optional | Type        | Description
3909----------------------- | -------- | ----------- | -----------
3910max_subsystems          | Required | number      | Maximum number of NVMe-oF subsystems
3911
3912### Example
3913
3914Example request:
3915
3916~~~
3917{
3918  "jsonrpc": "2.0",
3919  "id": 1,
3920  "method": "set_nvmf_target_max_subsystems",
3921  "params": {
3922    "max_subsystems": 1024
3923  }
3924}
3925~~~
3926
3927Example response:
3928
3929~~~
3930{
3931  "jsonrpc": "2.0",
3932  "id": 1,
3933  "result": true
3934}
3935~~~
3936
3937## set_nvmf_target_config {#rpc_set_nvmf_target_config}
3938
3939Set global configuration of NVMe-oF target.  This RPC may only be called before SPDK subsystems
3940have been initialized.
3941
3942### Parameters
3943
3944Name                    | Optional | Type        | Description
3945----------------------- | -------- | ----------- | -----------
3946acceptor_poll_rate      | Optional | number      | Polling interval of the acceptor for incoming connections (microseconds)
3947
3948### Example
3949
3950Example request:
3951
3952~~~
3953{
3954  "jsonrpc": "2.0",
3955  "id": 1,
3956  "method": "set_nvmf_target_config",
3957  "params": {
3958    "acceptor_poll_rate": 10000
3959  }
3960}
3961~~~
3962
3963Example response:
3964
3965~~~
3966{
3967  "jsonrpc": "2.0",
3968  "id": 1,
3969  "result": true
3970}
3971~~~
3972
3973## get_nvmf_transports method {#rpc_get_nvmf_transports}
3974
3975### Parameters
3976
3977This method has no parameters.
3978
3979### Example
3980
3981Example request:
3982
3983~~~
3984{
3985  "jsonrpc": "2.0",
3986  "id": 1,
3987  "method": "get_nvmf_transports"
3988}
3989~~~
3990
3991Example response:
3992
3993~~~
3994{
3995  "jsonrpc": "2.0",
3996  "id": 1,
3997  "result": [
3998    {
3999      "type": "RDMA".
4000      "max_queue_depth": 128,
4001      "max_qpairs_per_ctrlr": 64,
4002      "in_capsule_data_size": 4096,
4003      "max_io_size": 131072,
4004      "io_unit_size": 131072
4005    }
4006  ]
4007}
4008~~~
4009
4010# Vhost Target {#jsonrpc_components_vhost_tgt}
4011
4012The following common preconditions need to be met in all target types.
4013
4014Controller name will be used to create UNIX domain socket. This implies that name concatenated with vhost socket
4015directory path needs to be valid UNIX socket name.
4016
4017@ref cpu_mask parameter is used to choose CPU on which pollers will be launched when new initiator is connecting.
4018It must be a subset of application CPU mask. Default value is CPU mask of the application.
4019
4020## set_vhost_controller_coalescing {#rpc_set_vhost_controller_coalescing}
4021
4022Controls interrupt coalescing for specific target. Because `delay_base_us` is used to calculate delay in CPU ticks
4023there is no hardcoded limit for this parameter. Only limitation is that final delay in CPU ticks might not overflow
402432 bit unsigned integer (which is more than 1s @ 4GHz CPU). In real scenarios `delay_base_us` should be much lower
4025than 150us. To disable coalescing set `delay_base_us` to 0.
4026
4027### Parameters
4028
4029Name                    | Optional | Type        | Description
4030----------------------- | -------- | ----------- | -----------
4031ctrlr                   | Required | string      | Controller name
4032delay_base_us           | Required | number      | Base (minimum) coalescing time in microseconds
4033iops_threshold          | Required | number      | Coalescing activation level greater than 0 in IO per second
4034
4035### Example
4036
4037Example request:
4038
4039~~~
4040{
4041  "params": {
4042    "iops_threshold": 100000,
4043    "ctrlr": "VhostScsi0",
4044    "delay_base_us": 80
4045  },
4046  "jsonrpc": "2.0",
4047  "method": "set_vhost_controller_coalescing",
4048  "id": 1
4049}
4050~~~
4051
4052Example response:
4053
4054~~~
4055{
4056  "jsonrpc": "2.0",
4057  "id": 1,
4058  "result": true
4059}
4060~~~
4061
4062## construct_vhost_scsi_controller {#rpc_construct_vhost_scsi_controller}
4063
4064Construct vhost SCSI target.
4065
4066### Parameters
4067
4068Name                    | Optional | Type        | Description
4069----------------------- | -------- | ----------- | -----------
4070ctrlr                   | Required | string      | Controller name
4071cpumask                 | Optional | string      | @ref cpu_mask for this controller
4072
4073### Example
4074
4075Example request:
4076
4077~~~
4078{
4079  "params": {
4080    "cpumask": "0x2",
4081    "ctrlr": "VhostScsi0"
4082  },
4083  "jsonrpc": "2.0",
4084  "method": "construct_vhost_scsi_controller",
4085  "id": 1
4086}
4087~~~
4088
4089Example response:
4090
4091~~~
4092{
4093  "jsonrpc": "2.0",
4094  "id": 1,
4095  "result": true
4096}
4097~~~
4098
4099## add_vhost_scsi_lun {#rpc_add_vhost_scsi_lun}
4100
4101In vhost target `ctrlr` create SCSI target with ID `scsi_target_num` and add `bdev_name` as LUN 0.
4102
4103### Parameters
4104
4105Name                    | Optional | Type        | Description
4106----------------------- | -------- | ----------- | -----------
4107ctrlr                   | Required | string      | Controller name
4108scsi_target_num         | Required | number      | SCSI target ID between 0 and 7 or -1 to use first free ID.
4109bdev_name               | Required | string      | Name of bdev to expose as a LUN 0
4110
4111### Response
4112
4113SCSI target ID.
4114
4115### Example
4116
4117Example request:
4118
4119~~~
4120{
4121  "params": {
4122    "scsi_target_num": 1,
4123    "bdev_name": "Malloc0",
4124    "ctrlr": "VhostScsi0"
4125  },
4126  "jsonrpc": "2.0",
4127  "method": "add_vhost_scsi_lun",
4128  "id": 1
4129}
4130~~~
4131
4132Example response:
4133
4134~~~
4135response:
4136{
4137  "jsonrpc": "2.0",
4138  "id": 1,
4139  "result": 1
4140}
4141~~~
4142
4143## remove_vhost_scsi_target {#rpc_remove_vhost_scsi_target}
4144
4145Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`.
4146
4147This method will fail if initiator is connected, but doesn't support hot-remove (the `VIRTIO_SCSI_F_HOTPLUG` is not negotiated).
4148
4149### Parameters
4150
4151Name                    | Optional | Type        | Description
4152----------------------- | -------- | ----------- | -----------
4153ctrlr                   | Required | string      | Controller name
4154scsi_target_num         | Required | number      | SCSI target ID between 0 and 7
4155
4156### Example
4157
4158Example request:
4159
4160~~~
4161request:
4162{
4163  "params": {
4164    "scsi_target_num": 1,
4165    "ctrlr": "VhostScsi0"
4166  },
4167  "jsonrpc": "2.0",
4168  "method": "remove_vhost_scsi_target",
4169  "id": 1
4170}
4171~~~
4172
4173Example response:
4174
4175~~~
4176{
4177  "jsonrpc": "2.0",
4178  "id": 1,
4179  "result": true
4180}
4181~~~
4182
4183## construct_vhost_nvme_controller {#rpc_construct_vhost_nvme_controller}
4184
4185Construct empty vhost NVMe controller.
4186
4187### Parameters
4188
4189Name                    | Optional | Type        | Description
4190----------------------- | -------- | ----------- | -----------
4191ctrlr                   | Required | string      | Controller name
4192io_queues               | Required | number      | Number between 1 and 31 of IO queues for the controller
4193cpumask                 | Optional | string      | @ref cpu_mask for this controller
4194
4195
4196### Example
4197
4198Example request:
4199
4200~~~
4201{
4202  "params": {
4203    "cpumask": "0x2",
4204    "io_queues": 4,
4205    "ctrlr": "VhostNvme0"
4206  },
4207  "jsonrpc": "2.0",
4208  "method": "construct_vhost_nvme_controller",
4209  "id": 1
4210}
4211~~~
4212
4213Example response:
4214
4215~~~
4216{
4217  "jsonrpc": "2.0",
4218  "id": 1,
4219  "result": true
4220}
4221~~~
4222
4223## add_vhost_nvme_ns {#rpc_add_vhost_nvme_ns}
4224
4225Add namespace backed by `bdev_name`
4226
4227### Parameters
4228
4229Name                    | Optional | Type        | Description
4230----------------------- | -------- | ----------- | -----------
4231ctrlr                   | Required | string      | Controller name
4232bdev_name               | Required | string      | Name of bdev to expose as a namespace
4233cpumask                 | Optional | string      | @ref cpu_mask for this controller
4234
4235### Example
4236
4237Example request:
4238
4239~~~
4240{
4241  "params": {
4242    "bdev_name": "Malloc0",
4243    "ctrlr": "VhostNvme0"
4244  },
4245  "jsonrpc": "2.0",
4246  "method": "add_vhost_nvme_ns",
4247  "id": 1
4248}
4249~~~
4250
4251Example response:
4252
4253~~~
4254{
4255  "jsonrpc": "2.0",
4256  "id": 1,
4257  "result": true
4258}
4259~~~
4260
4261## construct_vhost_blk_controller {#rpc_construct_vhost_blk_controller}
4262
4263Construct vhost block controller
4264
4265If `readonly` is `true` then vhost block target will be created as read only and fail any write requests.
4266The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator.
4267
4268### Parameters
4269
4270Name                    | Optional | Type        | Description
4271----------------------- | -------- | ----------- | -----------
4272ctrlr                   | Required | string      | Controller name
4273bdev_name               | Required | string      | Name of bdev to expose block device
4274readonly                | Optional | boolean     | If true, this target will be read only (default: false)
4275cpumask                 | Optional | string      | @ref cpu_mask for this controller
4276
4277
4278### Example
4279
4280Example request:
4281
4282~~~
4283{
4284  "params": {
4285    "dev_name": "Malloc0",
4286    "ctrlr": "VhostBlk0"
4287  },
4288  "jsonrpc": "2.0",
4289  "method": "construct_vhost_blk_controller",
4290  "id": 1
4291}
4292~~~
4293
4294Example response:
4295
4296~~~
4297{
4298  "jsonrpc": "2.0",
4299  "id": 1,
4300  "result": true
4301}
4302~~~
4303
4304## get_vhost_controllers {#rpc_get_vhost_controllers}
4305
4306Display information about all or specific vhost controller(s).
4307
4308### Parameters
4309
4310The user may specify no parameters in order to list all controllers, or a controller may be
4311specified by name.
4312
4313Name                    | Optional | Type        | Description
4314----------------------- | -------- | ----------- | -----------
4315name                    | Optional | string      | Vhost controller name
4316
4317
4318### Response {#rpc_get_vhost_controllers_response}
4319
4320Response is an array of objects describing requested controller(s). Common fields are:
4321
4322Name                    | Type        | Description
4323----------------------- | ----------- | -----------
4324ctrlr                   | string      | Controller name
4325cpumask                 | string      | @ref cpu_mask of this controller
4326delay_base_us           | number      | Base (minimum) coalescing time in microseconds (0 if disabled)
4327iops_threshold          | number      | Coalescing activation level
4328backend_specific        | object      | Backend specific informations
4329
4330### Vhost block {#rpc_get_vhost_controllers_blk}
4331
4332`backend_specific` contains one `block` object  of type:
4333
4334Name                    | Type        | Description
4335----------------------- | ----------- | -----------
4336bdev                    | string      | Backing bdev name or Null if bdev is hot-removed
4337readonly                | boolean     | True if controllers is readonly, false otherwise
4338
4339### Vhost SCSI {#rpc_get_vhost_controllers_scsi}
4340
4341`backend_specific` contains `scsi` array of following objects:
4342
4343Name                    | Type        | Description
4344----------------------- | ----------- | -----------
4345target_name             | string      | Name of this SCSI target
4346id                      | number      | Unique SPDK global SCSI target ID
4347scsi_dev_num            | number      | SCSI target ID initiator will see when scanning this controller
4348luns                    | array       | array of objects describing @ref rpc_get_vhost_controllers_scsi_luns
4349
4350### Vhost SCSI LUN {#rpc_get_vhost_controllers_scsi_luns}
4351
4352Object of type:
4353
4354Name                    | Type        | Description
4355----------------------- | ----------- | -----------
4356id                      | number      | SCSI LUN ID
4357bdev_name               | string      | Backing bdev name
4358
4359### Vhost NVMe {#rpc_get_vhost_controllers_nvme}
4360
4361`backend_specific` contains `namespaces` array of following objects:
4362
4363Name                    | Type        | Description
4364----------------------- | ----------- | -----------
4365nsid                    | number      | Namespace ID
4366bdev                    | string      | Backing bdev name
4367
4368### Example
4369
4370Example request:
4371
4372~~~
4373{
4374  "jsonrpc": "2.0",
4375  "method": "get_vhost_controllers",
4376  "id": 1
4377}
4378~~~
4379
4380Example response:
4381
4382~~~
4383{
4384  "jsonrpc": "2.0",
4385  "id": 1,
4386  "result": [
4387    {
4388      "cpumask": "0x2",
4389      "backend_specific": {
4390        "block": {
4391          "readonly": false,
4392          "bdev": "Malloc0"
4393        }
4394      },
4395      "iops_threshold": 60000,
4396      "ctrlr": "VhostBlk0",
4397      "delay_base_us": 100
4398    },
4399    {
4400      "cpumask": "0x2",
4401      "backend_specific": {
4402        "scsi": [
4403          {
4404            "target_name": "Target 2",
4405            "luns": [
4406              {
4407                "id": 0,
4408                "bdev_name": "Malloc1"
4409              }
4410            ],
4411            "id": 0,
4412            "scsi_dev_num": 2
4413          },
4414          {
4415            "target_name": "Target 5",
4416            "luns": [
4417              {
4418                "id": 0,
4419                "bdev_name": "Malloc2"
4420              }
4421            ],
4422            "id": 1,
4423            "scsi_dev_num": 5
4424          }
4425        ]
4426      },
4427      "iops_threshold": 60000,
4428      "ctrlr": "VhostScsi0",
4429      "delay_base_us": 0
4430    },
4431    {
4432      "cpumask": "0x2",
4433      "backend_specific": {
4434        "namespaces": [
4435          {
4436            "bdev": "Malloc3",
4437            "nsid": 1
4438          },
4439          {
4440            "bdev": "Malloc4",
4441            "nsid": 2
4442          }
4443        ]
4444      },
4445      "iops_threshold": 60000,
4446      "ctrlr": "VhostNvme0",
4447      "delay_base_us": 0
4448    }
4449  ]
4450}
4451~~~
4452
4453## remove_vhost_controller {#rpc_remove_vhost_controller}
4454
4455Remove vhost target.
4456
4457This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of
4458vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_remove_vhost_scsi_target.
4459
4460### Parameters
4461
4462Name                    | Optional | Type        | Description
4463----------------------- | -------- | ----------- | -----------
4464ctrlr                   | Required | string      | Controller name
4465
4466### Example
4467
4468Example request:
4469
4470~~~
4471{
4472  "params": {
4473    "ctrlr": "VhostNvme0"
4474  },
4475  "jsonrpc": "2.0",
4476  "method": "remove_vhost_controller",
4477  "id": 1
4478}
4479~~~
4480
4481Example response:
4482
4483~~~
4484{
4485  "jsonrpc": "2.0",
4486  "id": 1,
4487  "result": true
4488}
4489~~~
4490
4491# Logical Volume {#jsonrpc_components_lvol}
4492
4493Identification of logical volume store and logical volume is explained first.
4494
4495A logical volume store has a UUID and a name for its identification.
4496The UUID is generated on creation and it can be used as a unique identifier.
4497The name is specified on creation and can be renamed.
4498Either UUID or name is used to access logical volume store in RPCs.
4499
4500A logical volume has a UUID and a name for its identification.
4501The UUID of the logical volume is generated on creation and it can be unique identifier.
4502The alias of the logical volume takes the format _lvs_name/lvol_name_ where:
4503* _lvs_name_ is the name of the logical volume store.
4504* _lvol_name_ is specified on creation and can be renamed.
4505
4506## construct_lvol_store {#rpc_construct_lvol_store}
4507
4508Construct a logical volume store.
4509
4510### Parameters
4511
4512Name                    | Optional | Type        | Description
4513----------------------- | -------- | ----------- | -----------
4514bdev_name               | Required | string      | Bdev on which to construct logical volume store
4515lvs_name                | Required | string      | Name of the logical volume store to create
4516cluster_sz              | Optional | number      | Cluster size of the logical volume store in bytes
4517clear_method            | Optional | string      | Change clear method for data region. Available: none, unmap (default), write_zeroes
4518
4519### Response
4520
4521UUID of the created logical volume store is returned.
4522
4523### Example
4524
4525Example request:
4526
4527~~~
4528{
4529  "jsonrpc": "2.0",
4530  "id": 1,
4531  "method": "construct_lvol_store",
4532  "params": {
4533    "lvs_name": "LVS0",
4534    "bdev_name": "Malloc0"
4535    "clear_method": "write_zeroes"
4536  }
4537}
4538~~~
4539
4540Example response:
4541
4542~~~
4543{
4544  "jsonrpc": "2.0",
4545  "id": 1,
4546  "result": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
4547}
4548~~~
4549
4550## destroy_lvol_store {#rpc_destroy_lvol_store}
4551
4552Destroy a logical volume store.
4553
4554### Parameters
4555
4556Name                    | Optional | Type        | Description
4557----------------------- | -------- | ----------- | -----------
4558uuid                    | Optional | string      | UUID of the logical volume store to destroy
4559lvs_name                | Optional | string      | Name of the logical volume store to destroy
4560
4561Either uuid or lvs_name must be specified, but not both.
4562
4563### Example
4564
4565Example request:
4566
4567~~~
4568{
4569  "jsonrpc": "2.0",
4570  "method": "destroy_lvol_store",
4571  "id": 1
4572  "params": {
4573    "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5"
4574  }
4575}
4576~~~
4577
4578Example response:
4579
4580~~~
4581{
4582  "jsonrpc": "2.0",
4583  "id": 1,
4584  "result": true
4585}
4586~~~
4587
4588## get_lvol_stores {#rpc_get_lvol_stores}
4589
4590Get a list of logical volume stores.
4591
4592### Parameters
4593
4594Name                    | Optional | Type        | Description
4595----------------------- | -------- | ----------- | -----------
4596uuid                    | Optional | string      | UUID of the logical volume store to retrieve information about
4597lvs_name                | Optional | string      | Name of the logical volume store to retrieve information about
4598
4599Either uuid or lvs_name may be specified, but not both.
4600If both uuid and lvs_name are omitted, information about all logical volume stores is returned.
4601
4602### Example
4603
4604Example request:
4605
4606~~~
4607{
4608  "jsonrpc": "2.0",
4609  "method": "get_lvol_stores",
4610  "id": 1,
4611  "params": {
4612    "lvs_name": "LVS0"
4613  }
4614}
4615~~~
4616
4617Example response:
4618
4619~~~
4620{
4621  "jsonrpc": "2.0",
4622  "id": 1,
4623  "result": [
4624    {
4625      "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5",
4626      "base_bdev": "Malloc0",
4627      "free_clusters": 31,
4628      "cluster_size": 4194304,
4629      "total_data_clusters": 31,
4630      "block_size": 4096,
4631      "name": "LVS0"
4632    }
4633  ]
4634}
4635~~~
4636
4637## rename_lvol_store {#rpc_rename_lvol_store}
4638
4639Rename a logical volume store.
4640
4641### Parameters
4642
4643Name                    | Optional | Type        | Description
4644----------------------- | -------- | ----------- | -----------
4645old_name                | Required | string      | Existing logical volume store name
4646new_name                | Required | string      | New logical volume store name
4647
4648### Example
4649
4650Example request:
4651
4652~~~
4653{
4654  "jsonrpc": "2.0",
4655  "method": "rename_lvol_store",
4656  "id": 1,
4657  "params": {
4658    "old_name": "LVS0",
4659    "new_name": "LVS2"
4660  }
4661}
4662~~~
4663
4664Example response:
4665
4666~~~
4667{
4668  "jsonrpc": "2.0",
4669  "id": 1,
4670  "result": true
4671}
4672~~~
4673
4674## construct_lvol_bdev {#rpc_construct_lvol_bdev}
4675
4676Create a logical volume on a logical volume store.
4677
4678### Parameters
4679
4680Name                    | Optional | Type        | Description
4681----------------------- | -------- | ----------- | -----------
4682lvol_name               | Required | string      | Name of logical volume to create
4683size                    | Required | number      | Desired size of logical volume in megabytes
4684thin_provision          | Optional | boolean     | True to enable thin provisioning
4685uuid                    | Optional | string      | UUID of logical volume store to create logical volume on
4686lvs_name                | Optional | string      | Name of logical volume store to create logical volume on
4687clear_method            | Optional | string      | Change default data clusters clear method. Available: none, unmap, write_zeroes
4688
4689Size will be rounded up to a multiple of cluster size. Either uuid or lvs_name must be specified, but not both.
4690lvol_name will be used in the alias of the created logical volume.
4691
4692### Response
4693
4694UUID of the created logical volume is returned.
4695
4696### Example
4697
4698Example request:
4699
4700~~~
4701{
4702  "jsonrpc": "2.0",
4703  "method": "construct_lvol_bdev",
4704  "id": 1,
4705  "params": {
4706    "lvol_name": "LVOL0",
4707    "size": 1048576,
4708    "lvs_name": "LVS0",
4709    "clear_method": "unmap",
4710    "thin_provision": true
4711  }
4712}
4713~~~
4714
4715Example response:
4716
4717~~~
4718{
4719  "jsonrpc": "2.0",
4720  "id": 1,
4721  "result": "1b38702c-7f0c-411e-a962-92c6a5a8a602"
4722}
4723~~~
4724
4725## snapshot_lvol_bdev {#rpc_snapshot_lvol_bdev}
4726
4727Capture a snapshot of the current state of a logical volume.
4728
4729### Parameters
4730
4731Name                    | Optional | Type        | Description
4732----------------------- | -------- | ----------- | -----------
4733lvol_name               | Required | string      | UUID or alias of the logical volume to create a snapshot from
4734snapshot_name           | Required | string      | Name for the newly created snapshot
4735
4736### Response
4737
4738UUID of the created logical volume snapshot is returned.
4739
4740### Example
4741
4742Example request:
4743
4744~~~
4745{
4746  "jsonrpc": "2.0",
4747  "method": "snapshot_lvol_bdev",
4748  "id": 1,
4749  "params": {
4750    "lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602",
4751    "snapshot_name": "SNAP1"
4752  }
4753}
4754~~~
4755
4756Example response:
4757
4758~~~
4759{
4760  "jsonrpc": "2.0",
4761  "id": 1,
4762  "result": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670"
4763}
4764~~~
4765
4766## clone_lvol_bdev {#rpc_clone_lvol_bdev}
4767
4768Create a logical volume based on a snapshot.
4769
4770### Parameters
4771
4772Name                    | Optional | Type        | Description
4773----------------------- | -------- | ----------- | -----------
4774snapshot_name           | Required | string      | UUID or alias of the snapshot to clone
4775clone_name              | Required | string      | Name for the logical volume to create
4776
4777### Response
4778
4779UUID of the created logical volume clone is returned.
4780
4781### Example
4782
4783Example request:
4784
4785~~~
4786{
4787  "jsonrpc": "2.0"
4788  "method": "clone_lvol_bdev",
4789  "id": 1,
4790  "params": {
4791    "snapshot_name": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670",
4792    "clone_name": "CLONE1"
4793  }
4794}
4795~~~
4796
4797Example response:
4798
4799~~~
4800{
4801  "jsonrpc": "2.0",
4802  "id": 1,
4803  "result": "8d87fccc-c278-49f0-9d4c-6237951aca09"
4804}
4805~~~
4806
4807## rename_lvol_bdev {#rpc_rename_lvol_bdev}
4808
4809Rename a logical volume. New name will rename only the alias of the logical volume.
4810
4811### Parameters
4812
4813Name                    | Optional | Type        | Description
4814----------------------- | -------- | ----------- | -----------
4815old_name                | Required | string      | UUID or alias of the existing logical volume
4816new_name                | Required | string      | New logical volume name
4817
4818### Example
4819
4820Example request:
4821
4822~~~
4823{
4824  "jsonrpc": "2.0",
4825  "method": "rename_lvol_bdev",
4826  "id": 1,
4827  "params": {
4828    "old_name": "067df606-6dbc-4143-a499-0d05855cb3b8",
4829    "new_name": "LVOL2"
4830  }
4831}
4832~~~
4833
4834Example response:
4835
4836~~~
4837{
4838  "jsonrpc": "2.0",
4839  "id": 1,
4840  "result": true
4841}
4842~~~
4843
4844## resize_lvol_bdev {#rpc_resize_lvol_bdev}
4845
4846Resize a logical volume.
4847
4848### Parameters
4849
4850Name                    | Optional | Type        | Description
4851----------------------- | -------- | ----------- | -----------
4852name                    | Required | string      | UUID or alias of the logical volume to resize
4853size                    | Required | number      | Desired size of the logical volume in megabytes
4854
4855### Example
4856
4857Example request:
4858
4859~~~
4860{
4861  "jsonrpc": "2.0",
4862  "method": "resize_lvol_bdev",
4863  "id": 1,
4864  "params": {
4865    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
4866    "size": 2097152
4867  }
4868}
4869~~~
4870
4871Example response:
4872
4873~~~
4874{
4875  "jsonrpc": "2.0",
4876  "id": 1,
4877  "result": true
4878}
4879~~~
4880
4881## set_read_only_lvol_bdev{#rpc_set_read_only_lvol_bdev}
4882
4883Mark logical volume as read only.
4884
4885### Parameters
4886
4887Name                    | Optional | Type        | Description
4888----------------------- | -------- | ----------- | -----------
4889name                    | Required | string      | UUID or alias of the logical volume to set as read only
4890
4891### Example
4892
4893Example request:
4894
4895~~~
4896{
4897  "jsonrpc": "2.0",
4898  "method": "set_read_only_lvol_bdev",
4899  "id": 1,
4900  "params": {
4901    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a",
4902  }
4903}
4904~~~
4905
4906Example response:
4907
4908~~~
4909{
4910  "jsonrpc": "2.0",
4911  "id": 1,
4912  "result": true
4913}
4914~~~
4915
4916## destroy_lvol_bdev {#rpc_destroy_lvol_bdev}
4917
4918Destroy a logical volume.
4919
4920### Parameters
4921
4922Name                    | Optional | Type        | Description
4923----------------------- | -------- | ----------- | -----------
4924name                    | Required | string      | UUID or alias of the logical volume to destroy
4925
4926### Example
4927
4928Example request:
4929
4930~~~
4931{
4932  "jsonrpc": "2.0",
4933  "method": "destroy_lvol_bdev",
4934  "id": 1,
4935  "params": {
4936    "name": "51638754-ca16-43a7-9f8f-294a0805ab0a"
4937  }
4938}
4939~~~
4940
4941Example response:
4942
4943~~~
4944{
4945  "jsonrpc": "2.0",
4946  "id": 1,
4947  "result": true
4948}
4949~~~
4950
4951## inflate_lvol_bdev {#rpc_inflate_lvol_bdev}
4952
4953Inflate a logical volume. All unallocated clusters are allocated and copied from the parent or zero filled if not allocated in the parent. Then all dependencies on the parent are removed.
4954
4955### Parameters
4956
4957Name                    | Optional | Type        | Description
4958----------------------- | -------- | ----------- | -----------
4959name                    | Required | string      | UUID or alias of the logical volume to inflate
4960
4961### Example
4962
4963Example request:
4964
4965~~~
4966{
4967  "jsonrpc": "2.0",
4968  "method": "inflate_lvol_bdev",
4969  "id": 1,
4970  "params": {
4971    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
4972  }
4973}
4974~~~
4975
4976Example response:
4977
4978~~~
4979{
4980  "jsonrpc": "2.0",
4981  "id": 1,
4982  "result": true
4983}
4984~~~
4985
4986## decouple_parent_lvol_bdev {#rpc_decouple_parent_lvol_bdev}
4987
4988Decouple the parent of a logical volume. For unallocated clusters which is allocated in the parent, they are allocated and copied from the parent, but for unallocated clusters which is thin provisioned in the parent, they are kept thin provisioned. Then all dependencies on the parent are removed.
4989
4990### Parameters
4991
4992Name                    | Optional | Type        | Description
4993----------------------- | -------- | ----------- | -----------
4994name                    | Required | string      | UUID or alias of the logical volume to decouple the parent of it
4995
4996### Example
4997
4998Example request:
4999
5000~~~
5001{
5002  "jsonrpc": "2.0",
5003  "method": "decouple_parent_lvol_bdev",
5004  "id": 1.
5005  "params": {
5006    "name": "8d87fccc-c278-49f0-9d4c-6237951aca09"
5007  }
5008}
5009~~~
5010
5011Example response:
5012
5013~~~
5014{
5015  "jsonrpc": "2.0",
5016  "id": 1,
5017  "result": true
5018}
5019~~~
5020
5021# Notifications
5022
5023## get_notification_types {#rpc_get_notification_types}
5024
5025Return list of all supported notification types.
5026
5027### Parameters
5028
5029None
5030
5031### Response
5032
5033The response is an array of strings - supported RPC notification types.
5034
5035### Example
5036
5037Example request:
5038
5039~~~
5040{
5041  "jsonrpc": "2.0",
5042  "method": "get_notification_types",
5043  "id": 1
5044}
5045~~~
5046
5047Example response:
5048
5049~~~
5050{
5051  "id": 1,
5052  "result": [
5053    "bdev_register",
5054    "bdev_unregister"
5055  ],
5056  "jsonrpc": "2.0"
5057}
5058~~~
5059
5060## get_notifications {#get_notifications}
5061
5062Request notifications. Returns array of notifications that happend since the specified id (or first that is available).
5063
5064Notice: Notifications are kept in circular buffer with limited size. Older notifications might be inaccesible due to being overwritten by new ones.
5065
5066### Parameters
5067
5068Name                    | Optional | Type        | Description
5069----------------------- | -------- | ----------- | -----------
5070id                      | Optional | number      | First Event ID to fetch (default: first available).
5071max                     | Optional | number      | Maximum number of event to return (default: no limit).
5072
5073### Response
5074
5075Response is an array of event objects.
5076
5077Name                    | Optional | Type        | Description
5078----------------------- | -------- | ----------- | -----------
5079id                      | Optional | number      | Event ID.
5080type                    | Optional | number      | Type of the event.
5081ctx                     | Optional | string      | Event context.
5082
5083### Example
5084
5085Example request:
5086
5087~~~
5088{
5089  "id": 1,
5090  "jsonrpc": "2.0",
5091  "method": "get_notifications",
5092  "params": {
5093    "id": 1,
5094    "max": 10
5095  }
5096}
5097
5098~~~
5099
5100Example response:
5101
5102~~~
5103{
5104  "jsonrpc": "2.0",
5105  "id": 1,
5106  "result": [
5107    {
5108      "ctx": "Malloc0",
5109      "type": "bdev_register",
5110      "id": 1
5111    },
5112    {
5113      "ctx": "Malloc2",
5114      "type": "bdev_register",
5115      "id": 2
5116    }
5117  ]
5118}
5119~~~
5120
5121# Linux Network Block Device (NBD) {#jsonrpc_components_nbd}
5122
5123SPDK supports exporting bdevs through Linux nbd. These devices then appear as standard Linux kernel block devices and can be accessed using standard utilities like fdisk.
5124
5125In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'.
5126
5127## start_nbd_disk {#rpc_start_nbd_disk}
5128
5129Start to export one SPDK bdev as NBD disk
5130
5131### Parameters
5132
5133Name                    | Optional | Type        | Description
5134----------------------- | -------- | ----------- | -----------
5135bdev_name               | Required | string      | Bdev name to export
5136nbd_device              | Optional | string      | NBD device name to assign
5137
5138### Response
5139
5140Path of exported NBD disk
5141
5142### Example
5143
5144Example request:
5145
5146~~~
5147{
5148 "params": {
5149    "nbd_device": "/dev/nbd1",
5150    "bdev_name": "Malloc1"
5151  },
5152  "jsonrpc": "2.0",
5153  "method": "start_nbd_disk",
5154  "id": 1
5155}
5156~~~
5157
5158Example response:
5159
5160~~~
5161{
5162  "jsonrpc": "2.0",
5163  "id": 1,
5164  "result": "/dev/nbd1"
5165}
5166~~~
5167
5168## stop_nbd_disk {#rpc_stop_nbd_disk}
5169
5170Stop one NBD disk which is based on SPDK bdev.
5171
5172### Parameters
5173
5174Name                    | Optional | Type        | Description
5175----------------------- | -------- | ----------- | -----------
5176nbd_device              | Required | string      | NBD device name to stop
5177
5178### Example
5179
5180Example request:
5181
5182~~~
5183{
5184 "params": {
5185    "nbd_device": "/dev/nbd1",
5186  },
5187  "jsonrpc": "2.0",
5188  "method": "stop_nbd_disk",
5189  "id": 1
5190}
5191~~~
5192
5193Example response:
5194
5195~~~
5196{
5197  "jsonrpc": "2.0",
5198  "id": 1,
5199  "result": "true"
5200}
5201~~~
5202
5203## get_nbd_disks {#rpc_get_nbd_disks}
5204
5205Display all or specified NBD device list
5206
5207### Parameters
5208
5209Name                    | Optional | Type        | Description
5210----------------------- | -------- | ----------- | -----------
5211nbd_device              | Optional | string      | NBD device name to display
5212
5213### Response
5214
5215The response is an array of exported NBD devices and their corresponding SPDK bdev.
5216
5217### Example
5218
5219Example request:
5220
5221~~~
5222{
5223  "jsonrpc": "2.0",
5224  "method": "get_nbd_disks",
5225  "id": 1
5226}
5227~~~
5228
5229Example response:
5230
5231~~~
5232{
5233  "jsonrpc": "2.0",
5234  "id": 1,
5235  "result":  [
5236    {
5237      "bdev_name": "Malloc0",
5238      "nbd_device": "/dev/nbd0"
5239    },
5240    {
5241      "bdev_name": "Malloc1",
5242      "nbd_device": "/dev/nbd1"
5243    }
5244  ]
5245}
5246~~~
5247
5248# Miscellaneous RPC commands
5249
5250## send_nvme_cmd {#rpc_send_nvme_cmd}
5251
5252Send NVMe command directly to NVMe controller or namespace. Parameters and responses encoded by base64 urlsafe need further processing.
5253
5254Notice: send_nvme_cmd requires user to guarentee the correctness of NVMe command itself, and also optional parameters. Illegal command contents or mismatching buffer size may result in unpredictable behavior.
5255
5256### Parameters
5257
5258Name                    | Optional | Type        | Description
5259----------------------- | -------- | ----------- | -----------
5260name                    | Required | string      | Name of the operating NVMe controller
5261cmd_type                | Required | string      | Type of nvme cmd. Valid values are: admin, io
5262data_direction          | Required | string      | Direction of data transfer. Valid values are: c2h, h2c
5263cmdbuf                  | Required | string      | NVMe command encoded by base64 urlsafe
5264data                    | Optional | string      | Data transferring to controller from host, encoded by base64 urlsafe
5265metadata                | Optional | string      | Metadata transferring to controller from host, encoded by base64 urlsafe
5266data_len                | Optional | number      | Data length required to transfer from controller to host
5267metadata_len            | Optional | number      | Metadata length required to transfer from controller to host
5268timeout_ms              | Optional | number      | Command execution timeout value, in milliseconds
5269
5270### Response
5271
5272Name                    | Type        | Description
5273----------------------- | ----------- | -----------
5274cpl                     | string      | NVMe completion queue entry, encoded by base64 urlsafe
5275data                    | string      | Data transferred from controller to host, encoded by base64 urlsafe
5276metadata                | string      | Metadata transferred from controller to host, encoded by base64 urlsafe
5277
5278### Example
5279
5280Example request:
5281
5282~~~
5283{
5284  "jsonrpc": "2.0",
5285  "method": "send_nvme_cmd",
5286  "id": 1,
5287  "params": {
5288    "name": "Nvme0",
5289    "cmd_type": "admin"
5290    "data_direction": "c2h",
5291    "cmdbuf": "BgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAsGUs9P5_AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
5292    "data_len": 60,
5293  }
5294}
5295~~~
5296
5297Example response:
5298
5299~~~
5300{
5301  "jsonrpc": "2.0",
5302  "id": 1,
5303  "result":  {
5304    "cpl": "AAAAAAAAAAARAAAAWrmwABAA==",
5305    "data": "sIjg6AAAAACwiODoAAAAALCI4OgAAAAAAAYAAREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
5306  }
5307
5308}
5309~~~
5310
5311## get_spdk_version {#rpc_get_spdk_version}
5312
5313Get the version info of the running SPDK application.
5314
5315### Parameters
5316
5317This method has no parameters.
5318
5319### Response
5320
5321The response is the version number including major version number, minor version number, patch level number and suffix string.
5322
5323### Example
5324
5325Example request:
5326~~
5327{
5328  "jsonrpc": "2.0",
5329  "id": 1,
5330  "method": "get_spdk_version"
5331}
5332~~
5333
5334Example response:
5335~~
5336{
5337  "jsonrpc": "2.0",
5338  "id": 1,
5339  "result":  {
5340    "version": "19.04-pre",
5341    "fields" : {
5342      "major": 19,
5343      "minor": 4,
5344      "patch": 0,
5345      "suffix": "-pre"
5346    }
5347  }
5348}
5349~~
5350