puppet-glusterfs icon indicating copy to clipboard operation
puppet-glusterfs copied to clipboard

Client template io-cache cache size option generator does not work.

Open tomoconnor opened this issue 15 years ago • 1 comments

Great module, apart from this! I've included a fix of some sort Line 40: option cache-size grep 'MemTotal' /proc/meminfo | awk '{print $2 * 0.2 / 1024}' | cut -f1 -d.MB This does not actually work, and just squirts the grep line as-is, into the config file. It works, but has no effect. Replace it with the pure erb, however, and it has the correct effect.: option cache-size <%= (memorysize.to_i*0.2).floor %>MB

HTH

tomoconnor avatar Jan 07 '11 12:01 tomoconnor

It's strange that the backticks would stop working. To be honest I haven't used GlusterFS or Puppet in a while.

I did however dig into using the memorysize fact from facter and discovered that it returns a value in GB.

irb> require 'facter'
irb> memorysize = 0
irb> Facter.each{ |k,v| memorysize = v if k =~ /memorysize/ }
irb> memorysize #=> "7.81 GB"

So using your suggested (memorysize.to_i*0.2).floor returns a value in GB:

irb> (memorysize.to_i*0.2).floor #=> 1

I think we should use to_f and then multiply by 1024 to get the correct number in MB:

irb> (memorysize.to_f*1024*0.2).floor #=> 1599

I will be honest though, I did not test this in Puppet itself so maybe the memorysize variable is different there.

Could you test and let me know the outcome? I have moved all of my servers over to Chef so I don't have any Puppet'd servers to test on.

tjwallace avatar Jan 07 '11 16:01 tjwallace