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