-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
udev: refactor ActionHandler to get BD name on remove
On a remove event, the current implementation is unable to log the name of the BD being removed, because it tries to get device information by checking /sys/class/block/... and /var/run/udev/data/... but the device is gone, so that information is no longer present. This also results in some annoying (but harmless) errors in the log: ``` WARNING: failed to read int from file: open /sys/block/sda/queue/rotational: no such file or directory time="2024-07-16T12:21:55Z" level=info msg="Wake up scanner with remove operation with blockdevice: " time="2024-07-16T12:21:55Z" level=info msg="scanner waked up, do scan..." WARNING: failed to read disk partitions: open /sys/block/sda: no such file or directory time="2024-07-16T12:21:55Z" level=info msg="Waiting new event to trigger..." ``` This commit picks up device information from the udev event instead, so we're able to avoid those errors and correctly determine the BD name to log when the device is removed. So now we get: ``` time="2024-07-16T12:35:14Z" level=info msg="Wake up scanner with remove operation with blockdevice: b3270eab097d4515bac2d595665ac618, device: /dev/sda" time="2024-07-16T12:35:14Z" level=info msg="scanner waked up, do scan..." time="2024-07-16T12:35:14Z" level=info msg="Waiting new event to trigger..." ``` Signed-off-by: Tim Serong <tserong@suse.com>
- Loading branch information
1 parent
fe39ab8
commit 7471856
Showing
2 changed files
with
45 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters