nvmf/rpc: make sure NVMe device is found in create

Extend the check added in commit
7552ee5512 ("nvmf_tgt: fail if NVMe
controller is not found") to the RPC interface.

Also remove the default PCI address from rpc.py, since it is not a
useful default - the user must specify a PCI address, which will vary
depending on the configuration of the machine.

Change-Id: If9a4e19ef2a84c9d839b467abc011046613f7168
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-10-10 16:04:24 -07:00
parent 4afe9d1acb
commit 5ec0b3227d
2 changed files with 10 additions and 2 deletions

View File

@ -762,6 +762,12 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name,
if (spdk_nvme_probe(&ctx, probe_cb, attach_cb, NULL)) { if (spdk_nvme_probe(&ctx, probe_cb, attach_cb, NULL)) {
SPDK_ERRLOG("One or more controllers failed in spdk_nvme_probe()\n"); SPDK_ERRLOG("One or more controllers failed in spdk_nvme_probe()\n");
} }
if (!ctx.found) {
SPDK_ERRLOG("Could not find NVMe controller at PCI address %04x:%02x:%02x.%x\n",
ctx.domain, ctx.bus, ctx.device, ctx.function);
return -1;
}
} else { } else {
struct spdk_bdev *bdev; struct spdk_bdev *bdev;
const char *namespace; const char *namespace;

View File

@ -316,7 +316,6 @@ def construct_nvmf_subsystem(args):
'mode': args.mode, 'mode': args.mode,
'nqn': args.nqn, 'nqn': args.nqn,
'listen_addresses': listen_addresses, 'listen_addresses': listen_addresses,
'pci_address': args.pci_address,
'serial_number': args.serial_number, 'serial_number': args.serial_number,
} }
@ -332,6 +331,9 @@ def construct_nvmf_subsystem(args):
namespaces.append(u) namespaces.append(u)
params['namespaces'] = namespaces params['namespaces'] = namespaces
if args.pci_address:
params['pci_address'] = args.pci_address
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')
@ -346,7 +348,7 @@ Format: 'nqn1 nqn2' etc
Example: 'nqn.2016-06.io.spdk:init nqn.2016-07.io.spdk:init'""") Example: 'nqn.2016-06.io.spdk:init nqn.2016-07.io.spdk:init'""")
p.add_argument("-p", "--pci_address", help="""Valid if mode == Direct. p.add_argument("-p", "--pci_address", help="""Valid if mode == Direct.
Format: 'domain:device:function' etc Format: 'domain:device:function' etc
Example: '0000:00:01.0'""", default='0000:00:01.0') Example: '0000:00:01.0'""")
p.add_argument("-s", "--serial_number", help="""Valid if mode == Virtual. p.add_argument("-s", "--serial_number", help="""Valid if mode == Virtual.
Format: 'sn' etc Format: 'sn' etc
Example: 'SPDK00000000000001'""", default='0000:00:01.0') Example: 'SPDK00000000000001'""", default='0000:00:01.0')