tinkerbell / hook

In-memory Operating System Installation Environment for Executing Tinkerbell Workflows
Apache License 2.0
107 stars 52 forks source link

Porting `persistent-storage.sh` to Golang? #250

Open s3rj1k opened 5 days ago

s3rj1k commented 5 days ago

Was wondering if in case someone proposes a PR with a port of hook-mdev/persistent-storage.sh to Golang, will it be considered?

rpardini commented 4 days ago

Hey @s3rj1k, I wrote that, trying to emulate systemd udev, so in a good day, one could use a by-id entry obtained on a systemd-based OS in HookOS (Alpine).

I wouldn't be against porting it, but I do have to warn that the reference implementation should be systemd udev, not this bash script. Also, what is to be gained from the port?

Thanks

s3rj1k commented 4 days ago

reference implementation should be systemd udev

udev is very shifty, rules change a lot and there are a lot of cases that are out of scope for general plain disk discovery

what is to be gained from the port?

to establish baseline code that can be extendable and covered by unit-tests

by-id

Is also an udev construct that does not really relate to real serial number of device (I agree that it should be emulated)

rpardini commented 4 days ago

by-id

Is also an udev construct that does not really relate to real serial number of device (I agree that it should be emulated)

HW makers have some very creative (and dubious) ideas when setting their serial numbers. Eg embedding nulls, or worse, embedding literal backslash-zero's in serial numbers; systemd-udev handles those specially.

My use-case here is getting my hands on a machine running some systemd OS, looking into /dev/disk/by-id there and being able to use that to provision one specific disk with Tinkerbell while being 100% sure the other disks won't be touched.