mrrl-mdev-conf

mdevd configuration for mrrl; fork of Alpine's mdev-conf
git clone https://ccx.te2000.cz/git/mrrl-mdev-conf
Log | Files | Refs | README | LICENSE

commit a21d1053dd5ca37538b0435d66c58a30cb273658
parent 2a262eb11b71986d7cc1e44e389ec18f881c7253
Author: Alex Denes <caskd@redxen.eu>
Date:   Sat,  3 Jun 2023 14:10:39 +0000

persistent-storage: handle virtio-blk

Virtio-BLK doesn't provide the serial attached to a device but to the
block itself, handle the special case

Diffstat:
Mpersistent-storage | 2++
Mtests/persistent-storage_test | 8++++----
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/persistent-storage b/persistent-storage @@ -61,6 +61,8 @@ fi model=$(sanitise_file "$SYSFS/class/block/$_check_dev/device/model") name=$(sanitise_file "$SYSFS/class/block/$_check_dev/device/name") serial=$(sanitise_file "$SYSFS/class/block/$_check_dev/device/serial") +# Special case where block devices have serials attached to the block itself, like virtio-blk +: ${serial:=$(sanitise_file "$SYSFS/class/block/$_check_dev/serial")} wwid=$(sanitise_file "$SYSFS/class/block/$_check_dev/wwid") : ${wwid:=$(sanitise_file "$SYSFS/class/block/$_check_dev/device/wwid")} diff --git a/tests/persistent-storage_test b/tests/persistent-storage_test @@ -8,7 +8,7 @@ init_tests \ persistent_storage_sda_wwid \ persistent_storage_sda_wwid_partition_symlink \ persistent_storage_nvme_model_serial \ - persistent_storage_virtio_serial \ + persistent_storage_virtio_blk_serial \ persistent_storage_block \ persistent_storage_by_label \ persistent_storage_by_partlabel \ @@ -122,9 +122,9 @@ persistent_storage_nvme_model_serial_body() { readlink disk/by-id/nvme-Samsung_SSD_960_EVO_500GB_S3EUNX0HB01245Y } -persistent_storage_virtio_serial_body() { - mkdir -p sys/class/block/vda/device - echo 'foobar' > sys/class/block/vda/device/serial +persistent_storage_virtio_blk_serial_body() { + mkdir -p sys/class/block/vda + echo 'foobar' > sys/class/block/vda/serial MDEV=vda ACTION=add atf_check \ sh $mdevscript