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

Add a unique device identifier #1182

Conversation

vojtechtrefny
Copy link
Member

@vojtechtrefny vojtechtrefny commented Dec 5, 2023

The new device_id identifier is meant to be unique even for devices with the same name. The primary user for this will be Anaconda which needs an ID that will be a unique string stable between reset() calls.

The device ID looks as follows:

  • name for disks, partitions and loop devices
  • LVM-<name> for LVM VGs and LVs
  • BTRFS-<uuid>-<name> for btrfs volumes and subvolumes
  • STRATIS-<name> for Stratis devices
  • LUKS-<name> for LUKS mapped devices
  • MDRAID-<name> for MD arrays
  • DM-<name> for generic DM devices

Btrfs is currently the only device type that allows duplicate names for volumes so UUID is used for btrfs volumes. For other devices (LVM, MD...) the device name must be unique so we can use the name with technology prefix.

Currently device name is commonly used as a unique device
identifier both in blivet internally and in Anaconda. The problem
with this is that duplicate names are allowed in the system in
some cases -- btrfs names doesn't need to be unique and we can
also have two different devices with the same name if they use
different technologies (e.g. an LVM VG and MD array can share the
same name). The new "device_ID" parameter is designed to be usable
as a unique identifier and to be different for devices that share
the same name.

The device ID looks as follows:
- name for disks, partitions and loop devices
- LVM-<name> for LVM VGs and LVs
- BTRFS-<uuid>-<name> for btrfs volumes and subvolumes
- STRATIS-<name> for Stratis devices
- LUKS-<name> for LUKS mapped devices
- MDRAID-<name> for MD arrays
- DM-<name> for generic DM devices
We can now internally use the device_id instead of name when
getting device to be sure we will get the expected device a not a
different device with the same name.
@vojtechtrefny
Copy link
Member Author

Jenkins, test this please.

@vojtechtrefny vojtechtrefny force-pushed the 3.9-devel_unique-device-id branch from 3360d4a to 3e23729 Compare December 5, 2023 13:28
@vojtechtrefny vojtechtrefny marked this pull request as ready for review January 18, 2024 12:21
@vojtechtrefny vojtechtrefny merged commit 38f4b48 into storaged-project:3.9-devel Jan 19, 2024
7 checks passed
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

Successfully merging this pull request may close these issues.

1 participant