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

Logical volumes with multiple extents report multiple times the same stripe size value #358

Open
jovandeginste opened this issue Nov 7, 2024 · 0 comments
Labels

Comments

@jovandeginste
Copy link

Describe the Bug

When you have a logical volume with more than one extent (eg when you resize it after adding another logical volume), the command to report the stripe size gives a number per extent. While this should be the same number, this is still giving extra output.

/Stage[main]/Logical_volume[datavg-test]/stripes 	stripes changed "2\n     2" to 2 (corrective)

Expected Behavior

If all numbers reported are the same, report only this single number

Steps to Reproduce

  1. create a logical volume "test"
lvcreate -n test --size 10G --stripes 2 datavg
lvs -o stripes --noheadings /dev/datavg/test
     2
  1. create a second logical volume
  2. extend the first logical volume
lvcreate -n test --size 10G --stripes 2 datavg
lvs -o stripes --noheadings /dev/datavg/test
     2
     2

Environment

  • Version: 2.3.0
  • Platform: AlmaLinux 9.4

Additional Context

Fixed with:

  def stripes
    # Run the lvs command with the -o option to get only the stripes count
    raw = (lvs '-o', 'stripes', '--noheadings', path)

    output_array = raw.split(/\n/).map(&:strip).to_i

    return output_array.first if output_array.uniq.length == 1

    output_array
  end

  def stripes=(new_stripes_count)
    current_stripes = stripes

    # Changing stripes is not supported for existing logical volumes
    return unless new_stripes_count.to_i != current_stripes
    raise(Puppet::Error, "Changing stripes from #{current_stripes} to #{new_stripes_count} is not supported for existing logical volumes")
  end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant