@@ -632,7 +632,7 @@ char *nvmf_hostid_from_hostnqn(const char *hostnqn)
632
632
return strdup (uuid + strlen ("uuid:" ));
633
633
}
634
634
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 )
636
636
{
637
637
char * hostid_from_file , * hostid_from_hostnqn ;
638
638
@@ -641,7 +641,9 @@ void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn)
641
641
642
642
hostid_from_file = nvmf_hostid_from_file ();
643
643
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" );
645
647
free (hostid_from_file );
646
648
}
647
649
@@ -650,7 +652,9 @@ void nvmf_check_hostid_and_hostnqn(const char *hostid, const char *hostnqn)
650
652
651
653
hostid_from_hostnqn = nvmf_hostid_from_hostnqn (hostnqn );
652
654
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" );
654
658
free (hostid_from_hostnqn );
655
659
}
656
660
}
@@ -741,7 +745,7 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
741
745
hostid = hid = nvmf_hostid_from_file ();
742
746
if (!hostid && hostnqn )
743
747
hostid = hid = nvmf_hostid_from_hostnqn (hostnqn );
744
- nvmf_check_hostid_and_hostnqn (hostid , hostnqn );
748
+ nvmf_check_hostid_and_hostnqn (hostid , hostnqn , verbose );
745
749
h = nvme_lookup_host (r , hostnqn , hostid );
746
750
if (!h ) {
747
751
ret = ENOMEM ;
@@ -964,7 +968,7 @@ int nvmf_connect(const char *desc, int argc, char **argv)
964
968
hostid = hid = nvmf_hostid_from_file ();
965
969
if (!hostid && hostnqn )
966
970
hostid = hid = nvmf_hostid_from_hostnqn (hostnqn );
967
- nvmf_check_hostid_and_hostnqn (hostid , hostnqn );
971
+ nvmf_check_hostid_and_hostnqn (hostid , hostnqn , verbose );
968
972
h = nvme_lookup_host (r , hostnqn , hostid );
969
973
if (!h ) {
970
974
errno = ENOMEM ;
0 commit comments