Skip to content

Commit 209a384

Browse files
authored
Merge pull request #2165 from martin-gpy/warnings_verbose_level
fabrics: move hostid/hostnqn warnings to verbose level
2 parents dcdad6f + 2529290 commit 209a384

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

fabrics.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ char *nvmf_hostid_from_hostnqn(const char *hostnqn)
632632
return strdup(uuid + strlen("uuid:"));
633633
}
634634

635-
void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn)
635+
void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn, unsigned int verbose)
636636
{
637637
char *hostid_from_file, *hostid_from_hostnqn;
638638

@@ -641,7 +641,9 @@ void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn)
641641

642642
hostid_from_file = nvmf_hostid_from_file();
643643
if (hostid_from_file && strcmp(hostid_from_file, hostid)) {
644-
fprintf(stderr, "warning: use generated hostid instead of hostid file\n");
644+
if (verbose)
645+
fprintf(stderr,
646+
"warning: use generated hostid instead of hostid file\n");
645647
free(hostid_from_file);
646648
}
647649

@@ -650,7 +652,9 @@ void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn)
650652

651653
hostid_from_hostnqn = nvmf_hostid_from_hostnqn(hostnqn);
652654
if (hostid_from_hostnqn && strcmp(hostid_from_hostnqn, hostid)) {
653-
fprintf(stderr, "warning: use hostid which does not match uuid in hostnqn\n");
655+
if (verbose)
656+
fprintf(stderr,
657+
"warning: use hostid which does not match uuid in hostnqn\n");
654658
free(hostid_from_hostnqn);
655659
}
656660
}
@@ -741,7 +745,7 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
741745
hostid = hid = nvmf_hostid_from_file();
742746
if (!hostid && hostnqn)
743747
hostid = hid = nvmf_hostid_from_hostnqn(hostnqn);
744-
nvmf_check_hostid_and_hostnqn(hostid, hostnqn);
748+
nvmf_check_hostid_and_hostnqn(hostid, hostnqn, verbose);
745749
h = nvme_lookup_host(r, hostnqn, hostid);
746750
if (!h) {
747751
ret = ENOMEM;
@@ -964,7 +968,7 @@ int nvmf_connect(const char *desc, int argc, char **argv)
964968
hostid = hid = nvmf_hostid_from_file();
965969
if (!hostid && hostnqn)
966970
hostid = hid = nvmf_hostid_from_hostnqn(hostnqn);
967-
nvmf_check_hostid_and_hostnqn(hostid, hostnqn);
971+
nvmf_check_hostid_and_hostnqn(hostid, hostnqn, verbose);
968972
h = nvme_lookup_host(r, hostnqn, hostid);
969973
if (!h) {
970974
errno = ENOMEM;

0 commit comments

Comments
 (0)