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: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
0c8a5d8ce6
commit
45c041449f
@ -746,6 +746,11 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (num_devs != 0) {
|
||||||
|
SPDK_ERRLOG("Subsystem %d: Namespaces not allowed for Direct mode\n", num);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ctx.subsystem = subsystem;
|
ctx.subsystem = subsystem;
|
||||||
ctx.found = false;
|
ctx.found = false;
|
||||||
if (strcmp(bdf, "*") == 0) {
|
if (strcmp(bdf, "*") == 0) {
|
||||||
|
@ -309,7 +309,6 @@ p = subparsers.add_parser('get_nvmf_subsystems', help='Display nvmf subsystems')
|
|||||||
p.set_defaults(func=get_nvmf_subsystems)
|
p.set_defaults(func=get_nvmf_subsystems)
|
||||||
|
|
||||||
def construct_nvmf_subsystem(args):
|
def construct_nvmf_subsystem(args):
|
||||||
namespaces = []
|
|
||||||
hosts = []
|
hosts = []
|
||||||
|
|
||||||
listen_addresses = [dict(u.split(":") for u in a.split(" ")) for a in args.listen.split(",")]
|
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(" "):
|
for u in args.hosts.split(" "):
|
||||||
hosts.append(u)
|
hosts.append(u)
|
||||||
|
|
||||||
for u in args.namespaces.split(" "):
|
|
||||||
namespaces.append(u)
|
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
'core': args.core,
|
'core': args.core,
|
||||||
'mode': args.mode,
|
'mode': args.mode,
|
||||||
@ -328,8 +324,14 @@ def construct_nvmf_subsystem(args):
|
|||||||
'hosts': hosts,
|
'hosts': hosts,
|
||||||
'pci_address': args.pci_address,
|
'pci_address': args.pci_address,
|
||||||
'serial_number': args.serial_number,
|
'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)
|
jsonrpc_call('construct_nvmf_subsystem', params)
|
||||||
|
|
||||||
p = subparsers.add_parser('construct_nvmf_subsystem', help='Add a nvmf subsystem')
|
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.
|
p.add_argument("-n", "--namespaces", help="""Whitespace-separated list of namespaces.
|
||||||
Format: 'dev1 dev2 dev3' etc
|
Format: 'dev1 dev2 dev3' etc
|
||||||
Example: 'Malloc0 Malloc1 Malloc2'
|
Example: 'Malloc0 Malloc1 Malloc2'
|
||||||
*** The devices must pre-exist ***""", default='Malloc0')
|
*** The devices must pre-exist ***""")
|
||||||
p.set_defaults(func=construct_nvmf_subsystem)
|
p.set_defaults(func=construct_nvmf_subsystem)
|
||||||
|
|
||||||
def delete_nvmf_subsystem(args):
|
def delete_nvmf_subsystem(args):
|
||||||
|
Loading…
Reference in New Issue
Block a user