fuel-library/deployment/puppet/nailgun/lib/facter/iops.rb
Matthew Mosesohn 26b55bc341 Add iops fact and add it to astute
Astute needs to know how many nodes can
be provisioned at a time, based on IOPS.

Change-Id: If2cf35ac8195baf37cda50564b70ba3db836ccea
Partial-Bug: #1355347
2014-08-13 19:57:39 +04:00

16 lines
394 B
Ruby

require 'facter'
# Requires sysstat package on Ubuntu and CentOS
# Fact iops totals tps values from iostat
Facter.add('iops') do
confine :kernel => :linux
str = Facter::Util::Resolution.exec("iostat | grep -v 'dm-'" \
" | awk '{print $2}'")
iops = 0
str.split("\n").each do |iops_val|
iops = iops + iops_val.to_f
end
setcode { iops }
end