nvmf: fix fabricintf parsing in spdk_nvmf_parse_port function

The index should be 0 for fabricintf.
Moreover, when there is no fabricintf found, error should
be returned

Change-Id: I3aa04566a5a318b8c921dd37c8573ed075254266
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2016-06-08 14:12:55 +08:00 committed by Daniel Verkamp
parent d237632434
commit 2c43473adc
2 changed files with 7 additions and 2 deletions

View File

@ -222,7 +222,7 @@ spdk_nvmf_parse_port(struct spdk_conf_section *sp)
/* Loop over the fabric interfaces and add them to the port */ /* Loop over the fabric interfaces and add them to the port */
for (i = 0; ; i++) { for (i = 0; ; i++) {
listen_addr = spdk_conf_section_get_nmval(sp, "FabricIntf", i, 1); listen_addr = spdk_conf_section_get_nmval(sp, "FabricIntf", i, 0);
if (listen_addr == NULL) { if (listen_addr == NULL) {
break; break;
} }
@ -238,6 +238,11 @@ spdk_nvmf_parse_port(struct spdk_conf_section *sp)
spdk_nvmf_port_add_fabric_intf(port, fabric_intf); spdk_nvmf_port_add_fabric_intf(port, fabric_intf);
} }
if (TAILQ_EMPTY(&port->head)) {
SPDK_ERRLOG("No fabric interface found\n");
return -1;
}
return 0; return 0;
} }

View File

@ -12,7 +12,7 @@
[Port1] [Port1]
Comment "Test1" Comment "Test1"
FabricIntf DA1 192.168.100.8:7174 FabricIntf 192.168.100.8:7174
[InitiatorGroup1] [InitiatorGroup1]
Comment "Initiator Group1" Comment "Initiator Group1"