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