puppetlabs/puppetlabs-lvm — pull request #91 by aronparsons (2014-12-23 20:43:39+00:00)
Title: size_is_minsize enhancements

These changes expose the size_is_minsize parameter in lvm::logical_volume and then actually make it usable by not triggering a resource chance on each run.

In the current code with size_is_minsize==true, each run will show changed resources for each filesystem that is larger than the configured size:
Notice: Compiled catalog for et-wks01.et.udev in environment production in 0.11 seconds
Info: Applying configuration version '1419367202'
Info: Logical_volume[test](provider=lvm): Logical volume already has minimum size of 3G (currently 4G)
Notice: /Stage[main]/Main/Lvm::Logical_volume[test]/Logical_volume[test]/size: size changed '4G' to '3G'
Notice: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]/ensure: ensure changed 'unmounted' to 'mounted'
Info: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]: Scheduling refresh of Mount[/test]
Info: Mount[/test](provider=parsed): Remounting
Notice: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]: Triggered 'refresh' from 1 events
Info: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]: Scheduling refresh of Mount[/test]
Notice: Finished catalog run in 0.66 seconds

This resolves that by moving some of that logic into the size() function, and then if necessary, lying about the current size so the change isn't triggered. Note the lack of the "Notice" resource with these patches applied and size_is_minsize==true:
Notice: Compiled catalog for et-wks01.et.udev in environment production in 0.13 seconds
Info: Applying configuration version '1419367342'
Info: Logical_volume[test](provider=lvm): Logical volume already has a minimum size of 3G (currently 4G)
Notice: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]/ensure: ensure changed 'unmounted' to 'mounted'
Info: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]: Scheduling refresh of Mount[/test]
Info: Mount[/test](provider=parsed): Remounting
Notice: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]: Triggered 'refresh' from 1 events
Info: /Stage[main]/Main/Lvm::Logical_volume[test]/Mount[/test]: Scheduling refresh of Mount[/test]
Notice: Finished catalog run in 0.67 seconds