Commit 1766296c authored by Pawel Baldysiak's avatar Pawel Baldysiak Committed by Tomasz Zawadzki
Browse files

python/cli/nvmf: Make admin cmds passthru a list parameter



Currently SPDK supports setting identify_ctrlr admin cmd
as passthru as separate argument in CLI.
Support for more admin cmds is currently under development.
Having them as separate arguments would add a lot of parameters.
To avoid that - change this single on/off flag parameter to
a list of admin cmds that user would like to be set as passthru.

Change-Id: Ibda375319674794878607bb92d5f45f327f537fe
Signed-off-by: default avatarPawel Baldysiak <pawel.baldysiak@dell.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26236


Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz@tzawadzki.com>
Reviewed-by: default avatarKonrad Sztyber <ksztyber@nvidia.com>
parent eed6aa6c
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -22,8 +22,13 @@ def add_parser(subparsers):
    p.set_defaults(func=nvmf_set_max_subsystems)

    def nvmf_set_config(args):
        args.passthru_admin_cmds = args.passthru_admin_cmds or []
        if args.passthru_identify_ctrlr:
            print('WARNING: -i|--passthru-identify-ctrlr is deprecated, please use -p|--passthru-admin-cmds identify_ctrlr.',
                  file=sys.stderr)
            args.passthru_admin_cmds.append('identify_ctrlr')
        rpc.nvmf.nvmf_set_config(args.client,
                                 passthru_identify_ctrlr=args.passthru_identify_ctrlr,
                                 passthru_admin_cmds=args.passthru_admin_cmds,
                                 poll_groups_mask=args.poll_groups_mask,
                                 discovery_filter=args.discovery_filter,
                                 dhchap_digests=args.dhchap_digests,
@@ -31,7 +36,10 @@ def add_parser(subparsers):

    p = subparsers.add_parser('nvmf_set_config', help='Set NVMf target config')
    p.add_argument('-i', '--passthru-identify-ctrlr', help="""Passthrough fields like serial number and model number
    when the controller has a single namespace that is an NVMe bdev""", action='store_true')
    when the controller has a single namespace that is an NVMe bdev (deprecated)""", action='store_true')
    p.add_argument('-p', '--passthru-admin-cmds', help="""Comma-separated list of admin commands to be passthru
                   when the controller has a single namespace that is an NVMe bdev.
                   Available options are: identify_ctrlr""", type=lambda d: d.split(','))
    p.add_argument('-m', '--poll-groups-mask', help='Set cpumask for NVMf poll groups (optional)', type=str)
    p.add_argument('-d', '--discovery-filter', help="""Set discovery filter (optional), possible values are: `match_any` (default) or
         comma separated values: `transport`, `address`, `svcid`""", type=str)
+3 −5
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ def nvmf_set_max_subsystems(client,


def nvmf_set_config(client,
                    passthru_identify_ctrlr=None,
                    passthru_admin_cmds=None,
                    poll_groups_mask=None,
                    discovery_filter=None, dhchap_digests=None, dhchap_dhgroups=None):
    """Set NVMe-oF target subsystem configuration.
@@ -37,10 +37,8 @@ def nvmf_set_config(client,
    """
    params = {}

    if passthru_identify_ctrlr:
        admin_cmd_passthru = {}
        admin_cmd_passthru['identify_ctrlr'] = passthru_identify_ctrlr
        params['admin_cmd_passthru'] = admin_cmd_passthru
    if passthru_admin_cmds:
        params['admin_cmd_passthru'] = {cmd: True for cmd in passthru_admin_cmds}
    if poll_groups_mask:
        params['poll_groups_mask'] = poll_groups_mask
    if discovery_filter:
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ nvmfpid=$!
trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT

waitforlisten $nvmfpid
$rpc_py -v nvmf_set_config --passthru-identify-ctrlr
$rpc_py -v nvmf_set_config -p identify_ctrlr
$rpc_py -v framework_start_init
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
timing_exit start_nvmf_tgt