Description
Describe the Bug
When managing a zpool using the /dev/disk/by-id/
path for it's members Puppet constantly wants to change the disks to the /dev/sd*
variants.
I believe the issue stems from this block of code:
puppetlabs-zfs_core/lib/puppet/provider/zpool/zpool.rb
Lines 46 to 51 in e86ba8f
The issue being that lsblk
returns the path of /dev/sd*
as opposed to the /dev/disk/by-id
path.
It seems this was originally done to stop partitions being used instead of disks but perhaps using some regex and stripping away the -part\n
would be a simpler solution?
Expected Behavior
Puppet does not want to adjust the zpool members
Steps to Reproduce
Assuming we have 2 disks we want to mirror /dev/sdb
at /dev/disk/by-id/my-disk-SN1234
and /dev/sdc
at /dev/disk/by-id/my-disk-SN5678
zpool { 'myPool':
ensure => 'present'
mirror => ['dev/disk/by-id/my-disk-SN1234 /dev/disk/by-id/my-disk-SN5678'],
}
First run should apply correctly and the pool will be created with the correct members, on subsequent runs Puppet will constantly want to change the members to ['/dev/sdb /dev/sdc']
Environment
- Puppet Agent: 7.31.0
- Module version: 1.6.1
- Debian 12 Bookworm
Additional Context
There is a workaround - declare the Zpool with the /dev/disk/by-id
path, then once the pool has been created swap out the paths to their /dev/sd*
counterparts. However this is not a particularly good workaround due to the below.
It's generally considered best practice with ZOL to use the by-id
path for disks when declaring Zpool members rather than the /dev/sd*
as the latter can change on reboots especially with hardware changes. (ZFS does actually seem to handle this these days)
As a real-world example we recently swapped out a pair of hard drives in one of our servers, this caused almost all of the other drives to swap around (I believe the /dev/sd*
labels get applied as the disks become available) this caused Puppet to get very confused and want to swap all the disks around until we re-jigged our definitions.