Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot use **readahead** option #57

Open
chrisduong opened this issue Jun 5, 2015 · 1 comment
Open

cannot use **readahead** option #57

chrisduong opened this issue Jun 5, 2015 · 1 comment

Comments

@chrisduong
Copy link

Hi,

I define an logical_volume as follow.

lvm_volume_group 'VG_01' do
  physical_volumes ['/dev/xvdf']

  logical_volume 'mongodb-data' do
    size        '100%VG'
    filesystem  'ext4'
    mount_point location: "#{node['mongodb']['config']['dbpath']}", options: 'defaults,auto,noatime,noexec'
    readahead 32
  end
end

But when chef run, it says No Method Error for NilClass

   ================================================================================
   Recipe Compile Error in /var/chef/cache/cookbooks/abcd/recipes/lvm_disks.rb
   ================================================================================

   NoMethodError
   -------------
   undefined method `join' for nil:NilClass

   Cookbook Trace:
   ---------------
     /var/chef/cache/cookbooks/lvm/libraries/resource_lvm_logical_volume.rb:237:in `readahead'
     /var/chef/cache/cookbooks/abcd/recipes/lvm_disks.rb:68:in `block (2 levels) in from_file'
     /var/chef/cache/cookbooks/lvm/libraries/resource_lvm_volume_group.rb:110:in `logical_volume'
     /var/chef/cache/cookbooks/abcd/recipes/lvm_disks.rb:64:in `block in from_file'
     /var/chef/cache/cookbooks/abcd/recipes/lvm_disks.rb:61:in `from_file'

   Relevant File Content:
   ----------------------
   /var/chef/cache/cookbooks/lvm/libraries/resource_lvm_logical_volume.rb:

   230:        # Attribute: readahead - the read ahead sector count of the logical volume
   231:        #
   232:        # @param arg [Integer, String] the read ahead sector count
   233:        #
   234:        # @return [Integer, String] the read ahead sector count
   235:        #
   236:        def readahead(arg = nil)
   237>>         set_or_return(
   238:            :readahead,
   239:            arg,
   240:            :kind_of => [Integer, String],
   241:            :equal_to => [2..120, 'auto', 'none'].flatten!
   242:          )
   243:        end
   244:
   245:        # Attribute: take_up_free_space - whether to have the LV take up the remainder of free space on the VG
   246:        #
@tas50 tas50 added the Type: Bug label Jan 4, 2017
@matthewpick
Copy link

This logic is definitely broken.

[2..120, 'auto', 'none'].flatten!

That should be:

[*2..120, 'auto', 'none']

However, why would there be an upper bound of 120 readahead size?
Or is this the sector count, where each sector is typically 512kb?

A regex of some sort would better fit this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants