storagetm: expose more useful metadata for nvme block devices

don't let the devices to be announced just as model "Linux". Let's instead
propagate the underlying block device's model. Also do something
reasonably smart for the serial and firmware version fields.
This commit is contained in:
Lennart Poettering
2023-11-13 19:32:34 +00:00
committed by Luca Boccassi
parent 842b06404f
commit abc19a6ffa
3 changed files with 162 additions and 7 deletions
+3 -3
View File
@@ -10,9 +10,9 @@ systemctl start sys-kernel-config.mount
dd if=/dev/urandom of=/var/tmp/storagetm.test bs=1024 count=10240
systemd-run -u teststoragetm.service -p Type=notify /usr/lib/systemd/systemd-storagetm /var/tmp/storagetm.test --nqn=quux
NVME_SERIAL="$(</sys/kernel/config/nvmet/subsystems/quux.storagetm.test/attr_serial)"
NVME_DEVICE="/dev/disk/by-id/nvme-Linux_${NVME_SERIAL:?}"
NVME_UUID="$(cat /proc/sys/kernel/random/uuid)"
systemd-run -u teststoragetm.service -p Type=notify -p "Environment=SYSTEMD_NVME_UUID=${NVME_UUID:?}" /usr/lib/systemd/systemd-storagetm /var/tmp/storagetm.test --nqn=quux
NVME_DEVICE="/dev/disk/by-id/nvme-uuid.${NVME_UUID:?}"
nvme connect-all -t tcp -a 127.0.0.1 -s 16858 --hostid="$(cat /proc/sys/kernel/random/uuid)"
udevadm wait --settle "$NVME_DEVICE"