diff --git a/app/nvmf_tgt/conf.c b/app/nvmf_tgt/conf.c index 52eacd521..7889b617d 100644 --- a/app/nvmf_tgt/conf.c +++ b/app/nvmf_tgt/conf.c @@ -746,6 +746,11 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name, return -1; } + if (num_devs != 0) { + SPDK_ERRLOG("Subsystem %d: Namespaces not allowed for Direct mode\n", num); + return -1; + } + ctx.subsystem = subsystem; ctx.found = false; if (strcmp(bdf, "*") == 0) { diff --git a/scripts/rpc.py b/scripts/rpc.py index fe75700e1..8c64bed58 100755 --- a/scripts/rpc.py +++ b/scripts/rpc.py @@ -309,7 +309,6 @@ p = subparsers.add_parser('get_nvmf_subsystems', help='Display nvmf subsystems') p.set_defaults(func=get_nvmf_subsystems) def construct_nvmf_subsystem(args): - namespaces = [] hosts = [] listen_addresses = [dict(u.split(":") for u in a.split(" ")) for a in args.listen.split(",")] @@ -317,9 +316,6 @@ def construct_nvmf_subsystem(args): for u in args.hosts.split(" "): hosts.append(u) - for u in args.namespaces.split(" "): - namespaces.append(u) - params = { 'core': args.core, 'mode': args.mode, @@ -328,8 +324,14 @@ def construct_nvmf_subsystem(args): 'hosts': hosts, 'pci_address': args.pci_address, 'serial_number': args.serial_number, - 'namespaces': namespaces, } + + if args.namespaces: + namespaces = [] + for u in args.namespaces.split(" "): + namespaces.append(u) + params['namespaces'] = namespaces + jsonrpc_call('construct_nvmf_subsystem', params) p = subparsers.add_parser('construct_nvmf_subsystem', help='Add a nvmf subsystem') @@ -351,7 +353,7 @@ Example: 'SPDK00000000000001'""", default='0000:00:01.0') p.add_argument("-n", "--namespaces", help="""Whitespace-separated list of namespaces. Format: 'dev1 dev2 dev3' etc Example: 'Malloc0 Malloc1 Malloc2' -*** The devices must pre-exist ***""", default='Malloc0') +*** The devices must pre-exist ***""") p.set_defaults(func=construct_nvmf_subsystem) def delete_nvmf_subsystem(args):