(logical_volume) Fix regex on new_size and coerce to float instead of int #123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The size property allows floating point values, but in the provider we
coerce the size string reported by lvm to an int, effectively
ignoring the decimal part at resize.
The regex used to extract size and unit from the desired size
doesn't match floating point values. It ends up matching the decimal
part of a floating point value in the first backreference.
This leads to the following issue breaking resizes when a floating point
value for size is set:
"""
Error: Decreasing the size requires manual intervention (103.06G <
71.06G)
Error:
/Stage[main]/S_puppetdb::Lvconfig/Profile_lvm::Fs_on_lv[root]/Logical_volume[root]/size:
change from 71.06G to 103.06G failed: Decreasing the size requires
manual intervention (103.06G < 71.06G)
"""
Because new_size_bytes is actually set to only the decimal part: 6
This commit updates the regex for new_size to match floating point values, and
coerces the sizes reported by lvm to float instead of int.