Commit 5ec0b322 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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



Extend the check added in commit
7552ee55 ("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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 4afe9d1a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -762,6 +762,12 @@ spdk_nvmf_parse_subsystem_for_rpc(const char *name,
		if (spdk_nvme_probe(&ctx, probe_cb, attach_cb, NULL)) {
			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 {
		struct spdk_bdev *bdev;
		const char *namespace;
+4 −2
Original line number Diff line number Diff line
@@ -316,7 +316,6 @@ def construct_nvmf_subsystem(args):
        'mode': args.mode,
        'nqn': args.nqn,
        'listen_addresses': listen_addresses,
        'pci_address': args.pci_address,
        'serial_number': args.serial_number,
    }

@@ -332,6 +331,9 @@ def construct_nvmf_subsystem(args):
            namespaces.append(u)
        params['namespaces'] = namespaces

    if args.pci_address:
        params['pci_address'] = args.pci_address

    jsonrpc_call('construct_nvmf_subsystem', params)

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'""")
p.add_argument("-p", "--pci_address", help="""Valid if mode == Direct.
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.
Format:  'sn' etc
Example: 'SPDK00000000000001'""",  default='0000:00:01.0')