Commit 45c04144 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvmf/rpc: don't allow namespaces in direct mode



create_nvmf_subsystem should not allow the user to specify any
namespaces in direct mode.

Also remove the default Malloc0 namespace in rpc.py; the user
should be required to specify the list in virtual mode.

Change-Id: I3aaf7c64b9ceee89a3f7db15760a669527adb29d
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 0c8a5d8c
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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) {
+8 −6
Original line number Diff line number Diff line
@@ -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):