Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fabrics: Always pass hostid and hostnqn
After the kernel commit ae8bd606e09b ("nvme-fabrics: prevent overriding of existing host"), kernel ensures hostid and hostnqn maintain 1:1 mapping. This makes 'nvme discover' and 'nvme connect' commands fail when providing only hostid or only hostnqn. This issue happens when the user only enters NQN which doesn't contain UUID, so the generation of the hostid fails. There are few more issues that this commit is fixing: - When the user provides hostid and NQN, the hostid is overridden by generating it from the NQN. - hostid is generated from the NQN file instead of the NQN that the user enters at the command line. - The warning "use generated hostid instead of hostid file" is wrong when the user provides hostid via the command line. The commit fixes those issues by doing the following logic: 1. If user provided both via command line - pass them as-is 2. If user doesn't enter them via command line - try to get them from files. 3. If one of them is not provided - generate it from the other. Use the new functions nvmf_hostid_generate() when NQN doesn't have UUID and use nvmf_hostnqn_generate_from_hostid(hostid) to generate hostnqn from hostid. 4. If user provided none - generate them both. Before this commit, nvme cli didn't do it. Signed-off-by: Israel Rukshin <[email protected]> Reviewed-by: Max Gurtovoy <[email protected]> Signed-off-by: Daniel Wagner <[email protected]>
- Loading branch information