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