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