Commit 82470bdc authored by Boris Glimcher's avatar Boris Glimcher Committed by Tomasz Zawadzki
Browse files

schema: fix mismatched 'required' attr of parameters



check schema against python cli and validate 'required' attr matches
also add linting for this in the code to prevent future breaks

Change-Id: Ie5f8d48589ef054c7067b0e57b87e4ff1931a213
Signed-off-by: default avatarBoris Glimcher <Boris.Glimcher@emc.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26766


Reviewed-by: default avatarKonrad Sztyber <ksztyber@nvidia.com>
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz@tzawadzki.com>
parent f641e8fb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ def add_parser(subparsers):
        args.client.accel_assign_opc(opname=args.opname, module=args.module)

    p = subparsers.add_parser('accel_assign_opc', help='Manually assign an operation to a module.')
    p.add_argument('-o', '--opname', help='opname')
    p.add_argument('-m', '--module', help='name of module')
    p.add_argument('-o', '--opname', help='opname', required=True)
    p.add_argument('-m', '--module', help='name of module', required=True)
    p.set_defaults(func=accel_assign_opc)

    def accel_crypto_key_create(args):
+2 −2
Original line number Diff line number Diff line
@@ -132,8 +132,8 @@ def add_parser(subparsers):
    p = subparsers.add_parser('thread_set_cpumask',
                              help="""set the cpumask of the thread whose ID matches to the
    specified value. The thread may be migrated to one of the specified CPUs.""")
    p.add_argument('-i', '--id', type=int, help='thread ID')
    p.add_argument('-m', '--cpumask', help='cpumask for this thread')
    p.add_argument('-i', '--id', type=int, help='thread ID', required=True)
    p.add_argument('-m', '--cpumask', help='cpumask for this thread', required=True)
    p.set_defaults(func=thread_set_cpumask)

    def thread_get_pollers(args):
+11 −11
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ def add_parser(subparsers):

    p = subparsers.add_parser('bdev_examine',
                              help="""examine a bdev if it exists, or will examine it after it is created""")
    p.add_argument('-b', '--name', help='Name or alias of the bdev')
    p.add_argument('-b', '--name', help='Name or alias of the bdev', required=True)
    p.set_defaults(func=bdev_examine)

    def bdev_wait_for_examine(args):
@@ -1367,8 +1367,8 @@ def add_parser(subparsers):
                                     password=args.password)

    p = subparsers.add_parser('bdev_nvme_opal_init', help='take ownership and activate')
    p.add_argument('-b', '--nvme-ctrlr-name', help='nvme ctrlr name')
    p.add_argument('-p', '--password', help='password for admin')
    p.add_argument('-b', '--nvme-ctrlr-name', help='nvme ctrlr name', required=True)
    p.add_argument('-p', '--password', help='password for admin', required=True)
    p.set_defaults(func=bdev_nvme_opal_init)

    def bdev_nvme_opal_revert(args):
@@ -1376,8 +1376,8 @@ def add_parser(subparsers):
                                       nvme_ctrlr_name=args.nvme_ctrlr_name,
                                       password=args.password)
    p = subparsers.add_parser('bdev_nvme_opal_revert', help='Revert to default factory settings')
    p.add_argument('-b', '--nvme-ctrlr-name', help='nvme ctrlr name')
    p.add_argument('-p', '--password', help='password')
    p.add_argument('-b', '--nvme-ctrlr-name', help='nvme ctrlr name', required=True)
    p.add_argument('-p', '--password', help='password', required=True)
    p.set_defaults(func=bdev_nvme_opal_revert)

    def bdev_opal_create(args):
@@ -1404,8 +1404,8 @@ def add_parser(subparsers):
                                               password=args.password))

    p = subparsers.add_parser('bdev_opal_get_info', help='get opal locking range info for this bdev')
    p.add_argument('-b', '--bdev-name', help='opal bdev')
    p.add_argument('-p', '--password', help='password')
    p.add_argument('-b', '--bdev-name', help='opal bdev', required=True)
    p.add_argument('-p', '--password', help='password', required=True)
    p.set_defaults(func=bdev_opal_get_info)

    def bdev_opal_delete(args):
@@ -1461,10 +1461,10 @@ def add_parser(subparsers):
                                               timeout_ms=args.timeout_ms))

    p = subparsers.add_parser('bdev_nvme_send_cmd', help='NVMe passthrough cmd.')
    p.add_argument('-n', '--nvme-name', help="""Name of the operating NVMe controller""")
    p.add_argument('-t', '--cmd-type', help="""Type of nvme cmd. Valid values are: admin, io""")
    p.add_argument('-r', '--data-direction', help="""Direction of data transfer. Valid values are: c2h, h2c""")
    p.add_argument('-c', '--cmdbuf', help="""NVMe command encoded by base64 urlsafe""")
    p.add_argument('-n', '--nvme-name', help="""Name of the operating NVMe controller""", required=True)
    p.add_argument('-t', '--cmd-type', help="""Type of nvme cmd. Valid values are: admin, io""", required=True)
    p.add_argument('-r', '--data-direction', help="""Direction of data transfer. Valid values are: c2h, h2c""", required=True)
    p.add_argument('-c', '--cmdbuf', help="""NVMe command encoded by base64 urlsafe""", required=True)
    p.add_argument('-d', '--data', help="""Data transferring to controller from host, encoded by base64 urlsafe""")
    p.add_argument('-m', '--metadata', help="""Metadata transferring to controller from host, encoded by base64 urlsafe""")
    p.add_argument('-D', '--data-length', help="""Data length required to transfer from controller to host""", type=int)
+3 −3
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ def add_parser(subparsers):
        args.client.compressdev_scan_accel_module(pmd=args.pmd)

    p = subparsers.add_parser('compressdev_scan_accel_module', help='Scan and enable compressdev module and set pmd option.')
    p.add_argument('-p', '--pmd', type=int, help='0 = auto-select, 1= QAT only, 2 = mlx5_pci only, 3 = uadk only')
    p.add_argument('-p', '--pmd', type=int, help='0 = auto-select, 1= QAT only, 2 = mlx5_pci only, 3 = uadk only', required=True)
    p.set_defaults(func=compressdev_scan_accel_module)

    # dsa
@@ -167,8 +167,8 @@ def add_parser(subparsers):

    p = subparsers.add_parser('accel_error_inject_error',
                              help='Inject an error to processing accel operation')
    p.add_argument('-o', '--opcode', help='Opcode')
    p.add_argument('-t', '--type',
    p.add_argument('-o', '--opcode', help='Opcode', required=True)
    p.add_argument('-t', '--type', required=True,
                   help='Error type ("corrupt": corrupt the data, "failure": fail the operation, "disable": disable error injection)')
    p.add_argument('-c', '--count', type=int,
                   help='Number of errors to inject on each IO channel (0 to disable error injection)')
+4 −4
Original line number Diff line number Diff line
@@ -1957,7 +1957,7 @@
        {
          "name": "name",
          "type": "string",
          "required": false,
          "required": true,
          "description": "Registered Rados cluster object name"
        },
        {
@@ -4330,13 +4330,13 @@
        {
          "name": "fsdev_name",
          "type": "string",
          "required": false,
          "required": true,
          "description": "Name of an underlying fsdev"
        },
        {
          "name": "tag",
          "type": "string",
          "required": false,
          "required": true,
          "description": "Virtio FS tag according to the virtio specification"
        },
        {
@@ -4945,7 +4945,7 @@
        {
          "name": "strip_size_kb",
          "type": "number",
          "required": true,
          "required": false,
          "description": "Strip size in KB"
        },
        {
Loading