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