Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme connect will be failed if no /etc/nvme/hostnqn #1473

Closed
yizhanglinux opened this issue Apr 2, 2022 · 1 comment · Fixed by #1477
Closed

nvme connect will be failed if no /etc/nvme/hostnqn #1473

yizhanglinux opened this issue Apr 2, 2022 · 1 comment · Fixed by #1477

Comments

@yizhanglinux
Copy link
Contributor

Hello
With the latest nvme-cli, the nvme connect will be failed when there is no /etc/nvme/hostnqn, is that expected?
It works with the nvme-cli 1.x version.

if (!hostnqn)


$ git diff
diff --git a/fabrics.c b/fabrics.c
index ef80ec0..1f5460f 100644
--- a/fabrics.c
+++ b/fabrics.c
@@ -749,10 +749,14 @@ int nvmf_connect(const char *desc, int argc, char **argv)
 
        if (!hostnqn)
                hostnqn = hnqn = nvmf_hostnqn_from_file();
+       fprintf(stderr, "hnqn: %s\n", hnqn);
+       fprintf(stderr, "hostnqn: %s\n", hostnqn);
        if (!hostid)
                hostid = hid = nvmf_hostid_from_file();
        h = nvme_lookup_host(r, hostnqn, hostid);
        if (!h) {
+               fprintf(stderr, "nvme_lookup_host: failed: hnqn: %s\n", hnqn);
+               fprintf(stderr, "nvme_lookup_host: failed: hostnqn: %s\n", hostnqn);
                errno = ENOMEM;
                goto out_free;
        }
$ .build/nvme connect -t loop -n blktests-subsystem-1 
hnqn: (null)
hostnqn: (null)
nvme_lookup_host: failed: hnqn: (null)
nvme_lookup_host: failed: hostnqn: (null)
@igaw
Copy link
Collaborator

igaw commented Apr 4, 2022

I think the 1.x version called nvmf_hostnqn_file() -> hostnqn_read() which tried to read the hosnqn from /etc/nvme/hostnqn and if this failed it tried hostnqn_read_dmi and eventually hostnqn_generate_systemd as fallback. I think we could do the same approach here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants