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

Add support for thin provisioning and setting poolmetadatasize #154

Merged
merged 10 commits into from Sep 28, 2016

Conversation

afalko
Copy link
Contributor

@afalko afalko commented Jun 17, 2016

No description provided.

@@ -110,7 +115,14 @@ def create
args.push('--type', @resource[:type])
end

args << @resource[:volume_group]
if @resource[:thin]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if @resource[:thin] is :false or 'false' then this will be truthy. The type should either munge or only accept literal true and false values.

This commit fixes the comments raised in PR/154 and adds testing and
documentation;

* Inherit the thin attribute from Puppet::Parameter::Boolean
* Conditionally add -n flag to provider args rather than drop later
* Fixed hard tab spaces in provider
* Added documentation for new attributes
* Added rspec tests
@crayfishx
Copy link
Contributor

@afalko : I've addressed the point made by @hunner , made some other tweaks and added tests and documentation. I've raised this as a PR against your branch.... afalko#1

... yep, a PR to a PR, github is sweet.

@afalko Can you review and merge the above PR and then it should make it through to this one - we are keen to see this PR merged.

Thanks!

Additional fixes and testing/docs
Copy link
Contributor

@crayfishx crayfishx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.... @hunner ?

@crayfishx
Copy link
Contributor

Before merging this, @afalko can you take a look at afalko#2 - I think we need this otherwise there is no way of configuring thinpools from hiera...etc.

Copy link

@vinzent vinzent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and I think for --thin you cant pass --extents or -L and you are required to pass --virtualsize

end

newparam(:poolmetadatasize) do
desc "Change the size of logical volume pool metadata"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is only used in the creat method. so it is not possible to change it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - lvresize does support this so it can be added easily enough

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary from IRC discussion: This is better documented and changed to a property in the future.

args << @resource[:volume_group]
if @resource[:thin]
args.push('--thin')
args << @resource[:volume_group] + "/" + @resource[:name]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according lvcreate --help the syntax is lvceate ... --thin VolumeGroupName/PoolLogicalVolume the :name here is IMO the name of the lv to be created not the pool lv.

the -n (--name) is IMO still required and should be set to :name

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this..... I'll test it

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as you quoted from the man page. --thin seems to have multiple outcomes. but there is --thinpool too. for me it seems like --thinpool was introduced later to be specific what happens.

desc "Change the size of logical volume pool metadata"
validate do |value|
unless value =~ /^[0-9]+(\.[0-9]+)?[KMGTPE]/i
raise ArgumentError , "#{value} is not a valid logical volume size"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong error text

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change that, well spotted.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed in afalko#2

@crayfishx
Copy link
Contributor

@vinzent your first point about --extents, you can use it, in fact that's how I tested it.... from the lvcreate manpage....

Specifying the optional argument --size or --extents will cause the creation of the thin pool logical volume. Specifying the optional argument --virtualsize will cause the creation of the thin logical volume from given thin pool volume. Specifying both arguments will cause the creation of both thin pool and thin volume using this pool.

@vinzent
Copy link

vinzent commented Sep 21, 2016

@crayfishx
Copy link
Contributor

@afalko @vinzent FYI

@vinzent and I had a long discussion on this over IRC - I'll summarize here...

The terminology and documentation around thin pools and thin pool volumes (which are different things but both are logical volumes) is confusing. This PR enables the creation of thin pools. What it doesn't do is allow you to create thin pool volumes inside this thin pool. For that reason, and after a discussion about some future work that will be raised in separate tickets, we've changed the attribute thin to thinpool to imply the creation of a thin pool.

So currently, to create a thin pool you declare

# Create a thin pool
logical_volume { 'blah':
  volume_group => 'foo',
  thinpool => true,
}

The logic behind this is that we would (in a future PR) introduce the thin parameter to add functionality to create thin volumes within this pool, something like;

# Create a thin pool *volume*
logical_volume { 'mythinvol':
  thin => true,
  pool => 'blah',
}

I think I've summarized that properly!

The changes reflecting this are in a PR to this PR (afalko#2) - if you are happy with the above @afalko could you please merge that into this PR?

We'll create issues separate to this PR capturing:

  • Creation of thin pool volumes
  • Changing poolmetadatasize into a configurable property rather than a parameter

@afalko
Copy link
Contributor Author

afalko commented Sep 21, 2016

@vinzent @crayfishx : I've resolved the merge conflicts.

@crayfishx
Copy link
Contributor

Oops - minor mistake caught by travis - @afalko if you can update this PR with afalko#3 we should be good!

@@ -1,3 +1,5 @@
require 'puppet/parameter/boolean'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added in puppet 3.3.0 so the version in metadata should be bumped.

* readahead (Parameter) - The readahead count to use for the new logical volume.
* region_size (Parameter) - A mirror is divided into regions of this size (in MB), the mirror log uses this granularity to track which regions are in sync. CAN NOT BE CHANGED on already mirrored volume. Take your mirror size in terabytes and round up that number to the next power of 2, using that number as the -R argument.
* size (Property) - The size of the logical volume. Set to undef to use all available space
* size_is_minsize (Parameter) Default value: `:false` - Set to true if the ‘size’ parameter specified, is just the minimum size you need (if the LV found is larger then the size requests this is just logged not causing a FAIL)
* stripes (Parameter) - The number of stripes to allocate for the new logical volume.
* stripesize (Parameter) - The stripesize to use for the new logical volume.
* thinpool (Parameter) - Default value: `:false` - Set to true to create a thin pool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/:false/false/

@hunner
Copy link
Contributor

hunner commented Sep 28, 2016

@crayfishx will fix in follow-up PR

@hunner hunner merged commit 8bb29fd into puppetlabs:master Sep 28, 2016
@unixsanet
Copy link

Just updated my environment to use LVM-0.8.0 and it appears to be incompatible with Satellite 6.1 and using Smart Class Parameter. This code worked with 0.7.0:

oraclevg:
  physical_volumes:
  - /dev/sdb
  logical_volumes:
    lvd01:
      size: 24.99G
      mountpath: /d01

but fails with 0.8.0 with the following error:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter thinpool on Logical_volume[lvd01] at /etc/puppet/environments/production/modules/lvm/manifests/logical_volume.pp:99

@vinzent
Copy link

vinzent commented Jan 4, 2017

@unixsanet you're probably facing the longstanding environment isolation problem with ruby types. See https://docs.puppet.com/puppet/latest/environment_isolation.html . If you have multiple environments with different versions of the same ruby types you'll can get into troubles like this.

@walkamongus
Copy link

@unixsanet I ran into the exact same issue and a restart of puppetserver on the affected master resolved it.

cegeka-jenkins pushed a commit to cegeka/puppet-lvm that referenced this pull request Oct 23, 2017
…tlabs#154)

* Add support for thin provisioning and setting poolmetadatasize

* Additional fixes and testing/docs

This commit fixes the comments raised in PR/154 and adds testing and
documentation;

* Inherit the thin attribute from Puppet::Parameter::Boolean
* Conditionally add -n flag to provider args rather than drop later
* Fixed hard tab spaces in provider
* Added documentation for new attributes
* Added rspec tests

* added thin and poolmetadatasize to lvm::volume_group defined type

* Changed thin attribute to thinpool

* changed error message for poolmetadatasize validation

* Document that poolmetadatasize currently only sets on creation

* changed $thin to $thinpool, ommitted after attribute rename (#3)
@tenajsystems
Copy link

I was following this PR and was not sure if the PR for creating thin pool volumes(thin-provisioned lv) like the example @crayfishx gave like below or #159. I do know that creating a thin pool was implemented in the PR but want to know if thin pool volumes was also implemented. Could someone please confirm this for me?

# Create a thin pool
logical_volume { 'blah':
volume_group => 'foo',
thinpool => true,
}

# Create a thin pool *volume*
logical_volume { 'mythinvol':
thin => true,
pool => 'blah',
}

Thanks.

@tenajsystems
Copy link

It appears the thinpool => true, doesn't work. I have setup the below and manually trying to create a thin LV using the command lvcreate -V 50GB -T vg-gluster/data -n Test and I get this message: Logical volume vg-gluster/data is not a thin pool

# Create a thin pool
logical_volume { 'blah':
volume_group => 'foo',
thinpool => true,
}

What I'm I doing wrong?

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

Successfully merging this pull request may close these issues.

None yet

8 participants