-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Plumb ZPOOL_CONFIG_PHYS_PATH and ZPOOL_CONFIG_DEVID into vdev label #3978
Comments
Would there be any value in also storing the transient names in a separate field on the label? |
@ilovezfs Are you thinking of an additional field besides the stock 4 (“path”, “devid”, “phys_path” and “fru”)? If so, who would consume it if it was stored in the label? Just wondering what the use case would be. The |
I was thinking about it as a string to grep for in the logs, and as a match to the entries in zpool status for users that do use /dev. Would one of the stock four still match the zpool status entries when the pool has been imported -d /dev? (Of course, one downside to maintaining the transient names in any way is that it would mean dirtying the labels on import/boot just due to the transient names' changing in order to keep the information on the label current.) |
Initial prototype for plumbing in
tested with sata, scsi and usb devices |
@don-brady Very cool. Does it happen to get usable paths for virtual devices that get treated as whole_disk=0 like LUKS, LVM, loopback, md, etc.? https://github.com/zfsonlinux/zfs/blob/master/lib/libefi/rdwr_efi.c#L182-L240 |
@don-brady this sounds like a entirely reasonable approach to me. I can't think of any reason not to store the mapping you're proposing. |
In the ZFS vdev label, ZFS uses the
ZPOOL_CONFIG_DEVID
identifier to refer to a persistent name for the disk and theZPOOL_CONFIG_PHYS_PATH
location to refer to the actual location of the disk on the system.illumos example:
path: '/dev/dsk/c0t1d0s0’
devid: 'id1,sd@SATA_____Hitachi_HDS72101______JP2940HZ3H74MC/a'
phys_path: '/pci@0,0/pci103c,1609@11/disk@1,0:a'
I’m in the process of implementing the auto-{expand, online, replace} functionality in zfsonlinux when a device add event occurs (hot plug). This logic requires being able to reliably match a vdev by identifier or by location for the disk add event. On Linux, it seems the tail element of
"/dev/disk/by-id/<bus-disk-identifier>"
maps perfectly for aZPOOL_CONFIG_DEVID
. And the tail element of"/dev/disk/by-path/<path>"
maps to aZPOOL_CONFIG_PHYS_PATH
. Linux currently only uses theZPOOL_CONFIG_PATH
in the vdev label. This path is not normalized and can sometimes refer to the non-persistent/dev/sd[a-z]
device names.Linux example:
For a typical SAS HBA with a sata backplane, we see something like:
/dev/sdi1
/dev/disk/by-id/ata-ST3500418AS_9VMGAJ49-part1
/dev/disk/by-path/pci-0000:04:00.0-sas-0x4433221107000000-lun-0-part1
Which could map as follows:
path: '/dev/disk/by-id/ata-ST3500418AS_9VMGAJ49-part1'
devid: 'ata-ST3500418AS_9VMGAJ49-part1'
phys_path: 'pci-0000:04:00.0-sas-0x4433221107000000-lun-0-part1'
The libudev event reporting mechanism provides the by-id and by-path properties (when the device is on a bus like ata or scsi). I’d like to propose backing
ZPOOL_CONFIG_DEVID
andZPOOL_CONFIG_PHYS_PATH
with actual values (when available) so that auto-{expand, online, replace} can work as it does on illumos. These additional device values can also help when logging data (e.g. zpool history and zpool events).Is there any objection to using the above mappings in zfsonlinux (when they exist)? The existing use of
ZPOOL_CONFIG_PATH
can remain intact and still be used forvdev_open
and what gets displayed when listing a pool config.The text was updated successfully, but these errors were encountered: