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