1717
1818struct test_data {
1919 /* input data */
20+ const char * hostnqn ;
21+ const char * hostid ;
2022 const char * subsysname ;
2123 const char * subsysnqn ;
2224 const char * transport ;
@@ -31,23 +33,27 @@ struct test_data {
3133 int ctrl_id ;
3234};
3335
36+ #define DEFAULT_HOSTID "9ba1651a-ed36-11f0-9858-6c1ff71ba506"
37+ #define DEFAULT_HOSTNQN "nqn.2014-08.org.nvmexpress:uuid:DEFAULT_HOSTID"
3438#define DEFAULT_SUBSYSNAME "subsysname"
3539#define DEFAULT_SUBSYSNQN "subsysnqn"
3640#define SRC_ADDR4 "192.168.56.100"
3741#define SRC_ADDR6 "1234:5678:abcd:EF01:1234:5678:abcd:EF01"
3842
43+ #define DEFAULTS DEFAULT_HOSTNQN, DEFAULT_HOSTNQN, DEFAULT_SUBSYSNAME, DEFAULT_SUBSYSNQN
44+
3945struct test_data test_data [] = {
40- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "tcp" , "192.168.1.1" , "192.168.1.20" , NULL , "4420" },
41- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "tcp" , "192.168.1.1" , "192.168.1.20" , NULL , "4421" },
42- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "tcp" , "192.168.1.2" , "192.168.1.20" , "eth1" , "4420" },
43- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "tcp" , "192.168.1.2" , "192.168.1.20" , "eth1" , "4421" },
44- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "rdma" , "192.168.1.3" , "192.168.1.20" , NULL , NULL },
45- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "rdma" , "192.168.1.4" , "192.168.1.20" , NULL , NULL },
46- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "fc" ,
46+ { DEFAULTS , "tcp" , "192.168.1.1" , "192.168.1.20" , NULL , "4420" },
47+ { DEFAULTS , "tcp" , "192.168.1.1" , "192.168.1.20" , NULL , "4421" },
48+ { DEFAULTS , "tcp" , "192.168.1.2" , "192.168.1.20" , "eth1" , "4420" },
49+ { DEFAULTS , "tcp" , "192.168.1.2" , "192.168.1.20" , "eth1" , "4421" },
50+ { DEFAULTS , "rdma" , "192.168.1.3" , "192.168.1.20" , NULL , NULL },
51+ { DEFAULTS , "rdma" , "192.168.1.4" , "192.168.1.20" , NULL , NULL },
52+ { DEFAULTS , "fc" ,
4753 "nn-0x201700a09890f5bf:pn-0x201900a09890f5bf" ,
4854 "nn-0x200000109b579ef3:pn-0x100000109b579ef3"
4955 },
50- { DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN , "fc" ,
56+ { DEFAULTS , "fc" ,
5157 "nn-0x201700a09890f5bf:pn-0x201900a09890f5bf" ,
5258 "nn-0x200000109b579ef6:pn-0x100000109b579ef6" ,
5359 },
@@ -125,7 +131,7 @@ static struct nvme_global_ctx *create_tree()
125131
126132 ctx = nvme_create_global_ctx (stdout , LOG_DEBUG );
127133 assert (ctx );
128- nvme_default_host (ctx , & h );
134+ nvme_host_get (ctx , DEFAULT_HOSTNQN , DEFAULT_HOSTID , & h );
129135 assert (h );
130136
131137 printf (" ctrls created:\n" );
@@ -281,7 +287,7 @@ static bool test_src_addr()
281287 ctx = nvme_create_global_ctx (stdout , LOG_DEBUG );
282288 assert (ctx );
283289
284- nvme_default_host (ctx , & h );
290+ nvme_host_get (ctx , DEFAULT_HOSTNQN , DEFAULT_HOSTID , & h );
285291 assert (h );
286292
287293 s = nvme_lookup_subsystem (h , DEFAULT_SUBSYSNAME , DEFAULT_SUBSYSNQN );
@@ -457,7 +463,7 @@ static bool ctrl_match(const char *tag,
457463 ctx = nvme_create_global_ctx (stdout , LOG_INFO );
458464 assert (ctx );
459465
460- nvme_default_host (ctx , & h );
466+ nvme_host_get (ctx , DEFAULT_HOSTNQN , DEFAULT_HOSTID , & h );
461467 assert (h );
462468
463469 s = nvme_lookup_subsystem (h , DEFAULT_SUBSYSNAME , reference -> subsysnqn ? reference -> subsysnqn : DEFAULT_SUBSYSNQN );
@@ -1070,7 +1076,7 @@ static bool ctrl_config_match(const char *tag,
10701076 ctx = nvme_create_global_ctx (stdout , LOG_INFO );
10711077 assert (ctx );
10721078
1073- nvme_default_host (ctx , & h );
1079+ nvme_host_get (ctx , DEFAULT_HOSTNQN , DEFAULT_HOSTID , & h );
10741080 assert (h );
10751081
10761082 s = nvme_lookup_subsystem (h , DEFAULT_SUBSYSNAME , reference -> subsysnqn ? reference -> subsysnqn : DEFAULT_SUBSYSNQN );
0 commit comments