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

udev: disks used as LVM PV no longer show the disk model in ID_MODEL but LVM PV information instead #21

Closed
emmericp opened this issue Jul 4, 2019 · 2 comments

Comments

@emmericp
Copy link

emmericp commented Jul 4, 2019

$ udevadm info /dev/sdX
E: ID_MODEL=LVM PV vBAYkl-gxgV-AZ2n-pgix-pI6y-6cTD-PUxl4C on /dev/sdc
E: ID_MODEL_ENC=WDC\x20WD3000BLFS-01YBU0\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20

It was much more helpful to show the actual disk model in ID_MODEL. Also, I'd expect ID_MODEL == trim(decode(ID_MODEL_ENC))

Introduced here: 99bfbbf

Which I guess is somewhat intentional because it explicitly sets ID_MODEL, but the commit mentions "This patch introduces no functional change to the udev rules."

See also: systemd/systemd#12947

@prajnoha
Copy link
Member

prajnoha commented Jul 4, 2019

The ENV{ID_MODEL} assignment for disks which are PVs is quite old, it goes back to the early versions of lvm-systemd-udev interaction and introduced with the patch 3fee661 (~ 6 years ago).

This was done for the messages in the logs to be more informative and straightforward to search PVs:

#systemctl -a | grep "LVM PV"
  dev-block-252:2.device                                                                                         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2        
  dev-disk-by\x2did-lvm\x2dpv\x2duuid\x2dJhxC7B\x2dYTgk\x2d3jIU\x2d5GVo\x2dc4gV\x2dW8t3\x2dUUz06p.device         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2      

But I think we can live without that and we can remove the ID_MODEL part so we don't overwrite the actual ID_MODEL if it exists. There's also the /dev/disk/by-id entry for each PV anyway as seen from the example above...

Patched with commit fef8e50 (master branch) and commit 1650c10 (stable-2.02 branch).

@prajnoha prajnoha closed this as completed Jul 4, 2019
@emmericp
Copy link
Author

emmericp commented Jul 4, 2019

thanks for the quick fix :)

tasleson pushed a commit that referenced this issue Jul 18, 2019
We've been assigning this in 69-dm-lvm-metad.rules:

  ENV{ID_MODEL}="LVM PV $env{ID_FS_UUID_ENC} on /dev/$name"

This was for the description to appear for each systemd device
unit representing this device, for example:

  $systemctl -a | grep "LVM PV"
  dev-block-252:2.device                                                                                         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2
  dev-disk-by\x2did-lvm\x2dpv\x2duuid\x2dJhxC7B\x2dYTgk\x2d3jIU\x2d5GVo\x2dc4gV\x2dW8t3\x2dUUz06p.device         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2
  ...

However, there could be an actual ID_MODEL that people are interested in
more than the fact that this is an LVM PV and so we shouldn't overwrite
the value.

Also, we already have a symlink /dev/disk/by-id/lvm-pv-uuid-<PV_UUID>
created which is then reflected as device unit (all device's symlinks
have systemd device unit representation) so we can still reach this
information in systemd unit listings even without setting the ID_MODEL.

Reported here: #21
csonto pushed a commit that referenced this issue Aug 27, 2019
We've been assigning this in 69-dm-lvm-metad.rules:

  ENV{ID_MODEL}="LVM PV $env{ID_FS_UUID_ENC} on /dev/$name"

This was for the description to appear for each systemd device
unit representing this device, for example:

  $systemctl -a | grep "LVM PV"
  dev-block-252:2.device                                                                                         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2
  dev-disk-by\x2did-lvm\x2dpv\x2duuid\x2dJhxC7B\x2dYTgk\x2d3jIU\x2d5GVo\x2dc4gV\x2dW8t3\x2dUUz06p.device         loaded    active   plugged   LVM PV JhxC7B-YTgk-3jIU-5GVo-c4gV-W8t3-UUz06p on /dev/vda2 2
  ...

However, there could be an actual ID_MODEL that people are interested in
more than the fact that this is an LVM PV and so we shouldn't overwrite
the value.

Also, we already have a symlink /dev/disk/by-id/lvm-pv-uuid-<PV_UUID>
created which is then reflected as device unit (all device's symlinks
have systemd device unit representation) so we can still reach this
information in systemd unit listings even without setting the ID_MODEL.

Reported here: #21
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

No branches or pull requests

2 participants