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

hostnqn is not used from config.json file #1956

Closed
igaw opened this issue May 25, 2023 · 10 comments
Closed

hostnqn is not used from config.json file #1956

igaw opened this issue May 25, 2023 · 10 comments
Assignees
Milestone

Comments

@igaw
Copy link
Collaborator

igaw commented May 25, 2023

nvme connect-all will only use the hostnqn from /etc/nvme/hostnqn.

With given configuration nvme connect-all will not connect to anything:

# cat /etc/nvme/hostnqn
nqn.2014-08.org.nvmexpress:uuid:31333937-3136-584d-5135-323430365637
# cat config.json 
[
  {
    "hostnqn":"nqn.2014-08.org.nvmexpress:uuid:1a9e23dd-466e-45ca-9f43-a29aaf47cb21",
    "hostid":"1a9e23dd-466e-45ca-9f43-a29aaf47cb21",
   ...
  }
]

Only if we provide the hostnqn and hostid it will connect:

# nvme connect-all --hostnqn nqn.2014-08.org.nvmexpress:uuid:1a9e23dd-466e-45ca-9f43-a29aaf47cb21 --hostid 1a9e23dd-466e-45ca-9f43-a29aaf47cb21

I am not sure if this is the desired behavior. What do people expect with such a configuration?

@igaw igaw added the question label May 25, 2023
@igaw
Copy link
Collaborator Author

igaw commented May 25, 2023

@johnmeneghini
Copy link
Contributor

I am not sure if this is the desired behavior. What do people expect with such a configuration?

nvme-cli has always taken the host-nqn and hostid from /etc/nvme/hostnqn and /etc/nvme/hostid and historically users were not required to add either one to the command line. My preferred way to handle this problem would be:

  1. take host-nqn and hostid from /etc/nvme files
  2. override host-nqn or hostid with values from discovery.conf
  3. override host-nqn or hostid with values from json.config
  4. override host-nqn or hostid with values from the command line

I think this would provide a fully backwards compatible method of supporting the previous precedence.

@igaw
Copy link
Collaborator Author

igaw commented May 26, 2023

Make sense to me.

BTW, should we insist on that the user providing both hostnqn and hostid on the command line?

The current code expects that the user provides both. And with the recent discussion/decision upstream on this topic, newer kernel will only allow a 1:1 mapping. So should we be smart here as well and warn if they do not match and if only hostnqn is provided we figure out hostid?

@martin-gpy
Copy link
Contributor

I think this would provide a fully backwards compatible method of supporting the previous precedence.

Yes, this approach looks good.

@martin-gpy
Copy link
Contributor

BTW, should we insist on that the user providing both hostnqn and hostid on the command line?

I think hostnqn alone is sufficient. Honestly it would be an overkill if we insist on both hostnqn and hostid here.

The current code expects that the user provides both. And with the recent discussion/decision upstream on this topic, newer kernel will only allow a 1:1 mapping. So should we be smart here as well and warn if they do not match and if only hostnqn is provided we figure out hostid?

I think so yes. We should able to warn if they don't match. And figure out hostid when only hostnqn is provided.

@hreinecke
Copy link
Collaborator

hostid is only used for reservations, and really should not be of a concern here. IE we should only be using hostnqn as an identifier for the host itself, and allow the hostid to change.

@johnmeneghini
Copy link
Contributor

johnmeneghini commented May 30, 2023 via email

@igaw
Copy link
Collaborator Author

igaw commented Jun 1, 2023

Thanks for the feedback. Highly appreciated!

@igaw igaw added enhancement and removed question labels Jun 1, 2023
@igaw igaw self-assigned this Jun 1, 2023
@igaw igaw added this to the 2.6 milestone Jun 30, 2023
@igaw igaw modified the milestones: 2.6, 2.10 Jul 3, 2024
@igaw
Copy link
Collaborator Author

igaw commented Jul 3, 2024

There is also a related problem. The connect-all command will only connect all controllers from one (first) host defined in the JSON config file.

@igaw
Copy link
Collaborator Author

igaw commented Jul 12, 2024

Merged #2394. I've added a few unit tests to make sure I don't break anything. Anyway, please give it a run and see if there are any regressions. Thanks.

@igaw igaw closed this as completed Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants