From bc61411d5d1fba2758df08c5008bc0242433815c Mon Sep 17 00:00:00 2001 From: Andrew Woodward Date: Tue, 14 Oct 2014 14:37:28 -0700 Subject: [PATCH] Add support for cciss p seperator in ceph-osd fact the facter code was subsituting the ! in the cciss device, but had forgotten about the p seperator between the device and partation number. the patch adds the p seperator if the ! is matched in the gsub to the remaining locations that would need the p seperator to properly refrence devices. Change-Id: I5054cde345495b62fa66f3ae3876fc6eb098cc5c Closes-bug: 1381218 --- deployment/puppet/ceph/lib/facter/ceph_osd.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/deployment/puppet/ceph/lib/facter/ceph_osd.rb b/deployment/puppet/ceph/lib/facter/ceph_osd.rb index 5639d9be83..bf76eb10e7 100644 --- a/deployment/puppet/ceph/lib/facter/ceph_osd.rb +++ b/deployment/puppet/ceph/lib/facter/ceph_osd.rb @@ -9,19 +9,24 @@ Facter.add("osd_devices_list") do devs.each { |d| # lsblk returns cciss devices as cciss!c0d0p1. The entries # in /dev are cciss/c0d0p1 - d.gsub!(/!/, '/') - parts = %x{ls /dev/#{d}?*}.gsub("/dev/#{d}","").split("\n") + if d.gsub!(/!/, '/') + sep = 'p' + else + sep = '' + end + device = "/dev/#{d}#{sep}" + parts = %x{ls /dev/#{d}?*}.gsub(device,"").split("\n") parts.each { |p| code = %x{sgdisk -i #{p} /dev/#{d} | grep "Partition GUID code" | awk '{print $4}'}.strip() case code when "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D" # Only use unmounted devices - if %x{grep -c /dev/#{d}#{p} /proc/mounts}.to_i == 0 - osds << "/dev/#{d}#{p}" + if %x{grep -c #{device}#{p} /proc/mounts}.to_i == 0 + osds << "#{device}#{p}" end when "45B0969E-9B03-4F30-B4C6-B4B80CEFF106" - if %x{grep -c /dev/#{d}#{p} /proc/mounts}.to_i == 0 - journals << "/dev/#{d}#{p}" + if %x{grep -c #{device}#{p} /proc/mounts}.to_i == 0 + journals << "#{device}#{p}" end end } @@ -41,4 +46,4 @@ Facter.add("osd_devices_list") do end output.join(" ") end -end +end \ No newline at end of file