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_volume) Fix regex on new_size and coerce to float instead of int #123

Merged
merged 1 commit into from
Sep 3, 2015

Conversation

tdevelioglu
Copy link

  1. 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.

  2. 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.

int
1) 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.

2) 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.
@bmjen bmjen merged commit fa85209 into puppetlabs:master Sep 3, 2015
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.

3 participants