fabrics: restore discover_from_conf_file to actually work
Sagi Grimberg
maintainerPATCH 1/1 fabrics: restore discover_from_conf_file to actually work
With all the rework, discover_from_conf_file was completely broken. Have both discover and connect-all working with params passed from /etc/nvme/discovery.conf
Signed-off-by Sagi Grimberg <[email protected]>
--- fabrics.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
fabrics.c +17 -3
@@ -299,7 +299,10 @@ static int discover_from_conf_file(nvme_host_t h, const char *desc,char *hostnqn =NULL , *hostid =NULL ;char *ptr, **argv, *p, line[4096 ];int argc, ret =0 ; +unsigned int verbose =0 ;FILE *f; +enum nvme_print_flags flags; +char *format ="normal" ;struct nvme_fabrics_config cfg = { .tos =-1 ,
@@ -308,8 +311,18 @@ static int discover_from_conf_file(nvme_host_t h, const char *desc,OPT_ARGS (opts) = {NVMF_OPTS (cfg), +OPT_FMT ("output-format" ,'o' , &format, output_format), +OPT_FILE ("raw" ,'r' , &raw,"save raw output to file" ), +OPT_FLAG ("persistent" ,'p' , &persistent,"persistent discovery connection" ), +OPT_FLAG ("quiet" ,'S' , &quiet,"suppress already connected errors" ), +OPT_INCR ("verbose" ,'v' , &verbose,"Increase logging verbosity" ), +OPT_END () }; + ret = flags =validate_output_format (format); +if (ret <0 ) +return ret; + f =fopen (PATH_NVMF_DISC ,"r" );if (f ==NULL ) { errno =ENOENT ;
@@ -340,7 +353,8 @@ static int discover_from_conf_file(nvme_host_t h, const char *desc, ret =argconfig_parse (argc, argv, desc, opts);if (ret) goto next; - +if (persistent && !cfg.keep_alive_tmo) + cfg.keep_alive_tmo =30 ;if (!transport && !traddr) goto next;
@@ -351,8 +365,8 @@ static int discover_from_conf_file(nvme_host_t h, const char *desc, errno =0 ; ret =nvmf_add_ctrl (h, c, &cfg, false);if (!ret) { -__discover (c, defcfg,NULL , persistent, - connect,0 ); +__discover (c, &cfg, raw, connect, + persistent, flags);if (!persistent) ret =nvme_disconnect_ctrl (c);nvme_free_ctrl (c);
Signature · 7 lines
2.30.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
Keith Busch
maintainerThank you, patch applied.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme