d5cfaed7d4
A forthcoming profile needs to set the I/O scheduler to noop/none on the disks backing ceph OSDs, so Puppet must know which block devices those are. This fact surfaces them by inspecting LVM PVs whose volume group belongs to ceph. - add ceph_osd_devices fact returning the sorted array of PV device paths whose VG name starts with ceph- - confine the fact to physical Linux hosts with pvs installed so it never resolves on VMs https://claude.ai/code/session_01JUoARVdmhxKQHyyyp1pxeT Reviewed-on: #504 Co-authored-by: Ben Vincent <ben@unkin.net> Co-committed-by: Ben Vincent <ben@unkin.net>
24 lines
564 B
Ruby
24 lines
564 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'facter'
|
|
|
|
Facter.add(:ceph_osd_devices) do
|
|
confine kernel: 'Linux'
|
|
confine { Facter.value(:is_virtual) == false }
|
|
confine { Facter::Core::Execution.which('pvs') }
|
|
setcode do
|
|
devices = []
|
|
output = Facter::Core::Execution.execute(
|
|
'pvs --noheadings -o pv_name,vg_name 2>/dev/null',
|
|
on_fail: nil
|
|
)
|
|
output&.each_line do |line|
|
|
pv_name, vg_name = line.split
|
|
next unless pv_name && vg_name
|
|
|
|
devices << pv_name if vg_name.start_with?('ceph-')
|
|
end
|
|
devices.sort
|
|
end
|
|
end
|