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

fix: ensure machine-id, initiatorname.iscsi and host{id,nqn} are unique (backport #190) #191

Merged
merged 1 commit into from
Feb 19, 2025

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Feb 18, 2025

Our OS image includes /etc/machine-id, /etc/iscsi/initiatorname.iscsi, /etc/nvme/hostid and /etc/nvme/hostnqn. This means that those files will be identical on every single Harvester node installed from a given ISO image. This is wrong.

/etc/machine-id is meant to be unique per host, see e.g.:

https://manpages.opensuse.org/Tumbleweed/systemd/machine-id.5.en.html

Likewise, the iSCSI initiator name and NVMe hostid/hostnqn need to be unique when accessing external storage via iSCSI or NVMe over fabrics.

This commit removes those files from the OS image, and adds commands to 00_rootfs.yaml to generate /etc/iscsi/initiatorname.iscsi, /etc/nvme/hostid and /etc/nvme/hostnqn at boot time, if those files don't already exist (which they won't, on first boot - after that the generated content will persist). /etc/machine-id generation is handled automatically by systemd and its persistence is already covered by existing code in 00_rootfs.yaml.

Related issue: harvester/harvester#6911

Note that this also requires harvester/harvester-installer#984 in order to work correctly (see that PR for the test plan).


This is an automatic backport of pull request #190 done by Mergify.

Our OS image includes /etc/machine-id, /etc/iscsi/initiatorname.iscsi,
/etc/nvme/hostid and /etc/nvme/hostnqn.  This means that those files
will be identical on every single Harvester node installed from a given
ISO image.  This is wrong.

/etc/machine-id is meant to be unique per host, see e.g.:

https://manpages.opensuse.org/Tumbleweed/systemd/machine-id.5.en.html

Likewise, the iSCSI initiator name and NVMe hostid/hostnqn need to be
unique when accessing external storage via iSCSI or NVMe over fabrics.

This commit removes those files from the OS image, and adds commands
to 00_rootfs.yaml to generate /etc/iscsi/initiatorname.iscsi,
/etc/nvme/hostid and /etc/nvme/hostnqn at boot time, if those files
don't already exist (which they won't, on first boot - after that
the generated content will persist).  /etc/machine-id generation is
handled automatically by systemd and its persistence is already
covered by existing code in 00_rootfs.yaml.

Related issue: harvester/harvester#6911

Signed-off-by: Tim Serong <[email protected]>
(cherry picked from commit a9223b5)
@tserong tserong merged commit 447f074 into harvester-v1.5.x Feb 19, 2025
2 checks passed
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 this pull request may close these issues.

3 participants