Skip to content

Commit dfb421a

Browse files
dwsuseigaw
authored andcommitted
nvme: allow to overwrite hostnqn and hostid
In order to be able to test the topology scan code, allow hostnqn and hostid to be controlled via an environment variable. This is just for testing purposes, thus don't mention it. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 11a0918 commit dfb421a

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/nvme/fabrics.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,11 +1416,21 @@ static char *nvmf_read_file(const char *f, int len)
14161416

14171417
char *nvmf_hostnqn_from_file()
14181418
{
1419+
char *hostnqn = getenv("LIBNVME_HOSTNQN");
1420+
1421+
if (hostnqn)
1422+
return strdup(hostnqn);
1423+
14191424
return nvmf_read_file(NVMF_HOSTNQN_FILE, NVMF_NQN_SIZE);
14201425
}
14211426

14221427
char *nvmf_hostid_from_file()
14231428
{
1429+
char *hostid = getenv("LIBNVME_HOSTID");
1430+
1431+
if (hostid)
1432+
return strdup(hostid);
1433+
14241434
return nvmf_read_file(NVMF_HOSTID_FILE, NVMF_HOSTID_SIZE);
14251435
}
14261436

0 commit comments

Comments
 (0)