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_framework_start_init) 33-32600 | Invalid request - not compliant with JSON-RPC 2.0 Specification 34-32601 | Method not found 35-32602 | @ref jsonrpc_invalid_params 36-32603 | Internal error for e.g.: errors like out of memory 37-32700 | @ref jsonrpc_parser_error 38 39### Parser error {#jsonrpc_parser_error} 40 41Encountered some error during parsing request like: 42 43- the JSON object is malformed 44- parameter is too long 45- request is too long 46 47### Invalid params {#jsonrpc_invalid_params} 48 49This type of error is most common one. It mean that there is an error while processing the request like: 50 51- Parameters decoding in RPC method handler failed because required parameter is missing. 52- Unknown parameter present encountered. 53- Parameter type doesn't match expected type e.g.: given number when expected a string. 54- Parameter domain check failed. 55- Request is valid but some other error occurred during processing request. If possible message explains the error reason nature. 56 57# App Framework {#jsonrpc_components_app} 58 59## spdk_kill_instance {#rpc_spdk_kill_instance} 60 61Send a signal to the application. 62 63### Parameters 64 65Name | Optional | Type | Description 66----------------------- | -------- | ----------- | ----------- 67sig_name | Required | string | Signal to send (SIGINT, SIGTERM, SIGQUIT, SIGHUP, or SIGKILL) 68 69### Example 70 71Example request: 72 73~~~ 74{ 75 "jsonrpc": "2.0", 76 "id": 1, 77 "method": "spdk_kill_instance", 78 "params": { 79 "sig_name": "SIGINT" 80 } 81} 82~~~ 83 84Example response: 85 86~~~ 87{ 88 "jsonrpc": "2.0", 89 "id": 1, 90 "result": true 91} 92~~~ 93 94## framework_monitor_context_switch {#rpc_framework_monitor_context_switch} 95 96Query, enable, or disable the context switch monitoring functionality. 97 98### Parameters 99 100Name | Optional | Type | Description 101----------------------- | -------- | ----------- | ----------- 102enabled | Optional | boolean | Enable (`true`) or disable (`false`) monitoring (omit this parameter to query the current state) 103 104### Response 105 106Name | Type | Description 107----------------------- | ----------- | ----------- 108enabled | boolean | The current state of context switch monitoring 109 110### Example 111 112Example request: 113 114~~~ 115{ 116 "jsonrpc": "2.0", 117 "id": 1, 118 "method": "framework_monitor_context_switch", 119 "params": { 120 "enabled": false 121 } 122} 123~~~ 124 125Example response: 126 127~~~ 128{ 129 "jsonrpc": "2.0", 130 "id": 1, 131 "result": { 132 "enabled": false 133 } 134} 135~~~ 136 137## framework_start_init {#rpc_framework_start_init} 138 139Start initialization of SPDK subsystems when it is deferred by starting SPDK application with option -w. 140During its deferral some RPCs can be used to set global parameters for SPDK subsystems. 141This RPC can be called only once. 142 143### Parameters 144 145This method has no parameters. 146 147### Response 148 149Completion status of SPDK subsystem initialization is returned as a boolean. 150 151### Example 152 153Example request: 154 155~~~ 156{ 157 "jsonrpc": "2.0", 158 "id": 1, 159 "method": "framework_start_init" 160} 161~~~ 162 163Example response: 164 165~~~ 166{ 167 "jsonrpc": "2.0", 168 "id": 1, 169 "result": true 170} 171~~~ 172 173## framework_wait_init {#rpc_framework_wait_init} 174 175Do not return until all subsystems have been initialized and the RPC system state is running. 176If the application is already running, this call will return immediately. This RPC can be called at any time. 177 178### Parameters 179 180This method has no parameters. 181 182### Response 183 184Returns True when subsystems have been initialized. 185 186### Example 187 188Example request: 189 190~~~ 191{ 192 "jsonrpc": "2.0", 193 "id": 1, 194 "method": "framework_wait_init" 195} 196~~~ 197 198Example response: 199 200~~~ 201{ 202 "jsonrpc": "2.0", 203 "id": 1, 204 "result": true 205} 206~~~ 207 208## rpc_get_methods {#rpc_rpc_get_methods} 209 210Get an array of supported RPC methods. 211 212### Parameters 213 214Name | Optional | Type | Description 215----------------------- | -------- | ----------- | ----------- 216current | Optional | boolean | Get an array of RPC methods only callable in the current state. 217 218### Response 219 220The response is an array of supported RPC methods. 221 222### Example 223 224Example request: 225 226~~~ 227{ 228 "jsonrpc": "2.0", 229 "id": 1, 230 "method": "rpc_get_methods" 231} 232~~~ 233 234Example response: 235 236~~~ 237{ 238 "jsonrpc": "2.0", 239 "id": 1, 240 "result": [ 241 "framework_start_init", 242 "rpc_get_methods", 243 "scsi_get_devices", 244 "net_get_interfaces", 245 "delete_ip_address", 246 "net_interface_add_ip_address", 247 "nbd_get_disks", 248 "nbd_stop_disk", 249 "nbd_start_disk", 250 "log_get_flags", 251 "log_clear_flag", 252 "log_set_flag", 253 "log_get_level", 254 "log_set_level", 255 "log_get_print_level", 256 "log_set_print_level", 257 "iscsi_get_options", 258 "iscsi_target_node_add_lun", 259 "iscsi_get_connections", 260 "iscsi_delete_portal_group", 261 "iscsi_create_portal_group", 262 "iscsi_get_portal_groups", 263 "iscsi_delete_target_node", 264 "iscsi_target_node_remove_pg_ig_maps", 265 "iscsi_target_node_add_pg_ig_maps", 266 "iscsi_create_target_node", 267 "iscsi_get_target_nodes", 268 "iscsi_delete_initiator_group", 269 "iscsi_initiator_group_remove_initiators", 270 "iscsi_initiator_group_add_initiators", 271 "iscsi_create_initiator_group", 272 "iscsi_get_initiator_groups", 273 "iscsi_set_options", 274 "bdev_set_options", 275 "bdev_set_qos_limit", 276 "bdev_get_bdevs", 277 "bdev_get_iostat", 278 "framework_get_config", 279 "framework_get_subsystems", 280 "framework_monitor_context_switch", 281 "spdk_kill_instance", 282 "ioat_scan_accel_engine", 283 "bdev_virtio_attach_controller", 284 "bdev_virtio_scsi_get_devices", 285 "bdev_virtio_detach_controller", 286 "bdev_aio_delete", 287 "bdev_aio_create", 288 "bdev_split_delete", 289 "bdev_split_create", 290 "bdev_error_inject_error", 291 "bdev_error_delete", 292 "bdev_error_create", 293 "bdev_passthru_create", 294 "bdev_passthru_delete" 295 "bdev_nvme_apply_firmware", 296 "bdev_nvme_detach_controller", 297 "bdev_nvme_attach_controller", 298 "bdev_null_create", 299 "bdev_malloc_delete", 300 "bdev_malloc_create", 301 "bdev_ftl_delete", 302 "bdev_ftl_create", 303 "bdev_lvol_get_lvstores", 304 "bdev_lvol_delete", 305 "bdev_lvol_resize", 306 "bdev_lvol_set_read_only", 307 "bdev_lvol_decouple_parent", 308 "bdev_lvol_inflate", 309 "bdev_lvol_rename", 310 "bdev_lvol_clone", 311 "bdev_lvol_snapshot", 312 "bdev_lvol_create", 313 "bdev_lvol_delete_lvstore", 314 "bdev_lvol_rename_lvstore", 315 "bdev_lvol_create_lvstore" 316 ] 317} 318~~~ 319 320## framework_get_subsystems {#rpc_framework_get_subsystems} 321 322Get an array of name and dependency relationship of SPDK subsystems in initialization order. 323 324### Parameters 325 326None 327 328### Response 329 330The response is an array of name and dependency relationship of SPDK subsystems in initialization order. 331 332### Example 333 334Example request: 335 336~~~ 337{ 338 "jsonrpc": "2.0", 339 "id": 1, 340 "method": "framework_get_subsystems" 341} 342~~~ 343 344Example response: 345 346~~~ 347{ 348 "jsonrpc": "2.0", 349 "id": 1, 350 "result": [ 351 { 352 "subsystem": "accel", 353 "depends_on": [] 354 }, 355 { 356 "subsystem": "interface", 357 "depends_on": [] 358 }, 359 { 360 "subsystem": "net_framework", 361 "depends_on": [ 362 "interface" 363 ] 364 }, 365 { 366 "subsystem": "bdev", 367 "depends_on": [ 368 "accel" 369 ] 370 }, 371 { 372 "subsystem": "nbd", 373 "depends_on": [ 374 "bdev" 375 ] 376 }, 377 { 378 "subsystem": "nvmf", 379 "depends_on": [ 380 "bdev" 381 ] 382 }, 383 { 384 "subsystem": "scsi", 385 "depends_on": [ 386 "bdev" 387 ] 388 }, 389 { 390 "subsystem": "vhost", 391 "depends_on": [ 392 "scsi" 393 ] 394 }, 395 { 396 "subsystem": "iscsi", 397 "depends_on": [ 398 "scsi" 399 ] 400 } 401 ] 402} 403~~~ 404 405## framework_get_config {#rpc_framework_get_config} 406 407Get current configuration of the specified SPDK framework 408 409### Parameters 410 411Name | Optional | Type | Description 412----------------------- | -------- | ----------- | ----------- 413name | Required | string | SPDK subsystem name 414 415### Response 416 417The response is current configuration of the specified SPDK subsystem. 418Null is returned if it is not retrievable by the framework_get_config method and empty array is returned if it is empty. 419 420### Example 421 422Example request: 423 424~~~ 425{ 426 "jsonrpc": "2.0", 427 "id": 1, 428 "method": "framework_get_config", 429 "params": { 430 "name": "bdev" 431 } 432} 433~~~ 434 435Example response: 436 437~~~ 438{ 439 "jsonrpc": "2.0", 440 "id": 1, 441 "result": [ 442 { 443 "params": { 444 "base_bdev": "Malloc2", 445 "split_size_mb": 0, 446 "split_count": 2 447 }, 448 "method": "bdev_split_create" 449 }, 450 { 451 "params": { 452 "trtype": "PCIe", 453 "name": "Nvme1", 454 "traddr": "0000:01:00.0" 455 }, 456 "method": "bdev_nvme_attach_controller" 457 }, 458 { 459 "params": { 460 "trtype": "PCIe", 461 "name": "Nvme2", 462 "traddr": "0000:03:00.0" 463 }, 464 "method": "bdev_nvme_attach_controller" 465 }, 466 { 467 "params": { 468 "block_size": 512, 469 "num_blocks": 131072, 470 "name": "Malloc0", 471 "uuid": "913fc008-79a7-447f-b2c4-c73543638c31" 472 }, 473 "method": "bdev_malloc_create" 474 }, 475 { 476 "params": { 477 "block_size": 512, 478 "num_blocks": 131072, 479 "name": "Malloc1", 480 "uuid": "dd5b8f6e-b67a-4506-b606-7fff5a859920" 481 }, 482 "method": "bdev_malloc_create" 483 } 484 ] 485} 486~~~ 487 488## framework_get_reactors {#rpc_framework_get_reactors} 489 490Retrieve an array of all reactors. 491 492### Parameters 493 494This method has no parameters. 495 496### Response 497 498The response is an array of all reactors. 499 500### Example 501 502Example request: 503~~~ 504{ 505 "jsonrpc": "2.0", 506 "method": "framework_get_reactors", 507 "id": 1 508} 509~~~ 510 511Example response: 512~~~ 513{ 514 "jsonrpc": "2.0", 515 "id": 1, 516 "result": { 517 "tick_rate": 2400000000, 518 "reactors": [ 519 { 520 "lcore": 0, 521 "busy": 41289723495, 522 "idle": 3624832946, 523 "lw_threads": [ 524 { 525 "name": "app_thread", 526 "id", 1, 527 "cpumask": "1", 528 "elapsed": 44910853363 529 } 530 ] 531 } 532 ] 533 } 534} 535~~~ 536 537## thread_get_stats {#rpc_thread_get_stats} 538 539Retrieve current statistics of all the threads. 540 541### Parameters 542 543This method has no parameters. 544 545### Response 546 547The response is an array of objects containing threads statistics. 548 549### Example 550 551Example request: 552~~~ 553{ 554 "jsonrpc": "2.0", 555 "method": "thread_get_stats", 556 "id": 1 557} 558~~~ 559 560Example response: 561~~~ 562{ 563 "jsonrpc": "2.0", 564 "id": 1, 565 "result": { 566 "tick_rate": 2400000000, 567 "threads": [ 568 { 569 "name": "app_thread", 570 "id": 1, 571 "cpumask": "1", 572 "busy": 139223208, 573 "idle": 8641080608, 574 "active_pollers_count": 1, 575 "timed_pollers_count": 2, 576 "paused_pollers_count": 0 577 } 578 ] 579 } 580} 581~~~ 582 583## thread_set_cpumask {#rpc_thread_set_cpumask} 584 585Set the cpumask of the thread to the specified value. The thread may be migrated 586to one of the specified CPUs. 587 588### Parameters 589 590Name | Optional | Type | Description 591----------------------- | -------- | ----------- | ----------- 592id | Required | string | Thread ID 593cpumask | Required | string | Cpumask for this thread 594 595### Response 596 597Completion status of the operation is returned as a boolean. 598 599### Example 600 601Example request: 602 603~~~ 604{ 605 "jsonrpc": "2.0", 606 "method": "thread_set_cpumask", 607 "id": 1, 608 "params": { 609 "id": "1", 610 "cpumask": "1" 611 } 612} 613~~~ 614 615Example response: 616 617~~~ 618{ 619 "jsonrpc": "2.0", 620 "id": 1, 621 "result": true 622} 623~~~ 624 625## thread_get_pollers {#rpc_thread_get_pollers} 626 627Retrieve current pollers of all the threads. 628 629### Parameters 630 631This method has no parameters. 632 633### Response 634 635The response is an array of objects containing pollers of all the threads. 636 637### Example 638 639Example request: 640~~~ 641{ 642 "jsonrpc": "2.0", 643 "method": "thread_get_pollers", 644 "id": 1 645} 646~~~ 647 648Example response: 649~~~ 650{ 651 "jsonrpc": "2.0", 652 "id": 1, 653 "result": { 654 "tick_rate": 2500000000, 655 "threads": [ 656 { 657 "name": "app_thread", 658 "id": 1, 659 "active_pollers": [], 660 "timed_pollers": [ 661 { 662 "name": "spdk_rpc_subsystem_poll", 663 "state": "waiting", 664 "run_count": 12345, 665 "busy_count": 10000, 666 "period_ticks": 10000000 667 } 668 ], 669 "paused_pollers": [] 670 } 671 ] 672 } 673} 674~~~ 675 676## thread_get_io_channels {#rpc_thread_get_io_channels} 677 678Retrieve current IO channels of all the threads. 679 680### Parameters 681 682This method has no parameters. 683 684### Response 685 686The response is an array of objects containing IO channels of all the threads. 687 688### Example 689 690Example request: 691~~~ 692{ 693 "jsonrpc": "2.0", 694 "method": "thread_get_io_channels", 695 "id": 1 696} 697~~~ 698 699Example response: 700~~~ 701{ 702 "jsonrpc": "2.0", 703 "id": 1, 704 "result": { 705 "tick_rate": 2500000000, 706 "threads": [ 707 { 708 "name": "app_thread", 709 "io_channels": [ 710 { 711 "name": "nvmf_tgt", 712 "ref": 1 713 } 714 ] 715 } 716 ] 717 } 718} 719~~~ 720# Block Device Abstraction Layer {#jsonrpc_components_bdev} 721 722## bdev_set_options {#rpc_bdev_set_options} 723 724Set global parameters for the block device (bdev) subsystem. This RPC may only be called 725before SPDK subsystems have been initialized. 726 727### Parameters 728 729Name | Optional | Type | Description 730----------------------- | -------- | ----------- | ----------- 731bdev_io_pool_size | Optional | number | Number of spdk_bdev_io structures in shared buffer pool 732bdev_io_cache_size | Optional | number | Maximum number of spdk_bdev_io structures cached per thread 733 734### Example 735 736Example request: 737 738~~~ 739{ 740 "jsonrpc": "2.0", 741 "id": 1, 742 "method": "bdev_set_options", 743 "params": { 744 "bdev_io_pool_size": 65536, 745 "bdev_io_cache_size": 256 746 } 747} 748~~~ 749 750Example response: 751 752~~~ 753{ 754 "jsonrpc": "2.0", 755 "id": 1, 756 "result": true 757} 758~~~ 759 760## bdev_get_bdevs {#rpc_bdev_get_bdevs} 761 762Get information about block devices (bdevs). 763 764### Parameters 765 766The user may specify no parameters in order to list all block devices, or a block device may be 767specified by name. 768 769Name | Optional | Type | Description 770----------------------- | -------- | ----------- | ----------- 771name | Optional | string | Block device name 772 773### Response 774 775The response is an array of objects containing information about the requested block devices. 776 777### Example 778 779Example request: 780 781~~~ 782{ 783 "jsonrpc": "2.0", 784 "id": 1, 785 "method": "bdev_get_bdevs", 786 "params": { 787 "name": "Malloc0" 788 } 789} 790~~~ 791 792Example response: 793 794~~~ 795{ 796 "jsonrpc": "2.0", 797 "id": 1, 798 "result": [ 799 { 800 "name": "Malloc0", 801 "product_name": "Malloc disk", 802 "block_size": 512, 803 "num_blocks": 20480, 804 "claimed": false, 805 "zoned": false, 806 "supported_io_types": { 807 "read": true, 808 "write": true, 809 "unmap": true, 810 "write_zeroes": true, 811 "flush": true, 812 "reset": true, 813 "nvme_admin": false, 814 "nvme_io": false 815 }, 816 "driver_specific": {} 817 } 818 ] 819} 820~~~ 821 822## bdev_get_iostat {#rpc_bdev_get_iostat} 823 824Get I/O statistics of block devices (bdevs). 825 826### Parameters 827 828The user may specify no parameters in order to list all block devices, or a block device may be 829specified by name. 830 831Name | Optional | Type | Description 832----------------------- | -------- | ----------- | ----------- 833name | Optional | string | Block device name 834 835### Response 836 837The response is an array of objects containing I/O statistics of the requested block devices. 838 839### Example 840 841Example request: 842 843~~~ 844{ 845 "jsonrpc": "2.0", 846 "id": 1, 847 "method": "bdev_get_iostat", 848 "params": { 849 "name": "Nvme0n1" 850 } 851} 852~~~ 853 854Example response: 855 856~~~ 857{ 858 "jsonrpc": "2.0", 859 "id": 1, 860 "result": { 861 "tick_rate": 2200000000, 862 "bdevs" : [ 863 { 864 "name": "Nvme0n1", 865 "bytes_read": 36864, 866 "num_read_ops": 2, 867 "bytes_written": 0, 868 "num_write_ops": 0, 869 "bytes_unmapped": 0, 870 "num_unmap_ops": 0, 871 "read_latency_ticks": 178904, 872 "write_latency_ticks": 0, 873 "unmap_latency_ticks": 0, 874 "queue_depth_polling_period": 2, 875 "queue_depth": 0, 876 "io_time": 0, 877 "weighted_io_time": 0 878 } 879 ] 880 } 881} 882~~~ 883 884## bdev_enable_histogram {#rpc_bdev_enable_histogram} 885 886Control whether collecting data for histogram is enabled for specified bdev. 887 888### Parameters 889 890Name | Optional | Type | Description 891----------------------- | -------- | ----------- | ----------- 892name | Required | string | Block device name 893enable | Required | boolean | Enable or disable histogram on specified device 894 895### Example 896 897Example request: 898 899~~~ 900{ 901 "jsonrpc": "2.0", 902 "id": 1, 903 "method": "bdev_enable_histogram", 904 "params": { 905 "name": "Nvme0n1" 906 "enable": true 907 } 908} 909~~~ 910 911Example response: 912 913~~~ 914{ 915 "jsonrpc": "2.0", 916 "id": 1, 917 "result": true 918} 919~~~ 920 921## bdev_get_histogram {#rpc_bdev_get_histogram} 922 923Get latency histogram for specified bdev. 924 925### Parameters 926 927Name | Optional | Type | Description 928----------------------- | -------- | ----------- | ----------- 929name | Required | string | Block device name 930 931### Result 932 933Name | Description 934------------------------| ----------- 935histogram | Base64 encoded histogram 936bucket_shift | Granularity of the histogram buckets 937tsc_rate | Ticks per second 938 939### Example 940 941Example request: 942 943~~~ 944{ 945 "jsonrpc": "2.0", 946 "id": 1, 947 "method": "bdev_get_histogram", 948 "params": { 949 "name": "Nvme0n1" 950 } 951} 952~~~ 953 954Example response: 955Note that histogram field is trimmed, actual encoded histogram length is ~80kb. 956 957~~~ 958{ 959 "jsonrpc": "2.0", 960 "id": 1, 961 "result": { 962 "histogram": "AAAAAAAAAAAAAA...AAAAAAAAA==", 963 "tsc_rate": 2300000000, 964 "bucket_shift": 7 965 } 966} 967~~~ 968 969## bdev_set_qos_limit {#rpc_bdev_set_qos_limit} 970 971Set the quality of service rate limit on a bdev. 972 973### Parameters 974 975Name | Optional | Type | Description 976----------------------- | -------- | ----------- | ----------- 977name | Required | string | Block device name 978rw_ios_per_sec | Optional | number | Number of R/W I/Os per second to allow. 0 means unlimited. 979rw_mbytes_per_sec | Optional | number | Number of R/W megabytes per second to allow. 0 means unlimited. 980r_mbytes_per_sec | Optional | number | Number of Read megabytes per second to allow. 0 means unlimited. 981w_mbytes_per_sec | Optional | number | Number of Write megabytes per second to allow. 0 means unlimited. 982 983### Example 984 985Example request: 986 987~~~ 988{ 989 "jsonrpc": "2.0", 990 "id": 1, 991 "method": "bdev_set_qos_limit", 992 "params": { 993 "name": "Malloc0" 994 "rw_ios_per_sec": 20000 995 "rw_mbytes_per_sec": 100 996 "r_mbytes_per_sec": 50 997 "w_mbytes_per_sec": 50 998 } 999} 1000~~~ 1001 1002Example response: 1003 1004~~~ 1005{ 1006 "jsonrpc": "2.0", 1007 "id": 1, 1008 "result": true 1009} 1010~~~ 1011 1012## bdev_ocf_create {#rpc_bdev_ocf_create} 1013 1014Construct new OCF bdev. 1015Command accepts cache mode that is going to be used. 1016Currently, we support Write-Through, Pass-Through and Write-Back OCF cache modes. 1017 1018### Parameters 1019 1020Name | Optional | Type | Description 1021----------------------- | -------- | ----------- | ----------- 1022name | Required | string | Bdev name to use 1023mode | Required | string | OCF cache mode ('wb' or 'wt' or 'pt') 1024cache_bdev_name | Required | string | Name of underlying cache bdev 1025core_bdev_name | Required | string | Name of underlying core bdev 1026 1027### Result 1028 1029Name of newly created bdev. 1030 1031### Example 1032 1033Example request: 1034 1035~~~ 1036{ 1037 "params": { 1038 "name": "ocf0", 1039 "mode": "wt", 1040 "cache_bdev_name": "Nvme0n1" 1041 "core_bdev_name": "aio0" 1042 }, 1043 "jsonrpc": "2.0", 1044 "method": "bdev_ocf_create", 1045 "id": 1 1046} 1047~~~ 1048 1049Example response: 1050 1051~~~ 1052{ 1053 "jsonrpc": "2.0", 1054 "id": 1, 1055 "result": "ocf0" 1056} 1057~~~ 1058 1059## bdev_ocf_delete {#rpc_bdev_ocf_delete} 1060 1061Delete the OCF bdev 1062 1063### Parameters 1064 1065Name | Optional | Type | Description 1066----------------------- | -------- | ----------- | ----------- 1067name | Required | string | Bdev name 1068 1069### Example 1070 1071Example request: 1072 1073~~~ 1074{ 1075 "params": { 1076 "name": "ocf0" 1077 }, 1078 "jsonrpc": "2.0", 1079 "method": "bdev_ocf_delete", 1080 "id": 1 1081} 1082~~~ 1083 1084Example response: 1085 1086~~~ 1087{ 1088 "jsonrpc": "2.0", 1089 "id": 1, 1090 "result": true 1091} 1092~~~ 1093 1094## bdev_ocf_get_stats {#rpc_bdev_ocf_get_stats} 1095 1096Get statistics of chosen OCF block device. 1097 1098### Parameters 1099 1100Name | Optional | Type | Description 1101----------------------- | -------- | ----------- | ----------- 1102name | Required | string | Block device name 1103 1104### Response 1105 1106Statistics as json object. 1107 1108### Example 1109 1110Example request: 1111 1112~~~ 1113{ 1114 "jsonrpc": "2.0", 1115 "method": "bdev_ocf_get_stats", 1116 "id": 1 1117} 1118~~~ 1119 1120Example response: 1121 1122~~~ 1123{ 1124 "jsonrpc": "2.0", 1125 "id": 1, 1126 "result": [ 1127 "usage": { 1128 "clean": { 1129 "count": 76033, 1130 "units": "4KiB blocks", 1131 "percentage": "100.0" 1132 }, 1133 "free": { 1134 "count": 767, 1135 "units": "4KiB blocks", 1136 "percentage": "0.9" 1137 }, 1138 "occupancy": { 1139 "count": 76033, 1140 "units": "4KiB blocks", 1141 "percentage": "99.0" 1142 }, 1143 "dirty": { 1144 "count": 0, 1145 "units": "4KiB blocks", 1146 "percentage": "0.0" 1147 } 1148 }, 1149 "requests": { 1150 "rd_total": { 1151 "count": 2, 1152 "units": "Requests", 1153 "percentage": "0.0" 1154 }, 1155 "wr_full_misses": { 1156 "count": 76280, 1157 "units": "Requests", 1158 "percentage": "35.6" 1159 }, 1160 "rd_full_misses": { 1161 "count": 1, 1162 "units": "Requests", 1163 "percentage": "0.0" 1164 }, 1165 "rd_partial_misses": { 1166 "count": 0, 1167 "units": "Requests", 1168 "percentage": "0.0" 1169 }, 1170 "wr_total": { 1171 "count": 212416, 1172 "units": "Requests", 1173 "percentage": "99.2" 1174 }, 1175 "wr_pt": { 1176 "count": 1535, 1177 "units": "Requests", 1178 "percentage": "0.7" 1179 }, 1180 "wr_partial_misses": { 1181 "count": 0, 1182 "units": "Requests", 1183 "percentage": "0.0" 1184 }, 1185 "serviced": { 1186 "count": 212418, 1187 "units": "Requests", 1188 "percentage": "99.2" 1189 }, 1190 "rd_pt": { 1191 "count": 0, 1192 "units": "Requests", 1193 "percentage": "0.0" 1194 }, 1195 "total": { 1196 "count": 213953, 1197 "units": "Requests", 1198 "percentage": "100.0" 1199 }, 1200 "rd_hits": { 1201 "count": 1, 1202 "units": "Requests", 1203 "percentage": "0.0" 1204 }, 1205 "wr_hits": { 1206 "count": 136136, 1207 "units": "Requests", 1208 "percentage": "63.6" 1209 } 1210 }, 1211 "errors": { 1212 "total": { 1213 "count": 0, 1214 "units": "Requests", 1215 "percentage": "0.0" 1216 }, 1217 "cache_obj_total": { 1218 "count": 0, 1219 "units": "Requests", 1220 "percentage": "0.0" 1221 }, 1222 "core_obj_total": { 1223 "count": 0, 1224 "units": "Requests", 1225 "percentage": "0.0" 1226 }, 1227 "cache_obj_rd": { 1228 "count": 0, 1229 "units": "Requests", 1230 "percentage": "0.0" 1231 }, 1232 "core_obj_wr": { 1233 "count": 0, 1234 "units": "Requests", 1235 "percentage": "0.0" 1236 }, 1237 "core_obj_rd": { 1238 "count": 0, 1239 "units": "Requests", 1240 "percentage": "0.0" 1241 }, 1242 "cache_obj_wr": { 1243 "count": 0, 1244 "units": "Requests", 1245 "percentage": "0.0" 1246 } 1247 }, 1248 "blocks": { 1249 "volume_rd": { 1250 "count": 9, 1251 "units": "4KiB blocks", 1252 "percentage": "0.0" 1253 }, 1254 "volume_wr": { 1255 "count": 213951, 1256 "units": "4KiB blocks", 1257 "percentage": "99.9" 1258 }, 1259 "cache_obj_total": { 1260 "count": 212425, 1261 "units": "4KiB blocks", 1262 "percentage": "100.0" 1263 }, 1264 "core_obj_total": { 1265 "count": 213959, 1266 "units": "4KiB blocks", 1267 "percentage": "100.0" 1268 }, 1269 "cache_obj_rd": { 1270 "count": 1, 1271 "units": "4KiB blocks", 1272 "percentage": "0.0" 1273 }, 1274 "core_obj_wr": { 1275 "count": 213951, 1276 "units": "4KiB blocks", 1277 "percentage": "99.9" 1278 }, 1279 "volume_total": { 1280 "count": 213960, 1281 "units": "4KiB blocks", 1282 "percentage": "100.0" 1283 }, 1284 "core_obj_rd": { 1285 "count": 8, 1286 "units": "4KiB blocks", 1287 "percentage": "0.0" 1288 }, 1289 "cache_obj_wr": { 1290 "count": 212424, 1291 "units": "4KiB blocks", 1292 "percentage": "99.9" 1293 } 1294 ] 1295} 1296~~~ 1297 1298## bdev_ocf_get_bdevs {#rpc_bdev_ocf_get_bdevs} 1299 1300Get list of OCF devices including unregistered ones. 1301 1302### Parameters 1303 1304Name | Optional | Type | Description 1305----------------------- | -------- | ----------- | ----------- 1306name | Optional | string | Name of OCF vbdev or name of cache device or name of core device 1307 1308### Response 1309 1310Array of OCF devices with their current status, along with core and cache bdevs. 1311 1312### Example 1313 1314Example request: 1315 1316~~~ 1317{ 1318 "jsonrpc": "2.0", 1319 "method": "bdev_ocf_get_bdevs", 1320 "id": 1 1321} 1322~~~ 1323 1324Example response: 1325 1326~~~ 1327{ 1328 "jsonrpc": "2.0", 1329 "id": 1, 1330 "result": [ 1331 { 1332 "name": "PartCache", 1333 "started": false, 1334 "cache": { 1335 "name": "Malloc0", 1336 "attached": true 1337 }, 1338 "core": { 1339 "name": "Malloc1", 1340 "attached": false 1341 } 1342 } 1343 ] 1344} 1345~~~ 1346 1347## bdev_malloc_create {#rpc_bdev_malloc_create} 1348 1349Construct @ref bdev_config_malloc 1350 1351### Parameters 1352 1353Name | Optional | Type | Description 1354----------------------- | -------- | ----------- | ----------- 1355name | Optional | string | Bdev name to use 1356block_size | Required | number | Block size in bytes -must be multiple of 512 1357num_blocks | Required | number | Number of blocks 1358uuid | Optional | string | UUID of new bdev 1359 1360### Result 1361 1362Name of newly created bdev. 1363 1364### Example 1365 1366Example request: 1367 1368~~~ 1369{ 1370 "params": { 1371 "block_size": 4096, 1372 "num_blocks": 16384, 1373 "name": "Malloc0", 1374 "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90" 1375 }, 1376 "jsonrpc": "2.0", 1377 "method": "bdev_malloc_create", 1378 "id": 1 1379} 1380~~~ 1381 1382Example response: 1383 1384~~~ 1385{ 1386 "jsonrpc": "2.0", 1387 "id": 1, 1388 "result": "Malloc0" 1389} 1390~~~ 1391 1392## bdev_malloc_delete {#rpc_bdev_malloc_delete} 1393 1394Delete @ref bdev_config_malloc 1395 1396### Parameters 1397 1398Name | Optional | Type | Description 1399----------------------- | -------- | ----------- | ----------- 1400name | Required | string | Bdev name 1401 1402### Example 1403 1404Example request: 1405 1406~~~ 1407{ 1408 "params": { 1409 "name": "Malloc0" 1410 }, 1411 "jsonrpc": "2.0", 1412 "method": "bdev_malloc_delete", 1413 "id": 1 1414} 1415~~~ 1416 1417Example response: 1418 1419~~~ 1420{ 1421 "jsonrpc": "2.0", 1422 "id": 1, 1423 "result": true 1424} 1425~~~ 1426 1427## bdev_null_create {#rpc_bdev_null_create} 1428 1429Construct @ref bdev_config_null 1430 1431### Parameters 1432 1433Name | Optional | Type | Description 1434----------------------- | -------- | ----------- | ----------- 1435name | Optional | string | Bdev name to use 1436block_size | Required | number | Block size in bytes 1437num_blocks | Required | number | Number of blocks 1438uuid | Optional | string | UUID of new bdev 1439md_size | Optional | number | Metadata size in bytes 1440dif_type | Optional | number | Protection information type (0, 1, 2 or 3). Default: 0 - no protection. 1441dif_is_head_of_md | Optional | boolean | Protection information is in the first 8 bytes of MD. Default: in the last 8 bytes. 1442 1443### Result 1444 1445Name of newly created bdev. 1446 1447### Example 1448 1449Example request: 1450 1451~~~ 1452{ 1453 "params": { 1454 "block_size": 4104, 1455 "num_blocks": 16384, 1456 "name": "Null0", 1457 "uuid": "2b6601ba-eada-44fb-9a83-a20eb9eb9e90", 1458 "md_size": 8, 1459 "dif_type": 1, 1460 "dif_is_head_of_md": true 1461 }, 1462 "jsonrpc": "2.0", 1463 "method": "bdev_null_create", 1464 "id": 1 1465} 1466~~~ 1467 1468Example response: 1469 1470~~~ 1471{ 1472 "jsonrpc": "2.0", 1473 "id": 1, 1474 "result": "Null0" 1475} 1476~~~ 1477 1478## bdev_null_delete {#rpc_bdev_null_delete} 1479 1480Delete @ref bdev_config_null. 1481 1482### Parameters 1483 1484Name | Optional | Type | Description 1485----------------------- | -------- | ----------- | ----------- 1486name | Required | string | Bdev name 1487 1488### Example 1489 1490Example request: 1491 1492~~~ 1493{ 1494 "params": { 1495 "name": "Null0" 1496 }, 1497 "jsonrpc": "2.0", 1498 "method": "bdev_null_delete", 1499 "id": 1 1500} 1501~~~ 1502 1503Example response: 1504 1505~~~ 1506{ 1507 "jsonrpc": "2.0", 1508 "id": 1, 1509 "result": true 1510} 1511~~~ 1512 1513## bdev_aio_create {#rpc_bdev_aio_create} 1514 1515Construct @ref bdev_config_aio. 1516 1517### Parameters 1518 1519Name | Optional | Type | Description 1520----------------------- | -------- | ----------- | ----------- 1521name | Required | string | Bdev name to use 1522filename | Required | number | Path to device or file 1523block_size | Optional | number | Block size in bytes 1524 1525### Result 1526 1527Name of newly created bdev. 1528 1529### Example 1530 1531Example request: 1532 1533~~~ 1534{ 1535 "params": { 1536 "block_size": 4096, 1537 "name": "Aio0", 1538 "filename": "/tmp/aio_bdev_file" 1539 }, 1540 "jsonrpc": "2.0", 1541 "method": "bdev_aio_create", 1542 "id": 1 1543} 1544~~~ 1545 1546Example response: 1547 1548~~~ 1549{ 1550 "jsonrpc": "2.0", 1551 "id": 1, 1552 "result": "Aio0" 1553} 1554~~~ 1555 1556## bdev_aio_delete {#rpc_bdev_aio_delete} 1557 1558Delete @ref bdev_config_aio. 1559 1560### Parameters 1561 1562Name | Optional | Type | Description 1563----------------------- | -------- | ----------- | ----------- 1564name | Required | string | Bdev name 1565 1566### Example 1567 1568Example request: 1569 1570~~~ 1571{ 1572 "params": { 1573 "name": "Aio0" 1574 }, 1575 "jsonrpc": "2.0", 1576 "method": "bdev_aio_delete", 1577 "id": 1 1578} 1579~~~ 1580 1581Example response: 1582 1583~~~ 1584{ 1585 "jsonrpc": "2.0", 1586 "id": 1, 1587 "result": true 1588} 1589~~~ 1590 1591## bdev_nvme_set_options {#rpc_bdev_nvme_set_options} 1592 1593Set global parameters for all bdev NVMe. This RPC may only be called before SPDK subsystems have been initialized or any bdev NVMe has been created. 1594 1595### Parameters 1596 1597Name | Optional | Type | Description 1598-------------------------- | -------- | ----------- | ----------- 1599action_on_timeout | Optional | string | Action to take on command time out: none, reset or abort 1600timeout_us | Optional | number | Timeout for each command, in microseconds. If 0, don't track timeouts 1601retry_count | Optional | number | The number of attempts per I/O before an I/O fails 1602arbitration_burst | Optional | number | The value is expressed as a power of two, a value of 111b indicates no limit 1603low_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a low priority queue 1604medium_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a medium priority queue 1605high_priority_weight | Optional | number | The maximum number of commands that the controller may launch at one time from a high priority queue 1606nvme_adminq_poll_period_us | Optional | number | How often the admin queue is polled for asynchronous events in microseconds 1607nvme_ioq_poll_period_us | Optional | number | How often I/O queues are polled for completions, in microseconds. Default: 0 (as fast as possible). 1608io_queue_requests | Optional | number | The number of requests allocated for each NVMe I/O queue. Default: 512. 1609delay_cmd_submit | Optional | boolean | Enable delaying NVMe command submission to allow batching of multiple commands. Default: `true`. 1610 1611### Example 1612 1613Example request: 1614 1615~~~ 1616request: 1617{ 1618 "params": { 1619 "retry_count": 5, 1620 "arbitration_burst": 3, 1621 "low_priority_weight": 8, 1622 "medium_priority_weight":8, 1623 "high_priority_weight": 8, 1624 "nvme_adminq_poll_period_us": 2000, 1625 "timeout_us": 10000000, 1626 "action_on_timeout": "reset", 1627 "io_queue_requests" : 2048, 1628 "delay_cmd_submit": true 1629 }, 1630 "jsonrpc": "2.0", 1631 "method": "bdev_nvme_set_options", 1632 "id": 1 1633} 1634~~~ 1635 1636Example response: 1637 1638~~~ 1639{ 1640 "jsonrpc": "2.0", 1641 "id": 1, 1642 "result": true 1643} 1644~~~ 1645 1646## bdev_nvme_set_hotplug {#rpc_bdev_nvme_set_hotplug} 1647 1648Change settings of the NVMe hotplug feature. If enabled, PCIe NVMe bdevs will be automatically discovered on insertion 1649and deleted on removal. 1650 1651### Parameters 1652 1653Name | Optional | Type | Description 1654----------------------- | -------- | ----------- | ----------- 1655enabled | Required | string | True to enable, false to disable 1656period_us | Optional | number | How often to poll for hot-insert and hot-remove events. Values: 0 - reset/use default or 1 to 10000000. 1657 1658### Example 1659 1660Example request: 1661 1662~~~ 1663request: 1664{ 1665 "params": { 1666 "enabled": true, 1667 "period_us": 2000 1668 }, 1669 "jsonrpc": "2.0", 1670 "method": "bdev_nvme_set_hotplug", 1671 "id": 1 1672} 1673~~~ 1674 1675Example response: 1676 1677~~~ 1678{ 1679 "jsonrpc": "2.0", 1680 "id": 1, 1681 "result": true 1682} 1683~~~ 1684 1685## bdev_nvme_attach_controller {#rpc_bdev_nvme_attach_controller} 1686 1687Construct @ref bdev_config_nvme 1688 1689### Result 1690 1691Array of names of newly created bdevs. 1692 1693### Parameters 1694 1695Name | Optional | Type | Description 1696----------------------- | -------- | ----------- | ----------- 1697name | Required | string | Name of the NVMe controller, prefix for each bdev name 1698trtype | Required | string | NVMe-oF target trtype: rdma or pcie 1699traddr | Required | string | NVMe-oF target address: ip or BDF 1700adrfam | Optional | string | NVMe-oF target adrfam: ipv4, ipv6, ib, fc, intra_host 1701trsvcid | Optional | string | NVMe-oF target trsvcid: port number 1702subnqn | Optional | string | NVMe-oF target subnqn 1703hostnqn | Optional | string | NVMe-oF target hostnqn 1704hostaddr | Optional | string | NVMe-oF host address: ip address 1705hostsvcid | Optional | string | NVMe-oF host trsvcid: port number 1706prchk_reftag | Optional | bool | Enable checking of PI reference tag for I/O processing 1707prchk_guard | Optional | bool | Enable checking of PI guard for I/O processing 1708 1709### Example 1710 1711Example request: 1712 1713~~~ 1714{ 1715 "params": { 1716 "trtype": "pcie", 1717 "name": "Nvme0", 1718 "traddr": "0000:0a:00.0" 1719 }, 1720 "jsonrpc": "2.0", 1721 "method": "bdev_nvme_attach_controller", 1722 "id": 1 1723} 1724~~~ 1725 1726Example response: 1727 1728~~~ 1729{ 1730 "jsonrpc": "2.0", 1731 "id": 1, 1732 "result": [ 1733 "Nvme0n1" 1734 ] 1735} 1736~~~ 1737 1738## bdev_nvme_get_controllers {#rpc_bdev_nvme_get_controllers} 1739 1740Get information about NVMe controllers. 1741 1742### Parameters 1743 1744The user may specify no parameters in order to list all NVMe controllers, or one NVMe controller may be 1745specified by name. 1746 1747Name | Optional | Type | Description 1748----------------------- | -------- | ----------- | ----------- 1749name | Optional | string | NVMe controller name 1750 1751### Response 1752 1753The response is an array of objects containing information about the requested NVMe controllers. 1754 1755### Example 1756 1757Example request: 1758 1759~~~ 1760{ 1761 "jsonrpc": "2.0", 1762 "id": 1, 1763 "method": "bdev_nvme_get_controllers", 1764 "params": { 1765 "name": "Nvme0" 1766 } 1767} 1768~~~ 1769 1770Example response: 1771 1772~~~ 1773{ 1774 "jsonrpc": "2.0", 1775 "id": 1, 1776 "result": [ 1777 { 1778 "name": "Nvme0", 1779 "trid": { 1780 "trtype": "PCIe", 1781 "traddr": "0000:05:00.0" 1782 } 1783 } 1784 ] 1785} 1786~~~ 1787 1788## bdev_nvme_detach_controller {#rpc_bdev_nvme_detach_controller} 1789 1790Detach NVMe controller and delete any associated bdevs. 1791 1792### Parameters 1793 1794Name | Optional | Type | Description 1795----------------------- | -------- | ----------- | ----------- 1796name | Required | string | Controller name 1797 1798### Example 1799 1800Example requests: 1801 1802~~~ 1803{ 1804 "params": { 1805 "name": "Nvme0" 1806 }, 1807 "jsonrpc": "2.0", 1808 "method": "bdev_nvme_detach_controller", 1809 "id": 1 1810} 1811~~~ 1812 1813Example response: 1814 1815~~~ 1816{ 1817 "jsonrpc": "2.0", 1818 "id": 1, 1819 "result": true 1820} 1821~~~ 1822 1823## bdev_nvme_cuse_register {#rpc_bdev_nvme_cuse_register} 1824 1825Register CUSE device on NVMe controller. 1826This feature is considered as experimental. 1827 1828### Parameters 1829 1830Name | Optional | Type | Description 1831----------------------- | -------- | ----------- | ----------- 1832name | Required | string | Name of the NVMe controller 1833dev_path | Required | string | Path to the CUSE controller device, e.g. spdk/nvme0 1834 1835### Example 1836 1837Example request: 1838 1839~~~ 1840{ 1841 "params": { 1842 "dev_path": "spdk/nvme0", 1843 "name": "Nvme0" 1844 }, 1845 "jsonrpc": "2.0", 1846 "method": "bdev_nvme_cuse_register", 1847 "id": 1 1848} 1849~~~ 1850 1851Example response: 1852 1853~~~ 1854{ 1855 "jsonrpc": "2.0", 1856 "id": 1, 1857 "result": true 1858} 1859~~~ 1860 1861## bdev_nvme_cuse_unregister {#rpc_bdev_nvme_cuse_unregister} 1862 1863Unregister CUSE device on NVMe controller. 1864This feature is considered as experimental. 1865 1866### Parameters 1867 1868Name | Optional | Type | Description 1869----------------------- | -------- | ----------- | ----------- 1870name | Required | string | Name of the NVMe controller 1871 1872### Example 1873 1874Example request: 1875 1876~~~ 1877{ 1878 "params": { 1879 "name": "Nvme0" 1880 }, 1881 "jsonrpc": "2.0", 1882 "method": "bdev_nvme_cuse_unregister", 1883 "id": 1 1884} 1885~~~ 1886 1887Example response: 1888 1889~~~ 1890{ 1891 "jsonrpc": "2.0", 1892 "id": 1, 1893 "result": true 1894} 1895~~~ 1896 1897## bdev_rbd_create {#rpc_bdev_rbd_create} 1898 1899Create @ref bdev_config_rbd bdev 1900 1901This method is available only if SPDK was build with Ceph RBD support. 1902 1903### Parameters 1904 1905Name | Optional | Type | Description 1906----------------------- | -------- | ----------- | ----------- 1907name | Optional | string | Bdev name 1908user_id | Optional | string | Ceph ID (i.e. admin, not client.admin) 1909pool_name | Required | string | Pool name 1910rbd_name | Required | string | Image name 1911block_size | Required | number | Block size 1912config | Optional | string map | Explicit librados configuration 1913 1914If no config is specified, Ceph configuration files must exist with 1915all relevant settings for accessing the pool. If a config map is 1916passed, the configuration files are ignored and instead all key/value 1917pairs are passed to rados_conf_set to configure cluster access. In 1918practice, "mon_host" (= list of monitor address+port) and "key" (= the 1919secret key stored in Ceph keyrings) are enough. 1920 1921When accessing the image as some user other than "admin" (the 1922default), the "user_id" has to be set. 1923 1924### Result 1925 1926Name of newly created bdev. 1927 1928### Example 1929 1930Example request with `key` from `/etc/ceph/ceph.client.admin.keyring`: 1931 1932~~~ 1933{ 1934 "params": { 1935 "pool_name": "rbd", 1936 "rbd_name": "foo", 1937 "config": { 1938 "mon_host": "192.168.7.1:6789,192.168.7.2:6789", 1939 "key": "AQDwf8db7zR1GRAA5k7NKXjS5S5V4mntwUDnGQ==", 1940 } 1941 "block_size": 4096 1942 }, 1943 "jsonrpc": "2.0", 1944 "method": "bdev_rbd_create", 1945 "id": 1 1946} 1947~~~ 1948 1949Example response: 1950 1951~~~ 1952response: 1953{ 1954 "jsonrpc": "2.0", 1955 "id": 1, 1956 "result": "Ceph0" 1957} 1958~~~ 1959 1960## bdev_rbd_delete {#rpc_bdev_rbd_delete} 1961 1962Delete @ref bdev_config_rbd bdev 1963 1964This method is available only if SPDK was build with Ceph RBD support. 1965 1966### Result 1967 1968`true` if bdev with provided name was deleted or `false` otherwise. 1969 1970### Parameters 1971 1972Name | Optional | Type | Description 1973----------------------- | -------- | ----------- | ----------- 1974name | Required | string | Bdev name 1975 1976### Example 1977 1978Example request: 1979 1980~~~ 1981{ 1982 "params": { 1983 "name": "Rbd0" 1984 }, 1985 "jsonrpc": "2.0", 1986 "method": "bdev_rbd_delete", 1987 "id": 1 1988} 1989~~~ 1990 1991Example response: 1992 1993~~~ 1994{ 1995 "jsonrpc": "2.0", 1996 "id": 1, 1997 "result": true 1998} 1999~~~ 2000 2001## bdev_delay_create {#rpc_bdev_delay_create} 2002 2003Create delay bdev. This bdev type redirects all IO to it's base bdev and inserts a delay on the completion 2004path to create an artificial drive latency. All latency values supplied to this bdev should be in microseconds. 2005 2006### Parameters 2007 2008Name | Optional | Type | Description 2009----------------------- | -------- | ----------- | ----------- 2010name | Required | string | Bdev name 2011base_bdev_name | Required | string | Base bdev name 2012avg_read_latency | Required | number | average read latency (us) 2013p99_read_latency | Required | number | p99 read latency (us) 2014avg_write_latency | Required | number | average write latency (us) 2015p99_write_latency | Required | number | p99 write latency (us) 2016 2017### Result 2018 2019Name of newly created bdev. 2020 2021### Example 2022 2023Example request: 2024 2025~~~ 2026{ 2027 "params": { 2028 "base_bdev_name": "Null0", 2029 "name": "Delay0", 2030 "avg_read_latency": "15", 2031 "p99_read_latency": "50", 2032 "avg_write_latency": "40", 2033 "p99_write_latency": "110", 2034 }, 2035 "jsonrpc": "2.0", 2036 "method": "bdev_delay_create", 2037 "id": 1 2038} 2039~~~ 2040 2041Example response: 2042 2043~~~ 2044{ 2045 "jsonrpc": "2.0", 2046 "id": 1, 2047 "result": "Delay0" 2048} 2049~~~ 2050 2051## bdev_delay_delete {#rpc_bdev_delay_delete} 2052 2053Delete delay bdev. 2054 2055### Parameters 2056 2057Name | Optional | Type | Description 2058----------------------- | -------- | ----------- | ----------- 2059name | Required | string | Bdev name 2060 2061### Example 2062 2063Example request: 2064 2065~~~ 2066{ 2067 "params": { 2068 "name": "Delay0" 2069 }, 2070 "jsonrpc": "2.0", 2071 "method": "bdev_delay_delete", 2072 "id": 1 2073} 2074 2075~~~ 2076 2077Example response: 2078 2079~~~ 2080{ 2081 "jsonrpc": "2.0", 2082 "id": 1, 2083 "result": true 2084} 2085~~~ 2086 2087## bdev_delay_update_latency {#rpc_bdev_delay_update_latency} 2088 2089Update a target latency value associated with a given delay bdev. Any currently 2090outstanding I/O will be completed with the old latency. 2091 2092### Parameters 2093 2094Name | Optional | Type | Description 2095----------------------- | -------- | ----------- | ----------- 2096delay_bdev_name | Required | string | Name of the delay bdev 2097latency_type | Required | string | One of: avg_read, avg_write, p99_read, p99_write 2098latency_us | Required | number | The new latency value in microseconds 2099 2100### Result 2101 2102Name of newly created bdev. 2103 2104### Example 2105 2106Example request: 2107 2108~~~ 2109{ 2110 "params": { 2111 "delay_bdev_name": "Delay0", 2112 "latency_type": "avg_read", 2113 "latency_us": "100", 2114 }, 2115 "jsonrpc": "2.0", 2116 "method": "bdev_delay_update_latency", 2117 "id": 1 2118} 2119~~~ 2120 2121Example response: 2122 2123~~~ 2124{ 2125 "result": "true" 2126} 2127~~~ 2128 2129## bdev_error_create {#rpc_bdev_error_create} 2130 2131Construct error bdev. 2132 2133### Parameters 2134 2135Name | Optional | Type | Description 2136----------------------- | -------- | ----------- | ----------- 2137base_name | Required | string | Base bdev name 2138 2139### Example 2140 2141Example request: 2142 2143~~~ 2144{ 2145 "params": { 2146 "base_name": "Malloc0" 2147 }, 2148 "jsonrpc": "2.0", 2149 "method": "bdev_error_create", 2150 "id": 1 2151} 2152~~~ 2153 2154Example response: 2155 2156~~~ 2157{ 2158 "jsonrpc": "2.0", 2159 "id": 1, 2160 "result": true 2161} 2162~~~ 2163 2164## bdev_error_delete {#rpc_bdev_error_delete} 2165 2166Delete error bdev 2167 2168### Result 2169 2170`true` if bdev with provided name was deleted or `false` otherwise. 2171 2172### Parameters 2173 2174Name | Optional | Type | Description 2175----------------------- | -------- | ----------- | ----------- 2176name | Required | string | Error bdev name 2177 2178### Example 2179 2180Example request: 2181 2182~~~ 2183{ 2184 "params": { 2185 "name": "EE_Malloc0" 2186 }, 2187 "jsonrpc": "2.0", 2188 "method": "bdev_error_delete", 2189 "id": 1 2190} 2191~~~ 2192 2193Example response: 2194 2195~~~ 2196{ 2197 "jsonrpc": "2.0", 2198 "id": 1, 2199 "result": true 2200} 2201~~~ 2202 2203## bdev_iscsi_create {#rpc_bdev_iscsi_create} 2204 2205Connect to iSCSI target and create bdev backed by this connection. 2206 2207This method is available only if SPDK was build with iSCSI initiator support. 2208 2209### Parameters 2210 2211Name | Optional | Type | Description 2212----------------------- | -------- | ----------- | ----------- 2213name | Required | string | Bdev name 2214initiator_iqn | Required | string | IQN name used during connection 2215url | Required | string | iSCSI resource URI 2216 2217### Result 2218 2219Name of newly created bdev. 2220 2221### Example 2222 2223Example request: 2224 2225~~~ 2226{ 2227 "params": { 2228 "url": "iscsi://127.0.0.1/iqn.2016-06.io.spdk:disk1/0", 2229 "initiator_iqn": "iqn.2016-06.io.spdk:init", 2230 "name": "iSCSI0" 2231 }, 2232 "jsonrpc": "2.0", 2233 "method": "bdev_iscsi_create", 2234 "id": 1 2235} 2236~~~ 2237 2238Example response: 2239 2240~~~ 2241{ 2242 "jsonrpc": "2.0", 2243 "id": 1, 2244 "result": "iSCSI0" 2245} 2246~~~ 2247 2248## bdev_iscsi_delete {#rpc_bdev_iscsi_delete} 2249 2250Delete iSCSI bdev and terminate connection to target. 2251 2252This method is available only if SPDK was built with iSCSI initiator support. 2253 2254### Parameters 2255 2256Name | Optional | Type | Description 2257----------------------- | -------- | ----------- | ----------- 2258name | Required | string | Bdev name 2259 2260### Example 2261 2262Example request: 2263 2264~~~ 2265{ 2266 "params": { 2267 "name": "iSCSI0" 2268 }, 2269 "jsonrpc": "2.0", 2270 "method": "bdev_iscsi_delete", 2271 "id": 1 2272} 2273~~~ 2274 2275Example response: 2276 2277~~~ 2278{ 2279 "jsonrpc": "2.0", 2280 "id": 1, 2281 "result": true 2282} 2283~~~ 2284 2285## bdev_ftl_create {#rpc_bdev_ftl_create} 2286 2287Create FTL bdev. 2288 2289This RPC is subject to change. 2290 2291### Parameters 2292 2293Name | Optional | Type | Description 2294----------------------- | -------- | ----------- | ----------- 2295name | Required | string | Bdev name 2296trtype | Required | string | Transport type 2297traddr | Required | string | NVMe target address 2298punits | Required | string | Parallel unit range in the form of start-end e.g 4-8 2299uuid | Optional | string | UUID of restored bdev (not applicable when creating new instance) 2300cache | Optional | string | Name of the bdev to be used as a write buffer cache 2301 2302### Result 2303 2304Name of newly created bdev. 2305 2306### Example 2307 2308Example request: 2309 2310~~~ 2311{ 2312 "params": { 2313 "name": "nvme0" 2314 "trtype" "pcie" 2315 "traddr": "0000:00:04.0" 2316 "punits": "0-3" 2317 "uuid": "4a7481ce-786f-41a0-9b86-8f7465c8f4d3" 2318 }, 2319 "jsonrpc": "2.0", 2320 "method": "bdev_ftl_create", 2321 "id": 1 2322} 2323~~~ 2324 2325Example response: 2326 2327~~~ 2328{ 2329 "jsonrpc": "2.0", 2330 "id": 1, 2331 "result": { 2332 "name" : "nvme0" 2333 "uuid" : "4a7481ce-786f-41a0-9b86-8f7465c8f4d3" 2334 } 2335} 2336~~~ 2337 2338## bdev_ftl_delete {#rpc_bdev_ftl_delete} 2339 2340Delete FTL bdev. 2341 2342This RPC is subject to change. 2343 2344### Parameters 2345 2346Name | Optional | Type | Description 2347----------------------- | -------- | ----------- | ----------- 2348name | Required | string | Bdev name 2349 2350### Example 2351 2352Example request: 2353 2354~~~ 2355{ 2356 "params": { 2357 "name": "nvme0" 2358 }, 2359 "jsonrpc": "2.0", 2360 "method": "bdev_ftl_delete", 2361 "id": 1 2362} 2363~~~ 2364 2365Example response: 2366 2367~~~ 2368{ 2369 "jsonrpc": "2.0", 2370 "id": 1, 2371 "result": true 2372} 2373~~~ 2374 2375## bdev_pmem_create_pool {#rpc_bdev_pmem_create_pool} 2376 2377Create a @ref bdev_config_pmem blk pool file. It is equivalent of following `pmempool create` command: 2378 2379~~~ 2380pmempool create -s $((num_blocks * block_size)) blk $block_size $pmem_file 2381~~~ 2382 2383This method is available only if SPDK was built with PMDK support. 2384 2385### Parameters 2386 2387Name | Optional | Type | Description 2388----------------------- | -------- | ----------- | ----------- 2389pmem_file | Required | string | Path to new pmem file 2390num_blocks | Required | number | Number of blocks 2391block_size | Required | number | Size of each block in bytes 2392 2393### Example 2394 2395Example request: 2396 2397~~~ 2398{ 2399 "params": { 2400 "block_size": 512, 2401 "num_blocks": 131072, 2402 "pmem_file": "/tmp/pmem_file" 2403 }, 2404 "jsonrpc": "2.0", 2405 "method": "bdev_pmem_create_pool", 2406 "id": 1 2407} 2408~~~ 2409 2410Example response: 2411 2412~~~ 2413{ 2414 "jsonrpc": "2.0", 2415 "id": 1, 2416 "result": true 2417} 2418~~~ 2419 2420## bdev_pmem_get_pool_info {#rpc_bdev_pmem_get_pool_info} 2421 2422Retrieve basic information about PMDK memory pool. 2423 2424This method is available only if SPDK was built with PMDK support. 2425 2426### Parameters 2427 2428Name | Optional | Type | Description 2429----------------------- | -------- | ----------- | ----------- 2430pmem_file | Required | string | Path to existing pmem file 2431 2432### Result 2433 2434Array of objects describing memory pool: 2435 2436Name | Type | Description 2437----------------------- | ----------- | ----------- 2438num_blocks | number | Number of blocks 2439block_size | number | Size of each block in bytes 2440 2441### Example 2442 2443Example request: 2444 2445~~~ 2446request: 2447{ 2448 "params": { 2449 "pmem_file": "/tmp/pmem_file" 2450 }, 2451 "jsonrpc": "2.0", 2452 "method": "bdev_pmem_get_pool_info", 2453 "id": 1 2454} 2455~~~ 2456 2457Example response: 2458 2459~~~ 2460{ 2461 "jsonrpc": "2.0", 2462 "id": 1, 2463 "result": [ 2464 { 2465 "block_size": 512, 2466 "num_blocks": 129728 2467 } 2468 ] 2469} 2470~~~ 2471 2472## bdev_pmem_delete_pool {#rpc_bdev_pmem_delete_pool} 2473 2474Delete pmem pool by removing file `pmem_file`. This method will fail if `pmem_file` is not a 2475valid pmem pool file. 2476 2477This method is available only if SPDK was built with PMDK support. 2478 2479### Parameters 2480 2481Name | Optional | Type | Description 2482----------------------- | -------- | ----------- | ----------- 2483pmem_file | Required | string | Path to new pmem file 2484 2485### Example 2486 2487Example request: 2488 2489~~~ 2490{ 2491 "params": { 2492 "pmem_file": "/tmp/pmem_file" 2493 }, 2494 "jsonrpc": "2.0", 2495 "method": "bdev_pmem_delete_pool", 2496 "id": 1 2497} 2498~~~ 2499 2500Example response: 2501 2502~~~ 2503{ 2504 "jsonrpc": "2.0", 2505 "id": 1, 2506 "result": true 2507} 2508~~~ 2509 2510## bdev_pmem_create {#rpc_bdev_pmem_create} 2511 2512Construct @ref bdev_config_pmem bdev. 2513 2514This method is available only if SPDK was built with PMDK support. 2515 2516### Parameters 2517 2518Name | Optional | Type | Description 2519----------------------- | -------- | ----------- | ----------- 2520name | Required | string | Bdev name 2521pmem_file | Required | string | Path to existing pmem blk pool file 2522 2523### Result 2524 2525Name of newly created bdev. 2526 2527### Example 2528 2529Example request: 2530 2531~~~ 2532{ 2533 "params": { 2534 "pmem_file": "/tmp/pmem_file", 2535 "name": "Pmem0" 2536 }, 2537 "jsonrpc": "2.0", 2538 "method": "bdev_pmem_create", 2539 "id": 1 2540} 2541~~~ 2542 2543Example response: 2544 2545~~~ 2546{ 2547 "jsonrpc": "2.0", 2548 "id": 1, 2549 "result": "Pmem0" 2550} 2551~~~ 2552 2553## bdev_pmem_delete {#rpc_bdev_pmem_delete} 2554 2555Delete @ref bdev_config_pmem bdev. This call will not remove backing pool files. 2556 2557This method is available only if SPDK was built with PMDK support. 2558 2559### Result 2560 2561`true` if bdev with provided name was deleted or `false` otherwise. 2562 2563### Parameters 2564 2565Name | Optional | Type | Description 2566----------------------- | -------- | ----------- | ----------- 2567name | Required | string | Bdev name 2568 2569### Example 2570 2571Example request: 2572 2573~~~ 2574{ 2575 "params": { 2576 "name": "Pmem0" 2577 }, 2578 "jsonrpc": "2.0", 2579 "method": "bdev_pmem_delete", 2580 "id": 1 2581} 2582~~~ 2583 2584Example response: 2585 2586~~~ 2587{ 2588 "jsonrpc": "2.0", 2589 "id": 1, 2590 "result": true 2591} 2592~~~ 2593 2594## bdev_passthru_create {#rpc_bdev_passthru_create} 2595 2596Create passthru bdev. This bdev type redirects all IO to it's base bdev. It has no other purpose than being an example 2597and a starting point in development of new bdev type. 2598 2599### Parameters 2600 2601Name | Optional | Type | Description 2602----------------------- | -------- | ----------- | ----------- 2603name | Required | string | Bdev name 2604base_bdev_name | Required | string | Base bdev name 2605 2606### Result 2607 2608Name of newly created bdev. 2609 2610### Example 2611 2612Example request: 2613 2614~~~ 2615{ 2616 "params": { 2617 "base_bdev_name": "Malloc0", 2618 "name": "Passsthru0" 2619 }, 2620 "jsonrpc": "2.0", 2621 "method": "bdev_passthru_create", 2622 "id": 1 2623} 2624~~~ 2625 2626Example response: 2627 2628~~~ 2629{ 2630 "jsonrpc": "2.0", 2631 "id": 1, 2632 "result": "Passsthru0" 2633} 2634~~~ 2635 2636## bdev_passthru_delete {#rpc_bdev_passthru_delete} 2637 2638Delete passthru bdev. 2639 2640### Parameters 2641 2642Name | Optional | Type | Description 2643----------------------- | -------- | ----------- | ----------- 2644name | Required | string | Bdev name 2645 2646### Example 2647 2648Example request: 2649 2650~~~ 2651{ 2652 "params": { 2653 "name": "Passsthru0" 2654 }, 2655 "jsonrpc": "2.0", 2656 "method": "bdev_passthru_delete", 2657 "id": 1 2658} 2659 2660~~~ 2661 2662Example response: 2663 2664~~~ 2665{ 2666 "jsonrpc": "2.0", 2667 "id": 1, 2668 "result": true 2669} 2670~~~ 2671 2672## bdev_virtio_attach_controller {#rpc_bdev_virtio_attach_controller} 2673 2674Create new initiator @ref bdev_config_virtio_scsi or @ref bdev_config_virtio_blk and expose all found bdevs. 2675 2676### Parameters 2677 2678Name | Optional | Type | Description 2679----------------------- | -------- | ----------- | ----------- 2680name | Required | string | Virtio SCSI base bdev name or Virtio Blk bdev name 2681trtype | Required | string | Virtio target trtype: pci or user 2682traddr | Required | string | target address: BDF or UNIX socket file path 2683dev_type | Required | string | Virtio device type: blk or scsi 2684vq_count | Optional | number | Number of queues this controller will utilize (default: 1) 2685vq_size | Optional | number | Size of each queue. Must be power of 2. (default: 512) 2686 2687In case of Virtio SCSI the `name` parameter will be base name for new created bdevs. For Virtio Blk `name` will be the 2688name of created bdev. 2689 2690`vq_count` and `vq_size` parameters are valid only if `trtype` is `user`. 2691 2692### Result 2693 2694Array of names of newly created bdevs. 2695 2696### Example 2697 2698Example request: 2699 2700~~~ 2701{ 2702 "params": { 2703 "name": "VirtioScsi0", 2704 "trtype": "user", 2705 "vq_size": 128, 2706 "dev_type": "scsi", 2707 "traddr": "/tmp/VhostScsi0", 2708 "vq_count": 4 2709 }, 2710 "jsonrpc": "2.0", 2711 "method": "bdev_virtio_attach_controller", 2712 "id": 1 2713} 2714~~~ 2715 2716Example response: 2717 2718~~~ 2719{ 2720 "jsonrpc": "2.0", 2721 "id": 1, 2722 "result": ["VirtioScsi0t2", "VirtioScsi0t4"] 2723} 2724~~~ 2725 2726## bdev_virtio_scsi_get_devices {#rpc_bdev_virtio_scsi_get_devices} 2727 2728Show information about all available Virtio SCSI devices. 2729 2730### Parameters 2731 2732This method has no parameters. 2733 2734### Result 2735 2736Array of Virtio SCSI information objects. 2737 2738### Example 2739 2740Example request: 2741 2742~~~ 2743{ 2744 "jsonrpc": "2.0", 2745 "method": "bdev_virtio_scsi_get_devices", 2746 "id": 1 2747} 2748~~~ 2749 2750Example response: 2751 2752~~~ 2753{ 2754 "jsonrpc": "2.0", 2755 "id": 1, 2756 "result": [ 2757 { 2758 "name": "VirtioScsi0", 2759 "virtio": { 2760 "vq_size": 128, 2761 "vq_count": 4, 2762 "type": "user", 2763 "socket": "/tmp/VhostScsi0" 2764 } 2765 } 2766 ] 2767} 2768~~~ 2769 2770## bdev_virtio_detach_controller {#rpc_bdev_virtio_detach_controller} 2771 2772Remove a Virtio device. This command can be used to remove any type of virtio device. 2773 2774### Parameters 2775 2776Name | Optional | Type | Description 2777----------------------- | -------- | ----------- | ----------- 2778name | Required | string | Virtio name 2779 2780### Example 2781 2782Example request: 2783 2784~~~ 2785{ 2786 "params": { 2787 "name": "VirtioUser0" 2788 }, 2789 "jsonrpc": "2.0", 2790 "method": "bdev_virtio_detach_controller", 2791 "id": 1 2792} 2793 2794~~~ 2795 2796Example response: 2797 2798~~~ 2799{ 2800 "jsonrpc": "2.0", 2801 "id": 1, 2802 "result": true 2803} 2804~~~ 2805 2806# iSCSI Target {#jsonrpc_components_iscsi_tgt} 2807 2808## iscsi_set_options method {#rpc_iscsi_set_options} 2809 2810Set global parameters for iSCSI targets. 2811 2812This RPC may only be called before SPDK subsystems have been initialized. This RPC can be called only once. 2813 2814### Parameters 2815 2816Name | Optional | Type | Description 2817--------------------------- | -------- | ------- | ----------- 2818auth_file | Optional | string | Path to CHAP shared secret file (default: "") 2819node_base | Optional | string | Prefix of the name of iSCSI target node (default: "iqn.2016-06.io.spdk") 2820nop_timeout | Optional | number | Timeout in seconds to nop-in request to the initiator (default: 60) 2821nop_in_interval | Optional | number | Time interval in secs between nop-in requests by the target (default: 30) 2822disable_chap | Optional | boolean | CHAP for discovery session should be disabled (default: `false`) 2823require_chap | Optional | boolean | CHAP for discovery session should be required (default: `false`) 2824mutual_chap | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`) 2825chap_group | Optional | number | CHAP group ID for discovery session (default: 0) 2826max_sessions | Optional | number | Maximum number of sessions in the host (default: 128) 2827max_queue_depth | Optional | number | Maximum number of outstanding I/Os per queue (default: 64) 2828max_connections_per_session | Optional | number | Session specific parameter, MaxConnections (default: 2) 2829default_time2wait | Optional | number | Session specific parameter, DefaultTime2Wait (default: 2) 2830default_time2retain | Optional | number | Session specific parameter, DefaultTime2Retain (default: 20) 2831first_burst_length | Optional | number | Session specific parameter, FirstBurstLength (default: 8192) 2832immediate_data | Optional | boolean | Session specific parameter, ImmediateData (default: `true`) 2833error_recovery_level | Optional | number | Session specific parameter, ErrorRecoveryLevel (default: 0) 2834allow_duplicated_isid | Optional | boolean | Allow duplicated initiator session ID (default: `false`) 2835 2836To load CHAP shared secret file, its path is required to specify explicitly in the parameter `auth_file`. 2837 2838Parameters `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. 2839 2840### Example 2841 2842Example request: 2843 2844~~~ 2845{ 2846 "params": { 2847 "allow_duplicated_isid": true, 2848 "default_time2retain": 60, 2849 "first_burst_length": 8192, 2850 "immediate_data": true, 2851 "node_base": "iqn.2016-06.io.spdk", 2852 "max_sessions": 128, 2853 "nop_timeout": 30, 2854 "nop_in_interval": 30, 2855 "auth_file": "/usr/local/etc/spdk/auth.conf", 2856 "disable_chap": true, 2857 "default_time2wait": 2 2858 }, 2859 "jsonrpc": "2.0", 2860 "method": "iscsi_set_options", 2861 "id": 1 2862} 2863~~~ 2864 2865Example response: 2866 2867~~~ 2868{ 2869 "jsonrpc": "2.0", 2870 "id": 1, 2871 "result": true 2872} 2873~~~ 2874 2875## iscsi_get_options method {#rpc_iscsi_get_options} 2876 2877Show global parameters of iSCSI targets. 2878 2879### Parameters 2880 2881This method has no parameters. 2882 2883### Example 2884 2885Example request: 2886 2887~~~ 2888request: 2889{ 2890 "jsonrpc": "2.0", 2891 "method": "iscsi_get_options", 2892 "id": 1 2893} 2894~~~ 2895 2896Example response: 2897 2898~~~ 2899{ 2900 "jsonrpc": "2.0", 2901 "id": 1, 2902 "result": { 2903 "allow_duplicated_isid": true, 2904 "default_time2retain": 60, 2905 "first_burst_length": 8192, 2906 "immediate_data": true, 2907 "node_base": "iqn.2016-06.io.spdk", 2908 "mutual_chap": false, 2909 "nop_in_interval": 30, 2910 "chap_group": 0, 2911 "max_connections_per_session": 2, 2912 "max_queue_depth": 64, 2913 "nop_timeout": 30, 2914 "max_sessions": 128, 2915 "error_recovery_level": 0, 2916 "auth_file": "/usr/local/etc/spdk/auth.conf", 2917 "disable_chap": true, 2918 "default_time2wait": 2, 2919 "require_chap": false 2920 } 2921} 2922~~~ 2923## iscsi_set_discovery_auth method {#rpc_iscsi_set_discovery_auth} 2924 2925Set CHAP authentication for sessions dynamically. 2926 2927### Parameters 2928 2929Name | Optional | Type | Description 2930--------------------------- | -------- | --------| ----------- 2931disable_chap | Optional | boolean | CHAP for discovery session should be disabled (default: `false`) 2932require_chap | Optional | boolean | CHAP for discovery session should be required (default: `false`) 2933mutual_chap | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`) 2934chap_group | Optional | number | CHAP group ID for discovery session (default: 0) 2935 2936Parameters `disable_chap` and `require_chap` are mutually exclusive. 2937 2938### Example 2939 2940Example request: 2941 2942~~~ 2943request: 2944{ 2945 "params": { 2946 "chap_group": 1, 2947 "require_chap": true, 2948 "mutual_chap": true 2949 }, 2950 "jsonrpc": "2.0", 2951 "method": "iscsi_set_discovery_auth", 2952 "id": 1 2953} 2954~~~ 2955 2956Example response: 2957 2958~~~ 2959{ 2960 "jsonrpc": "2.0", 2961 "id": 1, 2962 "result": true 2963} 2964~~~ 2965 2966## iscsi_create_auth_group method {#rpc_iscsi_create_auth_group} 2967 2968Create an authentication group for CHAP authentication. 2969 2970### Parameters 2971 2972Name | Optional | Type | Description 2973--------------------------- | -------- | --------| ----------- 2974tag | Required | number | Authentication group tag (unique, integer > 0) 2975secrets | Optional | array | Array of @ref rpc_iscsi_create_auth_group_secret objects 2976 2977### secret {#rpc_iscsi_create_auth_group_secret} 2978 2979Name | Optional | Type | Description 2980--------------------------- | ---------| --------| ----------- 2981user | Required | string | Unidirectional CHAP name 2982secret | Required | string | Unidirectional CHAP secret 2983muser | Optional | string | Bidirectional CHAP name 2984msecret | Optional | string | Bidirectional CHAP secret 2985 2986### Example 2987 2988Example request: 2989 2990~~~ 2991{ 2992 "params": { 2993 "secrets": [ 2994 { 2995 "muser": "mu1", 2996 "secret": "s1", 2997 "user": "u1", 2998 "msecret": "ms1" 2999 } 3000 ], 3001 "tag": 2 3002 }, 3003 "jsonrpc": "2.0", 3004 "method": "iscsi_create_auth_group", 3005 "id": 1 3006} 3007~~~ 3008 3009Example response: 3010 3011~~~ 3012{ 3013 "jsonrpc": "2.0", 3014 "id": 1, 3015 "result": true 3016} 3017~~~ 3018 3019## iscsi_delete_auth_group method {#rpc_iscsi_delete_auth_group} 3020 3021Delete an existing authentication group for CHAP authentication. 3022 3023### Parameters 3024 3025Name | Optional | Type | Description 3026--------------------------- | -------- | --------| ----------- 3027tag | Required | number | Authentication group tag (unique, integer > 0) 3028 3029### Example 3030 3031Example request: 3032 3033~~~ 3034{ 3035 "params": { 3036 "tag": 2 3037 }, 3038 "jsonrpc": "2.0", 3039 "method": "iscsi_delete_auth_group", 3040 "id": 1 3041} 3042~~~ 3043 3044Example response: 3045 3046~~~ 3047{ 3048 "jsonrpc": "2.0", 3049 "id": 1, 3050 "result": true 3051} 3052~~~ 3053 3054## iscsi_get_auth_groups {#rpc_iscsi_get_auth_groups} 3055 3056Show information about all existing authentication group for CHAP authentication. 3057 3058### Parameters 3059 3060This method has no parameters. 3061 3062### Result 3063 3064Array of objects describing authentication group. 3065 3066Name | Type | Description 3067--------------------------- | --------| ----------- 3068tag | number | Authentication group tag 3069secrets | array | Array of @ref rpc_iscsi_create_auth_group_secret objects 3070 3071### Example 3072 3073Example request: 3074 3075~~~ 3076{ 3077 "jsonrpc": "2.0", 3078 "method": "iscsi_get_auth_groups", 3079 "id": 1 3080} 3081~~~ 3082Example response: 3083 3084~~~ 3085{ 3086 "jsonrpc": "2.0", 3087 "id": 1, 3088 "result": [ 3089 { 3090 "secrets": [ 3091 { 3092 "muser": "mu1", 3093 "secret": "s1", 3094 "user": "u1", 3095 "msecret": "ms1" 3096 } 3097 ], 3098 "tag": 1 3099 }, 3100 { 3101 "secrets": [ 3102 { 3103 "secret": "s2", 3104 "user": "u2" 3105 } 3106 ], 3107 "tag": 2 3108 } 3109 ] 3110} 3111~~~ 3112 3113## iscsi_auth_group_add_secret {#rpc_iscsi_auth_group_add_secret} 3114 3115Add a secret to an existing authentication group for CHAP authentication. 3116 3117### Parameters 3118 3119Name | Optional | Type | Description 3120--------------------------- | -------- | --------| ----------- 3121tag | Required | number | Authentication group tag (unique, integer > 0) 3122user | Required | string | Unidirectional CHAP name 3123secret | Required | string | Unidirectional CHAP secret 3124muser | Optional | string | Bidirectional CHAP name 3125msecret | Optional | string | Bidirectional CHAP secret 3126 3127### Example 3128 3129Example request: 3130 3131~~~ 3132{ 3133 "params": { 3134 "muser": "mu3", 3135 "secret": "s3", 3136 "tag": 2, 3137 "user": "u3", 3138 "msecret": "ms3" 3139 }, 3140 "jsonrpc": "2.0", 3141 "method": "iscsi_auth_group_add_secret", 3142 "id": 1 3143} 3144~~~ 3145 3146Example response: 3147 3148~~~ 3149{ 3150 "jsonrpc": "2.0", 3151 "id": 1, 3152 "result": true 3153} 3154~~~ 3155 3156## iscsi_auth_group_remove_secret {#rpc_iscsi_auth_group_remove_secret} 3157 3158Remove a secret from an existing authentication group for CHAP authentication. 3159 3160### Parameters 3161 3162Name | Optional | Type | Description 3163--------------------------- | -------- | --------| ----------- 3164tag | Required | number | Authentication group tag (unique, integer > 0) 3165user | Required | string | Unidirectional CHAP name 3166 3167### Example 3168 3169Example request: 3170 3171~~~ 3172{ 3173 "params": { 3174 "tag": 2, 3175 "user": "u3" 3176 }, 3177 "jsonrpc": "2.0", 3178 "method": "iscsi_auth_group_remove_secret", 3179 "id": 1 3180} 3181~~~ 3182 3183Example response: 3184 3185~~~ 3186{ 3187 "jsonrpc": "2.0", 3188 "id": 1, 3189 "result": true 3190} 3191~~~ 3192 3193## iscsi_get_initiator_groups method {#rpc_iscsi_get_initiator_groups} 3194 3195Show information about all available initiator groups. 3196 3197### Parameters 3198 3199This method has no parameters. 3200 3201### Result 3202 3203Array of objects describing initiator groups. 3204 3205Name | Type | Description 3206--------------------------- | --------| ----------- 3207tag | number | Initiator group tag 3208initiators | array | Array of initiator hostnames or IP addresses 3209netmasks | array | Array of initiator netmasks 3210 3211### Example 3212 3213Example request: 3214 3215~~~ 3216{ 3217 "jsonrpc": "2.0", 3218 "method": "iscsi_get_initiator_groups", 3219 "id": 1 3220} 3221~~~ 3222 3223Example response: 3224 3225~~~ 3226{ 3227 "jsonrpc": "2.0", 3228 "id": 1, 3229 "result": [ 3230 { 3231 "initiators": [ 3232 "iqn.2016-06.io.spdk:host1", 3233 "iqn.2016-06.io.spdk:host2" 3234 ], 3235 "tag": 1, 3236 "netmasks": [ 3237 "192.168.1.0/24" 3238 ] 3239 } 3240 ] 3241} 3242~~~ 3243 3244## iscsi_create_initiator_group method {#rpc_iscsi_create_initiator_group} 3245 3246Add an initiator group. 3247 3248### Parameters 3249 3250Name | Optional | Type | Description 3251--------------------------- | -------- | --------| ----------- 3252tag | Required | number | Initiator group tag (unique, integer > 0) 3253initiators | Required | array | Not empty array of initiator hostnames or IP addresses 3254netmasks | Required | array | Not empty array of initiator netmasks 3255 3256### Example 3257 3258Example request: 3259 3260~~~ 3261{ 3262 "params": { 3263 "initiators": [ 3264 "iqn.2016-06.io.spdk:host1", 3265 "iqn.2016-06.io.spdk:host2" 3266 ], 3267 "tag": 1, 3268 "netmasks": [ 3269 "192.168.1.0/24" 3270 ] 3271 }, 3272 "jsonrpc": "2.0", 3273 "method": "iscsi_create_initiator_group", 3274 "id": 1 3275} 3276~~~ 3277 3278Example response: 3279 3280~~~ 3281response: 3282{ 3283 "jsonrpc": "2.0", 3284 "id": 1, 3285 "result": true 3286} 3287~~~ 3288 3289## iscsi_delete_initiator_group method {#rpc_iscsi_delete_initiator_group} 3290 3291Delete an existing initiator group. 3292 3293### Parameters 3294 3295Name | Optional | Type | Description 3296--------------------------- | -------- | --------| ----------- 3297tag | Required | number | Initiator group tag (unique, integer > 0) 3298 3299### Example 3300 3301Example request: 3302 3303~~~ 3304{ 3305 "params": { 3306 "tag": 1 3307 }, 3308 "jsonrpc": "2.0", 3309 "method": "iscsi_delete_initiator_group", 3310 "id": 1 3311} 3312~~~ 3313 3314Example response: 3315 3316~~~ 3317{ 3318 "jsonrpc": "2.0", 3319 "id": 1, 3320 "result": true 3321} 3322~~~ 3323 3324## iscsi_initiator_group_add_initiators method {#rpc_iscsi_initiator_group_add_initiators} 3325 3326Add initiators to an existing initiator group. 3327 3328### Parameters 3329 3330Name | Optional | Type | Description 3331--------------------------- | -------- | --------| ----------- 3332tag | Required | number | Existing initiator group tag. 3333initiators | Optional | array | Array of initiator hostnames or IP addresses 3334netmasks | Optional | array | Array of initiator netmasks 3335 3336### Example 3337 3338Example request: 3339 3340~~~ 3341request: 3342{ 3343 "params": { 3344 "initiators": [ 3345 "iqn.2016-06.io.spdk:host3" 3346 ], 3347 "tag": 1, 3348 "netmasks": [ 3349 "255.255.255.1" 3350 ] 3351 }, 3352 "jsonrpc": "2.0", 3353 "method": "iscsi_initiator_group_add_initiators", 3354 "id": 1 3355} 3356~~~ 3357 3358Example response: 3359 3360~~~ 3361response: 3362{ 3363 "jsonrpc": "2.0", 3364 "id": 1, 3365 "result": true 3366} 3367~~~ 3368 3369## iscsi_get_target_nodes method {#rpc_iscsi_get_target_nodes} 3370 3371Show information about all available iSCSI target nodes. 3372 3373### Parameters 3374 3375This method has no parameters. 3376 3377### Result 3378 3379Array of objects describing target node. 3380 3381Name | Type | Description 3382--------------------------- | --------| ----------- 3383name | string | Target node name (ASCII) 3384alias_name | string | Target node alias name (ASCII) 3385pg_ig_maps | array | Array of Portal_Group_Tag:Initiator_Group_Tag mappings 3386luns | array | Array of Bdev names to LUN ID mappings 3387queue_depth | number | Target queue depth 3388disable_chap | boolean | CHAP authentication should be disabled for this target 3389require_chap | boolean | CHAP authentication should be required for this target 3390mutual_chap | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`) 3391chap_group | number | Authentication group ID for this target node 3392header_digest | boolean | Header Digest should be required for this target node 3393data_digest | boolean | Data Digest should be required for this target node 3394 3395### Example 3396 3397Example request: 3398 3399~~~ 3400{ 3401 "jsonrpc": "2.0", 3402 "method": "iscsi_get_target_nodes", 3403 "id": 1 3404} 3405~~~ 3406 3407Example response: 3408 3409~~~ 3410{ 3411 "jsonrpc": "2.0", 3412 "id": 1, 3413 "result": [ 3414 { 3415 "luns": [ 3416 { 3417 "lun_id": 0, 3418 "bdev_name": "Nvme0n1" 3419 } 3420 ], 3421 "mutual_chap": false, 3422 "name": "iqn.2016-06.io.spdk:target1", 3423 "alias_name": "iscsi-target1-alias", 3424 "require_chap": false, 3425 "chap_group": 0, 3426 "pg_ig_maps": [ 3427 { 3428 "ig_tag": 1, 3429 "pg_tag": 1 3430 } 3431 ], 3432 "data_digest": false, 3433 "disable_chap": false, 3434 "header_digest": false, 3435 "queue_depth": 64 3436 } 3437 ] 3438} 3439~~~ 3440 3441## iscsi_create_target_node method {#rpc_iscsi_create_target_node} 3442 3443Add an iSCSI target node. 3444 3445### Parameters 3446 3447Name | Optional | Type | Description 3448--------------------------- | -------- | --------| ----------- 3449name | Required | string | Target node name (ASCII) 3450alias_name | Required | string | Target node alias name (ASCII) 3451pg_ig_maps | Required | array | Array of (Portal_Group_Tag:Initiator_Group_Tag) mappings 3452luns | Required | array | Array of Bdev names to LUN ID mappings 3453queue_depth | Required | number | Target queue depth 3454disable_chap | Optional | boolean | CHAP authentication should be disabled for this target 3455require_chap | Optional | boolean | CHAP authentication should be required for this target 3456mutual_chap | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`) 3457chap_group | Optional | number | Authentication group ID for this target node 3458header_digest | Optional | boolean | Header Digest should be required for this target node 3459data_digest | Optional | boolean | Data Digest should be required for this target node 3460 3461Parameters `disable_chap` and `require_chap` are mutually exclusive. 3462 3463### Example 3464 3465Example request: 3466 3467~~~ 3468{ 3469 "params": { 3470 "luns": [ 3471 { 3472 "lun_id": 0, 3473 "bdev_name": "Nvme0n1" 3474 } 3475 ], 3476 "mutual_chap": true, 3477 "name": "target2", 3478 "alias_name": "iscsi-target2-alias", 3479 "pg_ig_maps": [ 3480 { 3481 "ig_tag": 1, 3482 "pg_tag": 1 3483 }, 3484 { 3485 "ig_tag": 2, 3486 "pg_tag": 2 3487 } 3488 ], 3489 "data_digest": true, 3490 "disable_chap": true, 3491 "header_digest": true, 3492 "queue_depth": 24 3493 }, 3494 "jsonrpc": "2.0", 3495 "method": "iscsi_create_target_node", 3496 "id": 1 3497} 3498~~~ 3499 3500Example response: 3501 3502~~~ 3503{ 3504 "jsonrpc": "2.0", 3505 "id": 1, 3506 "result": true 3507} 3508~~~ 3509 3510## iscsi_target_node_set_auth method {#rpc_iscsi_target_node_set_auth} 3511 3512Set CHAP authentication to an existing iSCSI target node. 3513 3514### Parameters 3515 3516Name | Optional | Type | Description 3517--------------------------- | -------- | --------| ----------- 3518name | Required | string | Target node name (ASCII) 3519disable_chap | Optional | boolean | CHAP authentication should be disabled for this target 3520require_chap | Optional | boolean | CHAP authentication should be required for this target 3521mutual_chap | Optional | boolean | CHAP authentication should be bidirectional (`true`) or unidirectional (`false`) 3522chap_group | Optional | number | Authentication group ID for this target node 3523 3524Parameters `disable_chap` and `require_chap` are mutually exclusive. 3525 3526### Example 3527 3528Example request: 3529 3530~~~ 3531{ 3532 "params": { 3533 "chap_group": 1, 3534 "require_chap": true, 3535 "name": "iqn.2016-06.io.spdk:target1", 3536 "mutual_chap": true 3537 }, 3538 "jsonrpc": "2.0", 3539 "method": "iscsi_target_node_set_auth", 3540 "id": 1 3541} 3542~~~ 3543 3544Example response: 3545 3546~~~ 3547{ 3548 "jsonrpc": "2.0", 3549 "id": 1, 3550 "result": true 3551} 3552~~~ 3553 3554## iscsi_target_node_add_pg_ig_maps method {#rpc_iscsi_target_node_add_pg_ig_maps} 3555 3556Add initiator group to portal group mappings to an existing iSCSI target node. 3557 3558### Parameters 3559 3560Name | Optional | Type | Description 3561--------------------------- | -------- | --------| ----------- 3562name | Required | string | Target node name (ASCII) 3563pg_ig_maps | Required | array | Not empty array of initiator to portal group mappings objects 3564 3565Portal to Initiator group mappings object: 3566 3567Name | Optional | Type | Description 3568--------------------------- | -------- | --------| ----------- 3569ig_tag | Required | number | Existing initiator group tag 3570pg_tag | Required | number | Existing portal group tag 3571 3572### Example 3573 3574Example request: 3575 3576~~~ 3577{ 3578 "params": { 3579 "pg_ig_maps": [ 3580 { 3581 "ig_tag": 1, 3582 "pg_tag": 1 3583 }, 3584 { 3585 "ig_tag": 2, 3586 "pg_tag": 2 3587 }, 3588 { 3589 "ig_tag": 3, 3590 "pg_tag": 3 3591 } 3592 ], 3593 "name": "iqn.2016-06.io.spdk:target3" 3594 }, 3595 "jsonrpc": "2.0", 3596 "method": "iscsi_target_node_add_pg_ig_maps", 3597 "id": 1 3598} 3599~~~ 3600 3601Example response: 3602 3603~~~ 3604{ 3605 "jsonrpc": "2.0", 3606 "id": 1, 3607 "result": true 3608} 3609~~~ 3610 3611## iscsi_target_node_remove_pg_ig_maps method {#rpc_iscsi_target_node_remove_pg_ig_maps} 3612 3613Delete initiator group to portal group mappings from an existing iSCSI target node. 3614 3615### Parameters 3616 3617Name | Optional | Type | Description 3618--------------------------- | -------- | --------| ----------- 3619name | Required | string | Target node name (ASCII) 3620pg_ig_maps | Required | array | Not empty array of Portal to Initiator group mappings objects 3621 3622Portal to Initiator group mappings object: 3623 3624Name | Optional | Type | Description 3625--------------------------- | -------- | --------| ----------- 3626ig_tag | Required | number | Existing initiator group tag 3627pg_tag | Required | number | Existing portal group tag 3628 3629### Example 3630 3631Example request: 3632 3633~~~ 3634{ 3635 "params": { 3636 "pg_ig_maps": [ 3637 { 3638 "ig_tag": 1, 3639 "pg_tag": 1 3640 }, 3641 { 3642 "ig_tag": 2, 3643 "pg_tag": 2 3644 }, 3645 { 3646 "ig_tag": 3, 3647 "pg_tag": 3 3648 } 3649 ], 3650 "name": "iqn.2016-06.io.spdk:target3" 3651 }, 3652 "jsonrpc": "2.0", 3653 "method": "iscsi_target_node_remove_pg_ig_maps", 3654 "id": 1 3655} 3656~~~ 3657 3658Example response: 3659 3660~~~ 3661{ 3662 "jsonrpc": "2.0", 3663 "id": 1, 3664 "result": true 3665} 3666~~~ 3667 3668## iscsi_delete_target_node method {#rpc_iscsi_delete_target_node} 3669 3670Delete an iSCSI target node. 3671 3672### Parameters 3673 3674Name | Optional | Type | Description 3675--------------------------- | -------- | --------| ----------- 3676name | Required | string | Target node name (ASCII) 3677 3678### Example 3679 3680Example request: 3681 3682~~~ 3683{ 3684 "params": { 3685 "name": "iqn.2016-06.io.spdk:target1" 3686 }, 3687 "jsonrpc": "2.0", 3688 "method": "iscsi_delete_target_node", 3689 "id": 1 3690} 3691~~~ 3692 3693Example response: 3694 3695~~~ 3696{ 3697 "jsonrpc": "2.0", 3698 "id": 1, 3699 "result": true 3700} 3701~~~ 3702 3703## iscsi_get_portal_groups method {#rpc_iscsi_get_portal_groups} 3704 3705Show information about all available portal groups. 3706 3707### Parameters 3708 3709This method has no parameters. 3710 3711### Example 3712 3713Example request: 3714 3715~~~ 3716request: 3717{ 3718 "jsonrpc": "2.0", 3719 "method": "iscsi_get_portal_groups", 3720 "id": 1 3721} 3722~~~ 3723 3724Example response: 3725 3726~~~ 3727{ 3728 "jsonrpc": "2.0", 3729 "id": 1, 3730 "result": [ 3731 { 3732 "portals": [ 3733 { 3734 "host": "127.0.0.1", 3735 "port": "3260" 3736 } 3737 ], 3738 "tag": 1 3739 } 3740 ] 3741} 3742~~~ 3743 3744## iscsi_create_portal_group method {#rpc_iscsi_create_portal_group} 3745 3746Add a portal group. 3747 3748### Parameters 3749 3750Name | Optional | Type | Description 3751--------------------------- | -------- | --------| ----------- 3752tag | Required | number | Portal group tag 3753portals | Required | array | Not empty array of portals 3754 3755Portal object 3756 3757Name | Optional | Type | Description 3758--------------------------- | -------- | --------| ----------- 3759host | Required | string | Hostname or IP address 3760port | Required | string | Port number 3761 3762### Example 3763 3764Example request: 3765 3766~~~ 3767{ 3768 "params": { 3769 "portals": [ 3770 { 3771 "host": "127.0.0.1", 3772 "port": "3260" 3773 } 3774 ], 3775 "tag": 1 3776 }, 3777 "jsonrpc": "2.0", 3778 "method": "iscsi_create_portal_group", 3779 "id": 1 3780} 3781~~~ 3782 3783Example response: 3784 3785~~~ 3786{ 3787 "jsonrpc": "2.0", 3788 "id": 1, 3789 "result": true 3790} 3791~~~ 3792 3793## iscsi_delete_portal_group method {#rpc_iscsi_delete_portal_group} 3794 3795Delete an existing portal group. 3796 3797### Parameters 3798 3799Name | Optional | Type | Description 3800--------------------------- | -------- | --------| ----------- 3801tag | Required | number | Existing portal group tag 3802 3803### Example 3804 3805Example request: 3806 3807~~~ 3808{ 3809 "params": { 3810 "tag": 1 3811 }, 3812 "jsonrpc": "2.0", 3813 "method": "iscsi_delete_portal_group", 3814 "id": 1 3815} 3816~~~ 3817 3818Example response: 3819 3820~~~ 3821{ 3822 "jsonrpc": "2.0", 3823 "id": 1, 3824 "result": true 3825} 3826~~~ 3827 3828### iscsi_portal_group_set_auth method {#rpc_iscsi_portal_group_set_auth} 3829 3830Set CHAP authentication for discovery sessions specific for the existing iSCSI portal group. 3831This RPC overwrites the setting by the global parameters for the iSCSI portal group. 3832 3833### Parameters 3834 3835Name | Optional | Type | Description 3836--------------------------- | -------- | --------| ----------- 3837disable_chap | Optional | boolean | CHAP for discovery session should be disabled (default: `false`) 3838require_chap | Optional | boolean | CHAP for discovery session should be required (default: `false`) 3839mutual_chap | Optional | boolean | CHAP for discovery session should be unidirectional (`false`) or bidirectional (`true`) (default: `false`) 3840chap_group | Optional | number | CHAP group ID for discovery session (default: 0) 3841 3842Parameters `disable_chap` and `require_chap` are mutually exclusive. 3843 3844### Example 3845 3846Example request: 3847 3848~~~ 3849request: 3850{ 3851 "params": { 3852 "tag": 1, 3853 "chap_group": 1, 3854 "require_chap": true, 3855 "mutual_chap": true 3856 }, 3857 "jsonrpc": "2.0", 3858 "method": "iscsi_portal_group_set_auth", 3859 "id": 1 3860} 3861~~~ 3862 3863Example response: 3864 3865~~~ 3866{ 3867 "jsonrpc": "2.0", 3868 "id": 1, 3869 "result": true 3870} 3871~~~ 3872 3873## iscsi_get_connections method {#rpc_iscsi_get_connections} 3874 3875Show information about all active connections. 3876 3877### Parameters 3878 3879This method has no parameters. 3880 3881### Results 3882 3883Array of objects describing iSCSI connection. 3884 3885Name | Type | Description 3886--------------------------- | --------| ----------- 3887id | number | Index (used for TTT - Target Transfer Tag) 3888cid | number | CID (Connection ID) 3889tsih | number | TSIH (Target Session Identifying Handle) 3890lcore_id | number | Core number on which the iSCSI connection runs 3891initiator_addr | string | Initiator address 3892target_addr | string | Target address 3893target_node_name | string | Target node name (ASCII) without prefix 3894 3895### Example 3896 3897Example request: 3898 3899~~~ 3900{ 3901 "jsonrpc": "2.0", 3902 "method": "iscsi_get_connections", 3903 "id": 1 3904} 3905~~~ 3906 3907Example response: 3908 3909~~~ 3910{ 3911 "jsonrpc": "2.0", 3912 "id": 1, 3913 "result": [ 3914 { 3915 "tsih": 4, 3916 "cid": 0, 3917 "target_node_name": "target1", 3918 "lcore_id": 0, 3919 "initiator_addr": "10.0.0.2", 3920 "target_addr": "10.0.0.1", 3921 "id": 0 3922 } 3923 ] 3924} 3925~~~ 3926 3927## iscsi_target_node_add_lun method {#rpc_iscsi_target_node_add_lun} 3928 3929Add an LUN to an existing iSCSI target node. 3930 3931### Parameters 3932 3933Name | Optional | Type | Description 3934--------------------------- | -------- | --------| ----------- 3935name | Required | string | Target node name (ASCII) 3936bdev_name | Required | string | bdev name to be added as a LUN 3937lun_id | Optional | number | LUN ID (default: first free ID) 3938 3939### Example 3940 3941Example request: 3942 3943~~~ 3944{ 3945 "params": { 3946 "lun_id": 2, 3947 "name": "iqn.2016-06.io.spdk:target1", 3948 "bdev_name": "Malloc0" 3949 }, 3950 "jsonrpc": "2.0", 3951 "method": "iscsi_target_node_add_lun", 3952 "id": 1 3953} 3954~~~ 3955 3956Example response: 3957 3958~~~ 3959{ 3960 "jsonrpc": "2.0", 3961 "id": 1, 3962 "result": true 3963} 3964~~~ 3965 3966# NVMe-oF Target {#jsonrpc_components_nvmf_tgt} 3967 3968## nvmf_create_transport method {#rpc_nvmf_create_transport} 3969 3970Initialize an NVMe-oF transport with the given options. 3971 3972### Parameters 3973 3974Name | Optional | Type | Description 3975--------------------------- | -------- | --------| ----------- 3976trtype | Required | string | Transport type (ex. RDMA) 3977tgt_name | Optional | string | Parent NVMe-oF target name. 3978max_queue_depth | Optional | number | Max number of outstanding I/O per queue 3979max_qpairs_per_ctrlr | Optional | number | Max number of SQ and CQ per controller 3980in_capsule_data_size | Optional | number | Max number of in-capsule data size 3981max_io_size | Optional | number | Max I/O size (bytes) 3982io_unit_size | Optional | number | I/O unit size (bytes) 3983max_aq_depth | Optional | number | Max number of admin cmds per AQ 3984num_shared_buffers | Optional | number | The number of pooled data buffers available to the transport 3985buf_cache_size | Optional | number | The number of shared buffers to reserve for each poll group 3986max_srq_depth | Optional | number | The number of elements in a per-thread shared receive queue (RDMA only) 3987no_srq | Optional | boolean | Disable shared receive queue even for devices that support it. (RDMA only) 3988c2h_success | Optional | boolean | Disable C2H success optimization (TCP only) 3989dif_insert_or_strip | Optional | boolean | Enable DIF insert for write I/O and DIF strip for read I/O DIF (TCP only) 3990sock_priority | Optional | number | The socket priority of the connection owned by this transport (TCP only) 3991 3992### Example 3993 3994Example request: 3995 3996~~~ 3997{ 3998 "jsonrpc": "2.0", 3999 "method": "nvmf_create_transport", 4000 "id": 1, 4001 "params": { 4002 "trtype": "RDMA", 4003 "max_queue_depth": 32 4004 } 4005} 4006~~~ 4007 4008Example response: 4009 4010~~~ 4011{ 4012 "jsonrpc": "2.0", 4013 "id": 1, 4014 "result": true 4015} 4016~~~ 4017 4018## nvmf_get_subsystems method {#rpc_nvmf_get_subsystems} 4019 4020### Parameters 4021 4022Name | Optional | Type | Description 4023--------------------------- | -------- | ------------| ----------- 4024tgt_name | Optional | string | Parent NVMe-oF target name. 4025 4026### Example 4027 4028Example request: 4029 4030~~~ 4031{ 4032 "jsonrpc": "2.0", 4033 "id": 1, 4034 "method": "nvmf_get_subsystems" 4035} 4036~~~ 4037 4038Example response: 4039 4040~~~ 4041{ 4042 "jsonrpc": "2.0", 4043 "id": 1, 4044 "result": [ 4045 { 4046 "nqn": "nqn.2014-08.org.nvmexpress.discovery", 4047 "subtype": "Discovery" 4048 "listen_addresses": [], 4049 "hosts": [], 4050 "allow_any_host": true 4051 }, 4052 { 4053 "nqn": "nqn.2016-06.io.spdk:cnode1", 4054 "subtype": "NVMe", 4055 "listen_addresses": [ 4056 { 4057 "trtype": "RDMA", 4058 "adrfam": "IPv4", 4059 "traddr": "192.168.0.123", 4060 "trsvcid": "4420" 4061 } 4062 ], 4063 "hosts": [ 4064 {"nqn": "nqn.2016-06.io.spdk:host1"} 4065 ], 4066 "allow_any_host": false, 4067 "serial_number": "abcdef", 4068 "model_number": "ghijklmnop", 4069 "namespaces": [ 4070 {"nsid": 1, "name": "Malloc2"}, 4071 {"nsid": 2, "name": "Nvme0n1"} 4072 ] 4073 } 4074 ] 4075} 4076~~~ 4077 4078## nvmf_create_subsystem method {#rpc_nvmf_create_subsystem} 4079 4080Construct an NVMe over Fabrics target subsystem. 4081 4082### Parameters 4083 4084Name | Optional | Type | Description 4085----------------------- | -------- | ----------- | ----------- 4086nqn | Required | string | Subsystem NQN 4087tgt_name | Optional | string | Parent NVMe-oF target name. 4088serial_number | Optional | string | Serial number of virtual controller 4089model_number | Optional | string | Model number of virtual controller 4090max_namespaces | Optional | number | Maximum number of namespaces that can be attached to the subsystem. Default: 0 (Unlimited) 4091allow_any_host | Optional | boolean | Allow any host (`true`) or enforce allowed host whitelist (`false`). Default: `false`. 4092 4093### Example 4094 4095Example request: 4096 4097~~~ 4098{ 4099 "jsonrpc": "2.0", 4100 "id": 1, 4101 "method": "nvmf_create_subsystem", 4102 "params": { 4103 "nqn": "nqn.2016-06.io.spdk:cnode1", 4104 "allow_any_host": false, 4105 "serial_number": "abcdef", 4106 "model_number": "ghijklmnop" 4107 } 4108} 4109~~~ 4110 4111Example response: 4112 4113~~~ 4114{ 4115 "jsonrpc": "2.0", 4116 "id": 1, 4117 "result": true 4118} 4119~~~ 4120 4121## nvmf_delete_subsystem method {#rpc_nvmf_delete_subsystem} 4122 4123Delete an existing NVMe-oF subsystem. 4124 4125### Parameters 4126 4127Parameter | Optional | Type | Description 4128---------------------- | -------- | ----------- | ----------- 4129nqn | Required | string | Subsystem NQN to delete. 4130tgt_name | Optional | string | Parent NVMe-oF target name. 4131 4132### Example 4133 4134Example request: 4135 4136~~~ 4137{ 4138 "jsonrpc": "2.0", 4139 "id": 1, 4140 "method": "nvmf_delete_subsystem", 4141 "params": { 4142 "nqn": "nqn.2016-06.io.spdk:cnode1" 4143 } 4144} 4145~~~ 4146 4147Example response: 4148 4149~~~ 4150{ 4151 "jsonrpc": "2.0", 4152 "id": 1, 4153 "result": true 4154} 4155~~~ 4156 4157## nvmf_subsystem_add_listener method {#rpc_nvmf_subsystem_add_listener} 4158 4159Add a new listen address to an NVMe-oF subsystem. 4160 4161### Parameters 4162 4163Name | Optional | Type | Description 4164----------------------- | -------- | ----------- | ----------- 4165nqn | Required | string | Subsystem NQN 4166tgt_name | Optional | string | Parent NVMe-oF target name. 4167listen_address | Required | object | @ref rpc_nvmf_listen_address object 4168 4169### listen_address {#rpc_nvmf_listen_address} 4170 4171Name | Optional | Type | Description 4172----------------------- | -------- | ----------- | ----------- 4173trtype | Required | string | Transport type ("RDMA") 4174adrfam | Required | string | Address family ("IPv4", "IPv6", "IB", or "FC") 4175traddr | Required | string | Transport address 4176trsvcid | Required | string | Transport service ID 4177 4178### Example 4179 4180Example request: 4181 4182~~~ 4183{ 4184 "jsonrpc": "2.0", 4185 "id": 1, 4186 "method": "nvmf_subsystem_add_listener", 4187 "params": { 4188 "nqn": "nqn.2016-06.io.spdk:cnode1", 4189 "listen_address": { 4190 "trtype": "RDMA", 4191 "adrfam": "IPv4", 4192 "traddr": "192.168.0.123", 4193 "trsvcid": "4420" 4194 } 4195 } 4196} 4197~~~ 4198 4199Example response: 4200 4201~~~ 4202{ 4203 "jsonrpc": "2.0", 4204 "id": 1, 4205 "result": true 4206} 4207~~~ 4208 4209## nvmf_subsystem_add_ns method {#rpc_nvmf_subsystem_add_ns} 4210 4211Add a namespace to a subsystem. The namespace ID is returned as the result. 4212 4213### Parameters 4214 4215Name | Optional | Type | Description 4216----------------------- | -------- | ----------- | ----------- 4217nqn | Required | string | Subsystem NQN 4218namespace | Required | object | @ref rpc_nvmf_namespace object 4219tgt_name | Optional | string | Parent NVMe-oF target name. 4220 4221### namespace {#rpc_nvmf_namespace} 4222 4223Name | Optional | Type | Description 4224----------------------- | -------- | ----------- | ----------- 4225nsid | Optional | number | Namespace ID between 1 and 4294967294, inclusive. Default: Automatically assign NSID. 4226bdev_name | Required | string | Name of bdev to expose as a namespace. 4227nguid | Optional | string | 16-byte namespace globally unique identifier in hexadecimal (e.g. "ABCDEF0123456789ABCDEF0123456789") 4228eui64 | Optional | string | 8-byte namespace EUI-64 in hexadecimal (e.g. "ABCDEF0123456789") 4229uuid | Optional | string | RFC 4122 UUID (e.g. "ceccf520-691e-4b46-9546-34af789907c5") 4230ptpl_file | Optional | string | File path to save/restore persistent reservation information 4231 4232### Example 4233 4234Example request: 4235 4236~~~ 4237{ 4238 "jsonrpc": "2.0", 4239 "id": 1, 4240 "method": "nvmf_subsystem_add_ns", 4241 "params": { 4242 "nqn": "nqn.2016-06.io.spdk:cnode1", 4243 "namespace": { 4244 "nsid": 3, 4245 "bdev_name": "Nvme0n1", 4246 "ptpl_file": "/opt/Nvme0n1PR.json" 4247 } 4248 } 4249} 4250~~~ 4251 4252Example response: 4253 4254~~~ 4255{ 4256 "jsonrpc": "2.0", 4257 "id": 1, 4258 "result": 3 4259} 4260~~~ 4261 4262## nvmf_subsystem_remove_ns method {#rpc_nvmf_subsystem_remove_ns} 4263 4264Remove a namespace from a subsystem. 4265 4266### Parameters 4267 4268Name | Optional | Type | Description 4269----------------------- | -------- | ----------- | ----------- 4270nqn | Required | string | Subsystem NQN 4271nsid | Required | number | Namespace ID 4272tgt_name | Optional | string | Parent NVMe-oF target name. 4273 4274### Example 4275 4276Example request: 4277 4278~~~ 4279{ 4280 "jsonrpc": "2.0", 4281 "id": 1, 4282 "method": "nvmf_subsystem_remove_ns", 4283 "params": { 4284 "nqn": "nqn.2016-06.io.spdk:cnode1", 4285 "nsid": 1 4286 } 4287} 4288~~~ 4289 4290Example response: 4291 4292~~~ 4293{ 4294 "jsonrpc": "2.0", 4295 "id": 1, 4296 "result": true 4297} 4298~~~ 4299 4300## nvmf_subsystem_add_host method {#rpc_nvmf_subsystem_add_host} 4301 4302Add a host NQN to the whitelist of allowed hosts. 4303 4304### Parameters 4305 4306Name | Optional | Type | Description 4307----------------------- | -------- | ----------- | ----------- 4308nqn | Required | string | Subsystem NQN 4309host | Required | string | Host NQN to add to the list of allowed host NQNs 4310tgt_name | Optional | string | Parent NVMe-oF target name. 4311 4312### Example 4313 4314Example request: 4315 4316~~~ 4317{ 4318 "jsonrpc": "2.0", 4319 "id": 1, 4320 "method": "nvmf_subsystem_add_host", 4321 "params": { 4322 "nqn": "nqn.2016-06.io.spdk:cnode1", 4323 "host": "nqn.2016-06.io.spdk:host1" 4324 } 4325} 4326~~~ 4327 4328Example response: 4329 4330~~~ 4331{ 4332 "jsonrpc": "2.0", 4333 "id": 1, 4334 "result": true 4335} 4336~~~ 4337 4338## nvmf_subsystem_remove_host method {#rpc_nvmf_subsystem_remove_host} 4339 4340Remove a host NQN from the whitelist of allowed hosts. 4341 4342### Parameters 4343 4344Name | Optional | Type | Description 4345----------------------- | -------- | ----------- | ----------- 4346nqn | Required | string | Subsystem NQN 4347host | Required | string | Host NQN to remove from the list of allowed host NQNs 4348tgt_name | Optional | string | Parent NVMe-oF target name. 4349 4350### Example 4351 4352Example request: 4353 4354~~~ 4355{ 4356 "jsonrpc": "2.0", 4357 "id": 1, 4358 "method": "nvmf_subsystem_remove_host", 4359 "params": { 4360 "nqn": "nqn.2016-06.io.spdk:cnode1", 4361 "host": "nqn.2016-06.io.spdk:host1" 4362 } 4363} 4364~~~ 4365 4366Example response: 4367 4368~~~ 4369{ 4370 "jsonrpc": "2.0", 4371 "id": 1, 4372 "result": true 4373} 4374~~~ 4375 4376## nvmf_subsystem_allow_any_host method {#rpc_nvmf_subsystem_allow_any_host} 4377 4378Configure a subsystem to allow any host to connect or to enforce the host NQN whitelist. 4379 4380### Parameters 4381 4382Name | Optional | Type | Description 4383----------------------- | -------- | ----------- | ----------- 4384nqn | Required | string | Subsystem NQN 4385allow_any_host | Required | boolean | Allow any host (`true`) or enforce allowed host whitelist (`false`). 4386tgt_name | Optional | string | Parent NVMe-oF target name. 4387 4388### Example 4389 4390Example request: 4391 4392~~~ 4393{ 4394 "jsonrpc": "2.0", 4395 "id": 1, 4396 "method": "nvmf_subsystem_allow_any_host", 4397 "params": { 4398 "nqn": "nqn.2016-06.io.spdk:cnode1", 4399 "allow_any_host": true 4400 } 4401} 4402~~~ 4403 4404Example response: 4405 4406~~~ 4407{ 4408 "jsonrpc": "2.0", 4409 "id": 1, 4410 "result": true 4411} 4412~~~ 4413 4414## nvmf_set_max_subsystems {#rpc_nvmf_set_max_subsystems} 4415 4416Set the maximum allowed subsystems for the NVMe-oF target. This RPC may only be called 4417before SPDK subsystems have been initialized. 4418 4419### Parameters 4420 4421Name | Optional | Type | Description 4422----------------------- | -------- | ----------- | ----------- 4423max_subsystems | Required | number | Maximum number of NVMe-oF subsystems 4424 4425### Example 4426 4427Example request: 4428 4429~~~ 4430{ 4431 "jsonrpc": "2.0", 4432 "id": 1, 4433 "method": "nvmf_set_max_subsystems", 4434 "params": { 4435 "max_subsystems": 1024 4436 } 4437} 4438~~~ 4439 4440Example response: 4441 4442~~~ 4443{ 4444 "jsonrpc": "2.0", 4445 "id": 1, 4446 "result": true 4447} 4448~~~ 4449 4450## nvmf_set_config {#rpc_nvmf_set_config} 4451 4452Set global configuration of NVMe-oF target. This RPC may only be called before SPDK subsystems 4453have been initialized. 4454 4455### Parameters 4456 4457Name | Optional | Type | Description 4458----------------------- | -------- | ----------- | ----------- 4459acceptor_poll_rate | Optional | number | Polling interval of the acceptor for incoming connections (microseconds) 4460admin_cmd_passthru | Optional | object | Admin command passthru configuration 4461 4462### admin_cmd_passthru {#spdk_nvmf_admin_passthru_conf} 4463 4464Name | Optional | Type | Description 4465----------------------- | -------- | ----------- | ----------- 4466identify_ctrlr | Required | bool | If true, enables custom identify handler that reports some identify attributes from the underlying NVMe drive 4467 4468### Example 4469 4470Example request: 4471 4472~~~ 4473{ 4474 "jsonrpc": "2.0", 4475 "id": 1, 4476 "method": "nvmf_set_config", 4477 "params": { 4478 "acceptor_poll_rate": 10000 4479 } 4480} 4481~~~ 4482 4483Example response: 4484 4485~~~ 4486{ 4487 "jsonrpc": "2.0", 4488 "id": 1, 4489 "result": true 4490} 4491~~~ 4492 4493## nvmf_get_transports method {#rpc_nvmf_get_transports} 4494 4495### Parameters 4496 4497Name | Optional | Type | Description 4498--------------------------- | -------- | ------------| ----------- 4499tgt_name | Optional | string | Parent NVMe-oF target name. 4500 4501### Example 4502 4503Example request: 4504 4505~~~ 4506{ 4507 "jsonrpc": "2.0", 4508 "id": 1, 4509 "method": "nvmf_get_transports" 4510} 4511~~~ 4512 4513Example response: 4514 4515~~~ 4516{ 4517 "jsonrpc": "2.0", 4518 "id": 1, 4519 "result": [ 4520 { 4521 "type": "RDMA". 4522 "max_queue_depth": 128, 4523 "max_qpairs_per_ctrlr": 64, 4524 "in_capsule_data_size": 4096, 4525 "max_io_size": 131072, 4526 "io_unit_size": 131072 4527 } 4528 ] 4529} 4530~~~ 4531 4532## nvmf_get_stats method {#rpc_nvmf_get_stats} 4533 4534Retrieve current statistics of the NVMf subsystem. 4535 4536### Parameters 4537 4538Name | Optional | Type | Description 4539--------------------------- | -------- | ------------| ----------- 4540tgt_name | Optional | string | Parent NVMe-oF target name. 4541 4542### Response 4543 4544The response is an object containing NVMf subsystem statistics. 4545 4546### Example 4547 4548Example request: 4549~~~ 4550{ 4551 "jsonrpc": "2.0", 4552 "method": "nvmf_get_stats", 4553 "id": 1 4554} 4555~~~ 4556 4557Example response: 4558~~~ 4559{ 4560 "jsonrpc": "2.0", 4561 "id": 1, 4562 "result": { 4563 "tick_rate": 2400000000, 4564 "poll_groups": [ 4565 { 4566 "name": "app_thread", 4567 "admin_qpairs": 1, 4568 "io_qpairs": 4, 4569 "pending_bdev_io": 1721, 4570 "transports": [ 4571 { 4572 "trtype": "RDMA", 4573 "pending_data_buffer": 12131888, 4574 "devices": [ 4575 { 4576 "name": "mlx5_1", 4577 "polls": 72284105, 4578 "completions": 0, 4579 "requests": 0, 4580 "request_latency": 0, 4581 "pending_free_request": 0, 4582 "pending_rdma_read": 0, 4583 "pending_rdma_write": 0 4584 }, 4585 { 4586 "name": "mlx5_0", 4587 "polls": 72284105, 4588 "completions": 15165875, 4589 "requests": 7582935, 4590 "request_latency": 1249323766184, 4591 "pending_free_request": 0, 4592 "pending_rdma_read": 337602, 4593 "pending_rdma_write": 0 4594 } 4595 ] 4596 } 4597 ] 4598 } 4599 ] 4600 } 4601} 4602~~~ 4603 4604# Vhost Target {#jsonrpc_components_vhost_tgt} 4605 4606The following common preconditions need to be met in all target types. 4607 4608Controller name will be used to create UNIX domain socket. This implies that name concatenated with vhost socket 4609directory path needs to be valid UNIX socket name. 4610 4611@ref cpu_mask parameter is used to choose CPU on which pollers will be launched when new initiator is connecting. 4612It must be a subset of application CPU mask. Default value is CPU mask of the application. 4613 4614## vhost_controller_set_coalescing {#rpc_vhost_controller_set_coalescing} 4615 4616Controls interrupt coalescing for specific target. Because `delay_base_us` is used to calculate delay in CPU ticks 4617there is no hardcoded limit for this parameter. Only limitation is that final delay in CPU ticks might not overflow 461832 bit unsigned integer (which is more than 1s @ 4GHz CPU). In real scenarios `delay_base_us` should be much lower 4619than 150us. To disable coalescing set `delay_base_us` to 0. 4620 4621### Parameters 4622 4623Name | Optional | Type | Description 4624----------------------- | -------- | ----------- | ----------- 4625ctrlr | Required | string | Controller name 4626delay_base_us | Required | number | Base (minimum) coalescing time in microseconds 4627iops_threshold | Required | number | Coalescing activation level greater than 0 in IO per second 4628 4629### Example 4630 4631Example request: 4632 4633~~~ 4634{ 4635 "params": { 4636 "iops_threshold": 100000, 4637 "ctrlr": "VhostScsi0", 4638 "delay_base_us": 80 4639 }, 4640 "jsonrpc": "2.0", 4641 "method": "vhost_controller_set_coalescing", 4642 "id": 1 4643} 4644~~~ 4645 4646Example response: 4647 4648~~~ 4649{ 4650 "jsonrpc": "2.0", 4651 "id": 1, 4652 "result": true 4653} 4654~~~ 4655 4656## vhost_create_scsi_controller {#rpc_vhost_create_scsi_controller} 4657 4658Construct vhost SCSI target. 4659 4660### Parameters 4661 4662Name | Optional | Type | Description 4663----------------------- | -------- | ----------- | ----------- 4664ctrlr | Required | string | Controller name 4665cpumask | Optional | string | @ref cpu_mask for this controller 4666 4667### Example 4668 4669Example request: 4670 4671~~~ 4672{ 4673 "params": { 4674 "cpumask": "0x2", 4675 "ctrlr": "VhostScsi0" 4676 }, 4677 "jsonrpc": "2.0", 4678 "method": "vhost_create_scsi_controller", 4679 "id": 1 4680} 4681~~~ 4682 4683Example response: 4684 4685~~~ 4686{ 4687 "jsonrpc": "2.0", 4688 "id": 1, 4689 "result": true 4690} 4691~~~ 4692 4693## vhost_scsi_controller_add_target {#rpc_vhost_scsi_controller_add_target} 4694 4695In vhost target `ctrlr` create SCSI target with ID `scsi_target_num` and add `bdev_name` as LUN 0. 4696 4697### Parameters 4698 4699Name | Optional | Type | Description 4700----------------------- | -------- | ----------- | ----------- 4701ctrlr | Required | string | Controller name 4702scsi_target_num | Required | number | SCSI target ID between 0 and 7 or -1 to use first free ID. 4703bdev_name | Required | string | Name of bdev to expose as a LUN 0 4704 4705### Response 4706 4707SCSI target ID. 4708 4709### Example 4710 4711Example request: 4712 4713~~~ 4714{ 4715 "params": { 4716 "scsi_target_num": 1, 4717 "bdev_name": "Malloc0", 4718 "ctrlr": "VhostScsi0" 4719 }, 4720 "jsonrpc": "2.0", 4721 "method": "vhost_scsi_controller_add_target", 4722 "id": 1 4723} 4724~~~ 4725 4726Example response: 4727 4728~~~ 4729response: 4730{ 4731 "jsonrpc": "2.0", 4732 "id": 1, 4733 "result": 1 4734} 4735~~~ 4736 4737## vhost_scsi_controller_remove_target {#rpc_vhost_scsi_controller_remove_target} 4738 4739Remove SCSI target ID `scsi_target_num` from vhost target `scsi_target_num`. 4740 4741This method will fail if initiator is connected, but doesn't support hot-remove (the `VIRTIO_SCSI_F_HOTPLUG` is not negotiated). 4742 4743### Parameters 4744 4745Name | Optional | Type | Description 4746----------------------- | -------- | ----------- | ----------- 4747ctrlr | Required | string | Controller name 4748scsi_target_num | Required | number | SCSI target ID between 0 and 7 4749 4750### Example 4751 4752Example request: 4753 4754~~~ 4755request: 4756{ 4757 "params": { 4758 "scsi_target_num": 1, 4759 "ctrlr": "VhostScsi0" 4760 }, 4761 "jsonrpc": "2.0", 4762 "method": "vhost_scsi_controller_remove_target", 4763 "id": 1 4764} 4765~~~ 4766 4767Example response: 4768 4769~~~ 4770{ 4771 "jsonrpc": "2.0", 4772 "id": 1, 4773 "result": true 4774} 4775~~~ 4776 4777## vhost_create_nvme_controller {#rpc_vhost_create_nvme_controller} 4778 4779Construct empty vhost NVMe controller. 4780 4781### Parameters 4782 4783Name | Optional | Type | Description 4784----------------------- | -------- | ----------- | ----------- 4785ctrlr | Required | string | Controller name 4786io_queues | Required | number | Number between 1 and 31 of IO queues for the controller 4787cpumask | Optional | string | @ref cpu_mask for this controller 4788 4789### Example 4790 4791Example request: 4792 4793~~~ 4794{ 4795 "params": { 4796 "cpumask": "0x2", 4797 "io_queues": 4, 4798 "ctrlr": "VhostNvme0" 4799 }, 4800 "jsonrpc": "2.0", 4801 "method": "vhost_create_nvme_controller", 4802 "id": 1 4803} 4804~~~ 4805 4806Example response: 4807 4808~~~ 4809{ 4810 "jsonrpc": "2.0", 4811 "id": 1, 4812 "result": true 4813} 4814~~~ 4815 4816## vhost_nvme_controller_add_ns {#rpc_vhost_nvme_controller_add_ns} 4817 4818Add namespace backed by `bdev_name` 4819 4820### Parameters 4821 4822Name | Optional | Type | Description 4823----------------------- | -------- | ----------- | ----------- 4824ctrlr | Required | string | Controller name 4825bdev_name | Required | string | Name of bdev to expose as a namespace 4826cpumask | Optional | string | @ref cpu_mask for this controller 4827 4828### Example 4829 4830Example request: 4831 4832~~~ 4833{ 4834 "params": { 4835 "bdev_name": "Malloc0", 4836 "ctrlr": "VhostNvme0" 4837 }, 4838 "jsonrpc": "2.0", 4839 "method": "vhost_nvme_controller_add_ns", 4840 "id": 1 4841} 4842~~~ 4843 4844Example response: 4845 4846~~~ 4847{ 4848 "jsonrpc": "2.0", 4849 "id": 1, 4850 "result": true 4851} 4852~~~ 4853 4854## vhost_create_blk_controller {#rpc_vhost_create_blk_controller} 4855 4856Create vhost block controller 4857 4858If `readonly` is `true` then vhost block target will be created as read only and fail any write requests. 4859The `VIRTIO_BLK_F_RO` feature flag will be offered to the initiator. 4860 4861### Parameters 4862 4863Name | Optional | Type | Description 4864----------------------- | -------- | ----------- | ----------- 4865ctrlr | Required | string | Controller name 4866bdev_name | Required | string | Name of bdev to expose block device 4867readonly | Optional | boolean | If true, this target will be read only (default: false) 4868cpumask | Optional | string | @ref cpu_mask for this controller 4869 4870### Example 4871 4872Example request: 4873 4874~~~ 4875{ 4876 "params": { 4877 "dev_name": "Malloc0", 4878 "ctrlr": "VhostBlk0" 4879 }, 4880 "jsonrpc": "2.0", 4881 "method": "vhost_create_blk_controller", 4882 "id": 1 4883} 4884~~~ 4885 4886Example response: 4887 4888~~~ 4889{ 4890 "jsonrpc": "2.0", 4891 "id": 1, 4892 "result": true 4893} 4894~~~ 4895 4896## vhost_get_controllers {#rpc_vhost_get_controllers} 4897 4898Display information about all or specific vhost controller(s). 4899 4900### Parameters 4901 4902The user may specify no parameters in order to list all controllers, or a controller may be 4903specified by name. 4904 4905Name | Optional | Type | Description 4906----------------------- | -------- | ----------- | ----------- 4907name | Optional | string | Vhost controller name 4908 4909### Response {#rpc_vhost_get_controllers_response} 4910 4911Response is an array of objects describing requested controller(s). Common fields are: 4912 4913Name | Type | Description 4914----------------------- | ----------- | ----------- 4915ctrlr | string | Controller name 4916cpumask | string | @ref cpu_mask of this controller 4917delay_base_us | number | Base (minimum) coalescing time in microseconds (0 if disabled) 4918iops_threshold | number | Coalescing activation level 4919backend_specific | object | Backend specific informations 4920 4921### Vhost block {#rpc_vhost_get_controllers_blk} 4922 4923`backend_specific` contains one `block` object of type: 4924 4925Name | Type | Description 4926----------------------- | ----------- | ----------- 4927bdev | string | Backing bdev name or Null if bdev is hot-removed 4928readonly | boolean | True if controllers is readonly, false otherwise 4929 4930### Vhost SCSI {#rpc_vhost_get_controllers_scsi} 4931 4932`backend_specific` contains `scsi` array of following objects: 4933 4934Name | Type | Description 4935----------------------- | ----------- | ----------- 4936target_name | string | Name of this SCSI target 4937id | number | Unique SPDK global SCSI target ID 4938scsi_dev_num | number | SCSI target ID initiator will see when scanning this controller 4939luns | array | array of objects describing @ref rpc_vhost_get_controllers_scsi_luns 4940 4941### Vhost SCSI LUN {#rpc_vhost_get_controllers_scsi_luns} 4942 4943Object of type: 4944 4945Name | Type | Description 4946----------------------- | ----------- | ----------- 4947id | number | SCSI LUN ID 4948bdev_name | string | Backing bdev name 4949 4950### Vhost NVMe {#rpc_vhost_get_controllers_nvme} 4951 4952`backend_specific` contains `namespaces` array of following objects: 4953 4954Name | Type | Description 4955----------------------- | ----------- | ----------- 4956nsid | number | Namespace ID 4957bdev | string | Backing bdev name 4958 4959### Example 4960 4961Example request: 4962 4963~~~ 4964{ 4965 "jsonrpc": "2.0", 4966 "method": "vhost_get_controllers", 4967 "id": 1 4968} 4969~~~ 4970 4971Example response: 4972 4973~~~ 4974{ 4975 "jsonrpc": "2.0", 4976 "id": 1, 4977 "result": [ 4978 { 4979 "cpumask": "0x2", 4980 "backend_specific": { 4981 "block": { 4982 "readonly": false, 4983 "bdev": "Malloc0" 4984 } 4985 }, 4986 "iops_threshold": 60000, 4987 "ctrlr": "VhostBlk0", 4988 "delay_base_us": 100 4989 }, 4990 { 4991 "cpumask": "0x2", 4992 "backend_specific": { 4993 "scsi": [ 4994 { 4995 "target_name": "Target 2", 4996 "luns": [ 4997 { 4998 "id": 0, 4999 "bdev_name": "Malloc1" 5000 } 5001 ], 5002 "id": 0, 5003 "scsi_dev_num": 2 5004 }, 5005 { 5006 "target_name": "Target 5", 5007 "luns": [ 5008 { 5009 "id": 0, 5010 "bdev_name": "Malloc2" 5011 } 5012 ], 5013 "id": 1, 5014 "scsi_dev_num": 5 5015 } 5016 ] 5017 }, 5018 "iops_threshold": 60000, 5019 "ctrlr": "VhostScsi0", 5020 "delay_base_us": 0 5021 }, 5022 { 5023 "cpumask": "0x2", 5024 "backend_specific": { 5025 "namespaces": [ 5026 { 5027 "bdev": "Malloc3", 5028 "nsid": 1 5029 }, 5030 { 5031 "bdev": "Malloc4", 5032 "nsid": 2 5033 } 5034 ] 5035 }, 5036 "iops_threshold": 60000, 5037 "ctrlr": "VhostNvme0", 5038 "delay_base_us": 0 5039 } 5040 ] 5041} 5042~~~ 5043 5044## vhost_delete_controller {#rpc_vhost_delete_controller} 5045 5046Remove vhost target. 5047 5048This call will fail if there is an initiator connected or there is at least one SCSI target configured in case of 5049vhost SCSI target. In the later case please remove all SCSI targets first using @ref rpc_vhost_scsi_controller_remove_target. 5050 5051### Parameters 5052 5053Name | Optional | Type | Description 5054----------------------- | -------- | ----------- | ----------- 5055ctrlr | Required | string | Controller name 5056 5057### Example 5058 5059Example request: 5060 5061~~~ 5062{ 5063 "params": { 5064 "ctrlr": "VhostNvme0" 5065 }, 5066 "jsonrpc": "2.0", 5067 "method": "vhost_delete_controller", 5068 "id": 1 5069} 5070~~~ 5071 5072Example response: 5073 5074~~~ 5075{ 5076 "jsonrpc": "2.0", 5077 "id": 1, 5078 "result": true 5079} 5080~~~ 5081 5082# Logical Volume {#jsonrpc_components_lvol} 5083 5084Identification of logical volume store and logical volume is explained first. 5085 5086A logical volume store has a UUID and a name for its identification. 5087The UUID is generated on creation and it can be used as a unique identifier. 5088The name is specified on creation and can be renamed. 5089Either UUID or name is used to access logical volume store in RPCs. 5090 5091A logical volume has a UUID and a name for its identification. 5092The UUID of the logical volume is generated on creation and it can be unique identifier. 5093The alias of the logical volume takes the format _lvs_name/lvol_name_ where: 5094 5095* _lvs_name_ is the name of the logical volume store. 5096* _lvol_name_ is specified on creation and can be renamed. 5097 5098## bdev_lvol_create_lvstore {#rpc_bdev_lvol_create_lvstore} 5099 5100Construct a logical volume store. 5101 5102### Parameters 5103 5104Name | Optional | Type | Description 5105----------------------- | -------- | ----------- | ----------- 5106bdev_name | Required | string | Bdev on which to construct logical volume store 5107lvs_name | Required | string | Name of the logical volume store to create 5108cluster_sz | Optional | number | Cluster size of the logical volume store in bytes 5109clear_method | Optional | string | Change clear method for data region. Available: none, unmap (default), write_zeroes 5110 5111### Response 5112 5113UUID of the created logical volume store is returned. 5114 5115### Example 5116 5117Example request: 5118 5119~~~ 5120{ 5121 "jsonrpc": "2.0", 5122 "id": 1, 5123 "method": "bdev_lvol_create_lvstore", 5124 "params": { 5125 "lvs_name": "LVS0", 5126 "bdev_name": "Malloc0" 5127 "clear_method": "write_zeroes" 5128 } 5129} 5130~~~ 5131 5132Example response: 5133 5134~~~ 5135{ 5136 "jsonrpc": "2.0", 5137 "id": 1, 5138 "result": "a9959197-b5e2-4f2d-8095-251ffb6985a5" 5139} 5140~~~ 5141 5142## bdev_lvol_delete_lvstore {#rpc_bdev_lvol_delete_lvstore} 5143 5144Destroy a logical volume store. 5145 5146### Parameters 5147 5148Name | Optional | Type | Description 5149----------------------- | -------- | ----------- | ----------- 5150uuid | Optional | string | UUID of the logical volume store to destroy 5151lvs_name | Optional | string | Name of the logical volume store to destroy 5152 5153Either uuid or lvs_name must be specified, but not both. 5154 5155### Example 5156 5157Example request: 5158 5159~~~ 5160{ 5161 "jsonrpc": "2.0", 5162 "method": "bdev_lvol_delete_lvstore", 5163 "id": 1 5164 "params": { 5165 "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5" 5166 } 5167} 5168~~~ 5169 5170Example response: 5171 5172~~~ 5173{ 5174 "jsonrpc": "2.0", 5175 "id": 1, 5176 "result": true 5177} 5178~~~ 5179 5180## bdev_lvol_get_lvstores {#rpc_bdev_lvol_get_lvstores} 5181 5182Get a list of logical volume stores. 5183 5184### Parameters 5185 5186Name | Optional | Type | Description 5187----------------------- | -------- | ----------- | ----------- 5188uuid | Optional | string | UUID of the logical volume store to retrieve information about 5189lvs_name | Optional | string | Name of the logical volume store to retrieve information about 5190 5191Either uuid or lvs_name may be specified, but not both. 5192If both uuid and lvs_name are omitted, information about all logical volume stores is returned. 5193 5194### Example 5195 5196Example request: 5197 5198~~~ 5199{ 5200 "jsonrpc": "2.0", 5201 "method": "bdev_lvol_get_lvstores", 5202 "id": 1, 5203 "params": { 5204 "lvs_name": "LVS0" 5205 } 5206} 5207~~~ 5208 5209Example response: 5210 5211~~~ 5212{ 5213 "jsonrpc": "2.0", 5214 "id": 1, 5215 "result": [ 5216 { 5217 "uuid": "a9959197-b5e2-4f2d-8095-251ffb6985a5", 5218 "base_bdev": "Malloc0", 5219 "free_clusters": 31, 5220 "cluster_size": 4194304, 5221 "total_data_clusters": 31, 5222 "block_size": 4096, 5223 "name": "LVS0" 5224 } 5225 ] 5226} 5227~~~ 5228 5229## bdev_lvol_rename_lvstore {#rpc_bdev_lvol_rename_lvstore} 5230 5231Rename a logical volume store. 5232 5233### Parameters 5234 5235Name | Optional | Type | Description 5236----------------------- | -------- | ----------- | ----------- 5237old_name | Required | string | Existing logical volume store name 5238new_name | Required | string | New logical volume store name 5239 5240### Example 5241 5242Example request: 5243 5244~~~ 5245{ 5246 "jsonrpc": "2.0", 5247 "method": "bdev_lvol_rename_lvstore", 5248 "id": 1, 5249 "params": { 5250 "old_name": "LVS0", 5251 "new_name": "LVS2" 5252 } 5253} 5254~~~ 5255 5256Example response: 5257 5258~~~ 5259{ 5260 "jsonrpc": "2.0", 5261 "id": 1, 5262 "result": true 5263} 5264~~~ 5265 5266## bdev_lvol_create {#rpc_bdev_lvol_create} 5267 5268Create a logical volume on a logical volume store. 5269 5270### Parameters 5271 5272Name | Optional | Type | Description 5273----------------------- | -------- | ----------- | ----------- 5274lvol_name | Required | string | Name of logical volume to create 5275size | Required | number | Desired size of logical volume in megabytes 5276thin_provision | Optional | boolean | True to enable thin provisioning 5277uuid | Optional | string | UUID of logical volume store to create logical volume on 5278lvs_name | Optional | string | Name of logical volume store to create logical volume on 5279clear_method | Optional | string | Change default data clusters clear method. Available: none, unmap, write_zeroes 5280 5281Size will be rounded up to a multiple of cluster size. Either uuid or lvs_name must be specified, but not both. 5282lvol_name will be used in the alias of the created logical volume. 5283 5284### Response 5285 5286UUID of the created logical volume is returned. 5287 5288### Example 5289 5290Example request: 5291 5292~~~ 5293{ 5294 "jsonrpc": "2.0", 5295 "method": "bdev_lvol_create", 5296 "id": 1, 5297 "params": { 5298 "lvol_name": "LVOL0", 5299 "size": 1048576, 5300 "lvs_name": "LVS0", 5301 "clear_method": "unmap", 5302 "thin_provision": true 5303 } 5304} 5305~~~ 5306 5307Example response: 5308 5309~~~ 5310{ 5311 "jsonrpc": "2.0", 5312 "id": 1, 5313 "result": "1b38702c-7f0c-411e-a962-92c6a5a8a602" 5314} 5315~~~ 5316 5317## bdev_lvol_snapshot {#rpc_bdev_lvol_snapshot} 5318 5319Capture a snapshot of the current state of a logical volume. 5320 5321### Parameters 5322 5323Name | Optional | Type | Description 5324----------------------- | -------- | ----------- | ----------- 5325lvol_name | Required | string | UUID or alias of the logical volume to create a snapshot from 5326snapshot_name | Required | string | Name for the newly created snapshot 5327 5328### Response 5329 5330UUID of the created logical volume snapshot is returned. 5331 5332### Example 5333 5334Example request: 5335 5336~~~ 5337{ 5338 "jsonrpc": "2.0", 5339 "method": "bdev_lvol_snapshot", 5340 "id": 1, 5341 "params": { 5342 "lvol_name": "1b38702c-7f0c-411e-a962-92c6a5a8a602", 5343 "snapshot_name": "SNAP1" 5344 } 5345} 5346~~~ 5347 5348Example response: 5349 5350~~~ 5351{ 5352 "jsonrpc": "2.0", 5353 "id": 1, 5354 "result": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670" 5355} 5356~~~ 5357 5358## bdev_lvol_clone {#rpc_bdev_lvol_clone} 5359 5360Create a logical volume based on a snapshot. 5361 5362### Parameters 5363 5364Name | Optional | Type | Description 5365----------------------- | -------- | ----------- | ----------- 5366snapshot_name | Required | string | UUID or alias of the snapshot to clone 5367clone_name | Required | string | Name for the logical volume to create 5368 5369### Response 5370 5371UUID of the created logical volume clone is returned. 5372 5373### Example 5374 5375Example request: 5376 5377~~~ 5378{ 5379 "jsonrpc": "2.0" 5380 "method": "bdev_lvol_clone", 5381 "id": 1, 5382 "params": { 5383 "snapshot_name": "cc8d7fdf-7865-4d1f-9fc6-35da8e368670", 5384 "clone_name": "CLONE1" 5385 } 5386} 5387~~~ 5388 5389Example response: 5390 5391~~~ 5392{ 5393 "jsonrpc": "2.0", 5394 "id": 1, 5395 "result": "8d87fccc-c278-49f0-9d4c-6237951aca09" 5396} 5397~~~ 5398 5399## bdev_lvol_rename {#rpc_bdev_lvol_rename} 5400 5401Rename a logical volume. New name will rename only the alias of the logical volume. 5402 5403### Parameters 5404 5405Name | Optional | Type | Description 5406----------------------- | -------- | ----------- | ----------- 5407old_name | Required | string | UUID or alias of the existing logical volume 5408new_name | Required | string | New logical volume name 5409 5410### Example 5411 5412Example request: 5413 5414~~~ 5415{ 5416 "jsonrpc": "2.0", 5417 "method": "bdev_lvol_rename", 5418 "id": 1, 5419 "params": { 5420 "old_name": "067df606-6dbc-4143-a499-0d05855cb3b8", 5421 "new_name": "LVOL2" 5422 } 5423} 5424~~~ 5425 5426Example response: 5427 5428~~~ 5429{ 5430 "jsonrpc": "2.0", 5431 "id": 1, 5432 "result": true 5433} 5434~~~ 5435 5436## bdev_lvol_resize {#rpc_bdev_lvol_resize} 5437 5438Resize a logical volume. 5439 5440### Parameters 5441 5442Name | Optional | Type | Description 5443----------------------- | -------- | ----------- | ----------- 5444name | Required | string | UUID or alias of the logical volume to resize 5445size | Required | number | Desired size of the logical volume in megabytes 5446 5447### Example 5448 5449Example request: 5450 5451~~~ 5452{ 5453 "jsonrpc": "2.0", 5454 "method": "bdev_lvol_resize", 5455 "id": 1, 5456 "params": { 5457 "name": "51638754-ca16-43a7-9f8f-294a0805ab0a", 5458 "size": 2097152 5459 } 5460} 5461~~~ 5462 5463Example response: 5464 5465~~~ 5466{ 5467 "jsonrpc": "2.0", 5468 "id": 1, 5469 "result": true 5470} 5471~~~ 5472 5473## bdev_lvol_set_read_only{#rpc_bdev_lvol_set_read_only} 5474 5475Mark logical volume as read only. 5476 5477### Parameters 5478 5479Name | Optional | Type | Description 5480----------------------- | -------- | ----------- | ----------- 5481name | Required | string | UUID or alias of the logical volume to set as read only 5482 5483### Example 5484 5485Example request: 5486 5487~~~ 5488{ 5489 "jsonrpc": "2.0", 5490 "method": "bdev_lvol_set_read_only", 5491 "id": 1, 5492 "params": { 5493 "name": "51638754-ca16-43a7-9f8f-294a0805ab0a", 5494 } 5495} 5496~~~ 5497 5498Example response: 5499 5500~~~ 5501{ 5502 "jsonrpc": "2.0", 5503 "id": 1, 5504 "result": true 5505} 5506~~~ 5507 5508## bdev_lvol_delete {#rpc_bdev_lvol_delete} 5509 5510Destroy a logical volume. 5511 5512### Parameters 5513 5514Name | Optional | Type | Description 5515----------------------- | -------- | ----------- | ----------- 5516name | Required | string | UUID or alias of the logical volume to destroy 5517 5518### Example 5519 5520Example request: 5521 5522~~~ 5523{ 5524 "jsonrpc": "2.0", 5525 "method": "bdev_lvol_delete", 5526 "id": 1, 5527 "params": { 5528 "name": "51638754-ca16-43a7-9f8f-294a0805ab0a" 5529 } 5530} 5531~~~ 5532 5533Example response: 5534 5535~~~ 5536{ 5537 "jsonrpc": "2.0", 5538 "id": 1, 5539 "result": true 5540} 5541~~~ 5542 5543## bdev_lvol_inflate {#rpc_bdev_lvol_inflate} 5544 5545Inflate 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. 5546 5547### Parameters 5548 5549Name | Optional | Type | Description 5550----------------------- | -------- | ----------- | ----------- 5551name | Required | string | UUID or alias of the logical volume to inflate 5552 5553### Example 5554 5555Example request: 5556 5557~~~ 5558{ 5559 "jsonrpc": "2.0", 5560 "method": "bdev_lvol_inflate", 5561 "id": 1, 5562 "params": { 5563 "name": "8d87fccc-c278-49f0-9d4c-6237951aca09" 5564 } 5565} 5566~~~ 5567 5568Example response: 5569 5570~~~ 5571{ 5572 "jsonrpc": "2.0", 5573 "id": 1, 5574 "result": true 5575} 5576~~~ 5577 5578## bdev_lvol_decouple_parent {#rpc_bdev_lvol_decouple_parent} 5579 5580Decouple 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. 5581 5582### Parameters 5583 5584Name | Optional | Type | Description 5585----------------------- | -------- | ----------- | ----------- 5586name | Required | string | UUID or alias of the logical volume to decouple the parent of it 5587 5588### Example 5589 5590Example request: 5591 5592~~~ 5593{ 5594 "jsonrpc": "2.0", 5595 "method": "bdev_lvol_decouple_parent", 5596 "id": 1. 5597 "params": { 5598 "name": "8d87fccc-c278-49f0-9d4c-6237951aca09" 5599 } 5600} 5601~~~ 5602 5603Example response: 5604 5605~~~ 5606{ 5607 "jsonrpc": "2.0", 5608 "id": 1, 5609 "result": true 5610} 5611~~~ 5612 5613# RAID 5614 5615## bdev_raid_get_bdevs {#rpc_bdev_raid_get_bdevs} 5616 5617This is used to list all the raid bdev names based on the input category requested. Category should be one 5618of 'all', 'online', 'configuring' or 'offline'. 'all' means all the raid bdevs whether they are online or 5619configuring or offline. 'online' is the raid bdev which is registered with bdev layer. 'configuring' is 5620the raid bdev which does not have full configuration discovered yet. 'offline' is the raid bdev which is 5621not registered with bdev as of now and it has encountered any error or user has requested to offline 5622the raid bdev. 5623 5624### Parameters 5625 5626Name | Optional | Type | Description 5627----------------------- | -------- | ----------- | ----------- 5628category | Required | string | all or online or configuring or offline 5629 5630### Example 5631 5632Example request: 5633 5634~~~ 5635{ 5636 "jsonrpc": "2.0", 5637 "method": "bdev_raid_get_bdevs", 5638 "id": 1, 5639 "params": { 5640 "category": "all" 5641 } 5642} 5643~~~ 5644 5645Example response: 5646 5647~~~ 5648{ 5649 "jsonrpc": "2.0", 5650 "id": 1, 5651 "result": [ 5652 "Raid0" 5653 ] 5654} 5655~~~ 5656 5657## bdev_raid_create {#rpc_bdev_raid_create} 5658 5659Constructs new RAID bdev. 5660 5661### Parameters 5662 5663Name | Optional | Type | Description 5664----------------------- | -------- | ----------- | ----------- 5665name | Required | string | RAID bdev name 5666strip_size_kb | Required | number | Strip size in KB 5667raid_level | Required | number | RAID level 5668base_bdevs | Required | string | Base bdevs name, whitespace separated list in quotes 5669 5670### Example 5671 5672Example request: 5673 5674~~~ 5675{ 5676 "jsonrpc": "2.0", 5677 "method": "bdev_raid_create", 5678 "id": 1, 5679 "params": { 5680 "name": "Raid0", 5681 "raid_level": 0, 5682 "base_bdevs": [ 5683 "Malloc0", 5684 "Malloc1", 5685 "Malloc2", 5686 "Malloc3" 5687 ], 5688 "strip_size": 4096 5689 } 5690} 5691~~~ 5692 5693Example response: 5694 5695~~~ 5696{ 5697 "jsonrpc": "2.0", 5698 "id": 1, 5699 "result": true 5700} 5701~~~ 5702 5703## bdev_raid_delete {#rpc_bdev_raid_delete} 5704 5705Removes RAID bdev. 5706 5707### Parameters 5708 5709Name | Optional | Type | Description 5710----------------------- | -------- | ----------- | ----------- 5711name | Required | string | RAID bdev name 5712 5713### Example 5714 5715Example request: 5716 5717~~~ 5718{ 5719 "jsonrpc": "2.0", 5720 "method": "bdev_raid_delete", 5721 "id": 1, 5722 "params": { 5723 "name": "Raid0" 5724 } 5725} 5726~~~ 5727 5728Example response: 5729 5730~~~ 5731{ 5732 "jsonrpc": "2.0", 5733 "id": 1, 5734 "result": true 5735} 5736~~~ 5737 5738# OPAL 5739 5740## bdev_nvme_opal_init {#rpc_bdev_nvme_opal_init} 5741 5742This is used to initialize OPAL of a given NVMe ctrlr, including taking ownership and activating. 5743 5744### Parameters 5745 5746Name | Optional | Type | Description 5747----------------------- | -------- | ----------- | ----------- 5748nvme_ctrlr_name | Required | string | name of nvme ctrlr 5749password | Required | string | admin password of OPAL 5750 5751### Example 5752 5753Example request: 5754 5755~~~ 5756{ 5757 "jsonrpc": "2.0", 5758 "method": "bdev_nvme_opal_init", 5759 "id": 1, 5760 "params": { 5761 "nvme_ctrlr_name": "nvme0", 5762 "password": "*****" 5763 } 5764} 5765~~~ 5766 5767Example response: 5768 5769~~~ 5770{ 5771 "jsonrpc": "2.0", 5772 "id": 1, 5773 "result": true 5774} 5775~~~ 5776 5777## bdev_nvme_opal_revert {#rpc_bdev_nvme_opal_revert} 5778 5779This is used to revert OPAL to its factory settings. Erase all user configuration and data. 5780 5781### Parameters 5782 5783Name | Optional | Type | Description 5784----------------------- | -------- | ----------- | ----------- 5785nvme_ctrlr_name | Required | string | name of nvme ctrlr 5786password | Required | string | admin password of OPAL 5787 5788### Example 5789 5790Example request: 5791 5792~~~ 5793{ 5794 "jsonrpc": "2.0", 5795 "method": "bdev_nvme_opal_revert", 5796 "id": 1, 5797 "params": { 5798 "nvme_ctrlr_name": "nvme0", 5799 "password": "*****" 5800 } 5801} 5802~~~ 5803 5804Example response: 5805 5806~~~ 5807{ 5808 "jsonrpc": "2.0", 5809 "id": 1, 5810 "result": true 5811} 5812~~~ 5813 5814## bdev_opal_create {#rpc_bdev_opal_create} 5815 5816This is used to create an OPAL virtual bdev. 5817 5818### Parameters 5819 5820Name | Optional | Type | Description 5821----------------------- | -------- | ----------- | ----------- 5822nvme_ctrlr_name | Required | string | name of nvme ctrlr that supports OPAL 5823nsid | Required | number | namespace ID 5824locking_range_id | Required | number | OPAL locking range ID 5825range_start | Required | number | locking range start LBA 5826range_length | Required | number | locking range length 5827password | Required | string | admin password of OPAL 5828 5829### Response 5830 5831The response is the name of created OPAL virtual bdev. 5832 5833### Example 5834 5835Example request: 5836 5837~~~ 5838{ 5839 "jsonrpc": "2.0", 5840 "method": "bdev_opal_create", 5841 "id": 1, 5842 "params": { 5843 "nvme_ctrlr_name": "nvme0", 5844 "nsid": 1, 5845 "locking_range_id": 1, 5846 "range_start": 0, 5847 "range_length": 4096, 5848 "password": "*****" 5849 } 5850} 5851~~~ 5852 5853Example response: 5854 5855~~~ 5856{ 5857 "jsonrpc": "2.0", 5858 "id": 1, 5859 "result": "nvme0n1r1" 5860} 5861~~~ 5862 5863## bdev_opal_get_info {#rpc_bdev_opal_get_info} 5864 5865This is used to get information of a given OPAL bdev. 5866 5867### Parameters 5868 5869Name | Optional | Type | Description 5870----------------------- | -------- | ----------- | ----------- 5871bdev_name | Required | string | name of OPAL vbdev 5872password | Required | string | admin password 5873 5874### Response 5875 5876The response is the locking info of OPAL virtual bdev. 5877 5878### Example 5879 5880Example request: 5881 5882~~~ 5883{ 5884 "jsonrpc": "2.0", 5885 "method": "bdev_opal_get_info", 5886 "id": 1, 5887 "params": { 5888 "bdev_name": "nvme0n1r1", 5889 "password": "*****" 5890 } 5891} 5892~~~ 5893 5894Example response: 5895 5896~~~ 5897{ 5898 "jsonrpc": "2.0", 5899 "id": 1, 5900 "result": { 5901 "name": "nvme0n1r1", 5902 "range_start": 0, 5903 "range_length": 4096, 5904 "read_lock_enabled": true, 5905 "write_lock_enabled": true, 5906 "read_locked": false, 5907 "write_locked": false 5908 } 5909} 5910~~~ 5911 5912## bdev_opal_delete {#rpc_bdev_opal_delete} 5913 5914This is used to delete OPAL vbdev. 5915 5916### Parameters 5917 5918Name | Optional | Type | Description 5919----------------------- | -------- | ----------- | ----------- 5920bdev_name | Required | string | name of OPAL vbdev 5921password | Required | string | admin password 5922 5923### Example 5924 5925Example request: 5926 5927~~~ 5928{ 5929 "jsonrpc": "2.0", 5930 "method": "bdev_opal_delete", 5931 "id": 1, 5932 "params": { 5933 "bdev_name": "nvme0n1r1", 5934 "password": "*****" 5935 } 5936} 5937~~~ 5938 5939Example response: 5940 5941~~~ 5942{ 5943 "jsonrpc": "2.0", 5944 "id": 1, 5945 "result": true 5946} 5947~~~ 5948 5949## bdev_opal_new_user {#rpc_bdev_opal_new_user} 5950 5951This enables a new user to the specified opal bdev so that the user can lock/unlock the bdev. 5952Recalling this for the same opal bdev, only the newest user will have the privilege. 5953 5954### Parameters 5955 5956Name | Optional | Type | Description 5957----------------------- | -------- | ----------- | ----------- 5958bdev_name | Required | string | name of OPAL vbdev 5959admin_password | Required | string | admin password 5960user_id | Required | number | user ID 5961user_password | Required | string | user password 5962 5963### Example 5964 5965Example request: 5966 5967~~~ 5968{ 5969 "jsonrpc": "2.0", 5970 "method": "bdev_opal_new_user", 5971 "id": 1, 5972 "params": { 5973 "bdev_name": "nvme0n1r1", 5974 "admin_password": "*****", 5975 "user_id": "1", 5976 "user_password": "********" 5977 } 5978} 5979~~~ 5980 5981Example response: 5982 5983~~~ 5984{ 5985 "jsonrpc": "2.0", 5986 "id": 1, 5987 "result": true 5988} 5989~~~ 5990 5991## bdev_opal_set_lock_state {#rpc_bdev_opal_set_lock_state} 5992 5993This is used to lock/unlock specific opal bdev providing user ID and password. 5994 5995### Parameters 5996 5997Name | Optional | Type | Description 5998----------------------- | -------- | ----------- | ----------- 5999bdev_name | Required | string | name of OPAL vbdev 6000user_id | Required | number | user ID 6001password | Required | string | user password 6002lock_state | Required | string | lock state 6003 6004### Example 6005 6006Example request: 6007 6008~~~ 6009{ 6010 "jsonrpc": "2.0", 6011 "method": "bdev_opal_set_lock_state", 6012 "id": 1, 6013 "params": { 6014 "bdev_name": "nvme0n1r1", 6015 "user_id": "1", 6016 "user_password": "********", 6017 "lock_state": "rwlock" 6018 } 6019} 6020~~~ 6021 6022Example response: 6023 6024~~~ 6025{ 6026 "jsonrpc": "2.0", 6027 "id": 1, 6028 "result": true 6029} 6030~~~ 6031 6032# Notifications 6033 6034## notify_get_types {#rpc_notify_get_types} 6035 6036Return list of all supported notification types. 6037 6038### Parameters 6039 6040None 6041 6042### Response 6043 6044The response is an array of strings - supported RPC notification types. 6045 6046### Example 6047 6048Example request: 6049 6050~~~ 6051{ 6052 "jsonrpc": "2.0", 6053 "method": "notify_get_types", 6054 "id": 1 6055} 6056~~~ 6057 6058Example response: 6059 6060~~~ 6061{ 6062 "id": 1, 6063 "result": [ 6064 "bdev_register", 6065 "bdev_unregister" 6066 ], 6067 "jsonrpc": "2.0" 6068} 6069~~~ 6070 6071## notify_get_notifications {#notify_get_notifications} 6072 6073Request notifications. Returns array of notifications that happend since the specified id (or first that is available). 6074 6075Notice: Notifications are kept in circular buffer with limited size. Older notifications might be inaccesible due to being overwritten by new ones. 6076 6077### Parameters 6078 6079Name | Optional | Type | Description 6080----------------------- | -------- | ----------- | ----------- 6081id | Optional | number | First Event ID to fetch (default: first available). 6082max | Optional | number | Maximum number of event to return (default: no limit). 6083 6084### Response 6085 6086Response is an array of event objects. 6087 6088Name | Optional | Type | Description 6089----------------------- | -------- | ----------- | ----------- 6090id | Optional | number | Event ID. 6091type | Optional | number | Type of the event. 6092ctx | Optional | string | Event context. 6093 6094### Example 6095 6096Example request: 6097 6098~~~ 6099{ 6100 "id": 1, 6101 "jsonrpc": "2.0", 6102 "method": "notify_get_notifications", 6103 "params": { 6104 "id": 1, 6105 "max": 10 6106 } 6107} 6108 6109~~~ 6110 6111Example response: 6112 6113~~~ 6114{ 6115 "jsonrpc": "2.0", 6116 "id": 1, 6117 "result": [ 6118 { 6119 "ctx": "Malloc0", 6120 "type": "bdev_register", 6121 "id": 1 6122 }, 6123 { 6124 "ctx": "Malloc2", 6125 "type": "bdev_register", 6126 "id": 2 6127 } 6128 ] 6129} 6130~~~ 6131 6132# Linux Network Block Device (NBD) {#jsonrpc_components_nbd} 6133 6134SPDK supports exporting bdevs through Linux nbd. These devices then appear as standard Linux kernel block devices and can be accessed using standard utilities like fdisk. 6135 6136In order to export a device over nbd, first make sure the Linux kernel nbd driver is loaded by running 'modprobe nbd'. 6137 6138## nbd_start_disk {#rpc_nbd_start_disk} 6139 6140Start to export one SPDK bdev as NBD disk 6141 6142### Parameters 6143 6144Name | Optional | Type | Description 6145----------------------- | -------- | ----------- | ----------- 6146bdev_name | Required | string | Bdev name to export 6147nbd_device | Optional | string | NBD device name to assign 6148 6149### Response 6150 6151Path of exported NBD disk 6152 6153### Example 6154 6155Example request: 6156 6157~~~ 6158{ 6159 "params": { 6160 "nbd_device": "/dev/nbd1", 6161 "bdev_name": "Malloc1" 6162 }, 6163 "jsonrpc": "2.0", 6164 "method": "nbd_start_disk", 6165 "id": 1 6166} 6167~~~ 6168 6169Example response: 6170 6171~~~ 6172{ 6173 "jsonrpc": "2.0", 6174 "id": 1, 6175 "result": "/dev/nbd1" 6176} 6177~~~ 6178 6179## nbd_stop_disk {#rpc_nbd_stop_disk} 6180 6181Stop one NBD disk which is based on SPDK bdev. 6182 6183### Parameters 6184 6185Name | Optional | Type | Description 6186----------------------- | -------- | ----------- | ----------- 6187nbd_device | Required | string | NBD device name to stop 6188 6189### Example 6190 6191Example request: 6192 6193~~~ 6194{ 6195 "params": { 6196 "nbd_device": "/dev/nbd1", 6197 }, 6198 "jsonrpc": "2.0", 6199 "method": "nbd_stop_disk", 6200 "id": 1 6201} 6202~~~ 6203 6204Example response: 6205 6206~~~ 6207{ 6208 "jsonrpc": "2.0", 6209 "id": 1, 6210 "result": "true" 6211} 6212~~~ 6213 6214## nbd_get_disks {#rpc_nbd_get_disks} 6215 6216Display all or specified NBD device list 6217 6218### Parameters 6219 6220Name | Optional | Type | Description 6221----------------------- | -------- | ----------- | ----------- 6222nbd_device | Optional | string | NBD device name to display 6223 6224### Response 6225 6226The response is an array of exported NBD devices and their corresponding SPDK bdev. 6227 6228### Example 6229 6230Example request: 6231 6232~~~ 6233{ 6234 "jsonrpc": "2.0", 6235 "method": "nbd_get_disks", 6236 "id": 1 6237} 6238~~~ 6239 6240Example response: 6241 6242~~~ 6243{ 6244 "jsonrpc": "2.0", 6245 "id": 1, 6246 "result": [ 6247 { 6248 "bdev_name": "Malloc0", 6249 "nbd_device": "/dev/nbd0" 6250 }, 6251 { 6252 "bdev_name": "Malloc1", 6253 "nbd_device": "/dev/nbd1" 6254 } 6255 ] 6256} 6257~~~ 6258 6259# Blobfs {#jsonrpc_components_blobfs} 6260 6261## blobfs_detect {#rpc_blobfs_detect} 6262 6263Detect whether a blobfs exists on bdev. 6264 6265### Parameters 6266 6267Name | Optional | Type | Description 6268----------------------- | -------- | ----------- | ----------- 6269bdev_name | Required | string | Block device name to detect blobfs 6270 6271### Response 6272 6273True if a blobfs exists on the bdev; False otherwise. 6274 6275### Example 6276 6277Example request: 6278 6279~~~ 6280{ 6281 "jsonrpc": "2.0", 6282 "id": 1, 6283 "method": "blobfs_detect", 6284 "params": { 6285 "bdev_name": "Malloc0" 6286 } 6287} 6288~~~ 6289 6290Example response: 6291 6292~~~ 6293{ 6294 "jsonrpc": "2.0", 6295 "id": 1, 6296 "result": "true" 6297} 6298~~~ 6299 6300## blobfs_create {#rpc_blobfs_create} 6301 6302Build blobfs on bdev. 6303 6304### Parameters 6305 6306Name | Optional | Type | Description 6307----------------------- | -------- | ----------- | ----------- 6308bdev_name | Required | string | Block device name to create blobfs 6309cluster_sz | Optional | number | Size of cluster in bytes. Must be multiple of 4KiB page size, default and minimal value is 1M. 6310 6311### Example 6312 6313Example request: 6314 6315~~~ 6316{ 6317 "jsonrpc": "2.0", 6318 "id": 1, 6319 "method": "blobfs_create", 6320 "params": { 6321 "bdev_name": "Malloc0", 6322 "cluster_sz": 1M 6323 } 6324} 6325~~~ 6326 6327Example response: 6328 6329~~~ 6330{ 6331 "jsonrpc": "2.0", 6332 "id": 1, 6333 "result": "true" 6334} 6335~~~ 6336 6337## blobfs_mount {#rpc_blobfs_mount} 6338 6339Mount a blobfs on bdev to one host path through FUSE 6340 6341### Parameters 6342 6343Name | Optional | Type | Description 6344----------------------- | -------- | ----------- | ----------- 6345bdev_name | Required | string | Block device name where the blobfs is 6346mountpoint | Required | string | Mountpoint path in host to mount blobfs 6347 6348### Example 6349 6350Example request: 6351 6352~~~ 6353{ 6354 "jsonrpc": "2.0", 6355 "id": 1, 6356 "method": ""blobfs_mount"", 6357 "params": { 6358 "bdev_name": "Malloc0", 6359 "mountpoint": "/mnt/" 6360 } 6361} 6362~~~ 6363 6364Example response: 6365 6366~~~ 6367{ 6368 "jsonrpc": "2.0", 6369 "id": 1, 6370 "result": "true" 6371} 6372~~ 6373 6374## blobfs_set_cache_size {#rpc_blobfs_set_cache_size} 6375 6376Set cache pool size for blobfs filesystems. This RPC is only permitted when the cache pool is not already initialized. 6377 6378The cache pool is initialized when the first blobfs filesystem is initialized or loaded. It is freed when the all initialized or loaded filesystems are unloaded. 6379 6380### Parameters 6381 6382Name | Optional | Type | Description 6383----------------------- | -------- | ----------- | ----------- 6384size_in_mb | Required | number | Cache size in megabytes 6385 6386### Response 6387 6388True if cache size is set successfully; False if failed to set. 6389 6390### Example 6391 6392Example request: 6393 6394~~~ 6395{ 6396 "jsonrpc": "2.0", 6397 "id": 1, 6398 "method": "blobfs_set_cache_size", 6399 "params": { 6400 "size_in_mb": 512, 6401 } 6402} 6403~~~ 6404 6405Example response: 6406 6407~~~ 6408{ 6409 "jsonrpc": "2.0", 6410 "id": 1, 6411 "result": true 6412} 6413~~~ 6414 6415# Miscellaneous RPC commands 6416 6417## bdev_nvme_send_cmd {#rpc_bdev_nvme_send_cmd} 6418 6419Send NVMe command directly to NVMe controller or namespace. Parameters and responses encoded by base64 urlsafe need further processing. 6420 6421Notice: bdev_nvme_send_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. 6422 6423### Parameters 6424 6425Name | Optional | Type | Description 6426----------------------- | -------- | ----------- | ----------- 6427name | Required | string | Name of the operating NVMe controller 6428cmd_type | Required | string | Type of nvme cmd. Valid values are: admin, io 6429data_direction | Required | string | Direction of data transfer. Valid values are: c2h, h2c 6430cmdbuf | Required | string | NVMe command encoded by base64 urlsafe 6431data | Optional | string | Data transferring to controller from host, encoded by base64 urlsafe 6432metadata | Optional | string | Metadata transferring to controller from host, encoded by base64 urlsafe 6433data_len | Optional | number | Data length required to transfer from controller to host 6434metadata_len | Optional | number | Metadata length required to transfer from controller to host 6435timeout_ms | Optional | number | Command execution timeout value, in milliseconds 6436 6437### Response 6438 6439Name | Type | Description 6440----------------------- | ----------- | ----------- 6441cpl | string | NVMe completion queue entry, encoded by base64 urlsafe 6442data | string | Data transferred from controller to host, encoded by base64 urlsafe 6443metadata | string | Metadata transferred from controller to host, encoded by base64 urlsafe 6444 6445### Example 6446 6447Example request: 6448 6449~~~ 6450{ 6451 "jsonrpc": "2.0", 6452 "method": "bdev_nvme_send_cmd", 6453 "id": 1, 6454 "params": { 6455 "name": "Nvme0", 6456 "cmd_type": "admin" 6457 "data_direction": "c2h", 6458 "cmdbuf": "BgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAsGUs9P5_AAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", 6459 "data_len": 60, 6460 } 6461} 6462~~~ 6463 6464Example response: 6465 6466~~~ 6467{ 6468 "jsonrpc": "2.0", 6469 "id": 1, 6470 "result": { 6471 "cpl": "AAAAAAAAAAARAAAAWrmwABAA==", 6472 "data": "sIjg6AAAAACwiODoAAAAALCI4OgAAAAAAAYAAREAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" 6473 } 6474 6475} 6476~~~ 6477 6478## spdk_get_version {#rpc_spdk_get_version} 6479 6480Get the version info of the running SPDK application. 6481 6482### Parameters 6483 6484This method has no parameters. 6485 6486### Response 6487 6488The response is the version number including major version number, minor version number, patch level number and suffix string. 6489 6490### Example 6491 6492Example request: 6493~~ 6494{ 6495 "jsonrpc": "2.0", 6496 "id": 1, 6497 "method": "spdk_get_version" 6498} 6499~~ 6500 6501Example response: 6502~~ 6503{ 6504 "jsonrpc": "2.0", 6505 "id": 1, 6506 "result": { 6507 "version": "19.04-pre", 6508 "fields" : { 6509 "major": 19, 6510 "minor": 4, 6511 "patch": 0, 6512 "suffix": "-pre" 6513 } 6514 } 6515} 6516~~ 6517