Skip to content

Commit

Permalink
nvme: allow to overwrite hostnqn and hostid
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
igaw committed Feb 2, 2024
1 parent 11a0918 commit dfb421a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/nvme/fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1416,11 +1416,21 @@ static char *nvmf_read_file(const char *f, int len)

char *nvmf_hostnqn_from_file()
{
char *hostnqn = getenv("LIBNVME_HOSTNQN");

if (hostnqn)
return strdup(hostnqn);

return nvmf_read_file(NVMF_HOSTNQN_FILE, NVMF_NQN_SIZE);
}

char *nvmf_hostid_from_file()
{
char *hostid = getenv("LIBNVME_HOSTID");

if (hostid)
return strdup(hostid);

return nvmf_read_file(NVMF_HOSTID_FILE, NVMF_HOSTID_SIZE);
}

Expand Down

0 comments on commit dfb421a

Please sign in to comment.