You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently upgraded to 3.5.0, which is past the point #2267 was merged.
This PR broke some behaviour I have been using for a long time with the lvol module.
I manage a large number of VMs - when they're created from a template with variable disk size, I create an lvol data that fills all free space. If, further down the line, I simply expand the disk and run the same ansible config the data lvol is expanded to fill the new space. This has worked reliably well for a long time with the lvol module.
With #2267, a check was added to throw an error if an lvol didn't exist, but the size argument had an operator (+/-).
if size_operator is not None:
module.fail_json(msg="Bad size specification of '%s%s' for creating LV" % (size_operator, size))
Whilst I understand why this was added, the change of behaviour now means that I cannot use the single module call I use now.
The workaround I can now think of is:
Get current lvol info
If data doesn't exist, call lvol with 100%FREE
If data does exist, call lvol with +100%FREE
This is turning a single module call into 3 module calls. Ansible is already slow enough, having to do this arduous work around for a long-running reasonable use case seems excessive.
Would a PR be accepted if I removed this clause? Other than 'user friendliness', is this safety check justified for the lack of functionality? The module now forces you to pass different arguments depending on if the resource exists or not, to get to the same end point. This doesn't seem very user friendly or idempotent.
I'm not really familiar with the code, but it definitely should still fail if someone provided size_operator == '-'. So completely removing is not ok, but I guess that adjusting it to if size_operator != '-': should be fine.
That would not be ok, since you still have other relative options: VG, LV, PVS, ORIGIN.
If you're going to be replacing the check you should also take into account the option specified. For example, if the LV doesn't exist we should not allow the option of LV at all.
Summary
I recently upgraded to 3.5.0, which is past the point #2267 was merged.
This PR broke some behaviour I have been using for a long time with the lvol module.
I manage a large number of VMs - when they're created from a template with variable disk size, I create an lvol
data
that fills all free space. If, further down the line, I simply expand the disk and run the same ansible config thedata
lvol is expanded to fill the new space. This has worked reliably well for a long time with the lvol module.With #2267, a check was added to throw an error if an lvol didn't exist, but the size argument had an operator (+/-).
Whilst I understand why this was added, the change of behaviour now means that I cannot use the single module call I use now.
The workaround I can now think of is:
data
doesn't exist, call lvol with 100%FREEdata
does exist, call lvol with +100%FREEThis is turning a single module call into 3 module calls. Ansible is already slow enough, having to do this arduous work around for a long-running reasonable use case seems excessive.
Would a PR be accepted if I removed this clause? Other than 'user friendliness', is this safety check justified for the lack of functionality? The module now forces you to pass different arguments depending on if the resource exists or not, to get to the same end point. This doesn't seem very user friendly or idempotent.
Issue Type
Bug Report
Component Name
community/general/plugins/modules/lvol.py
Ansible Version
Community.general Version
Configuration
$ ansible-config dump --only-changed
OS / Environment
No response
Steps to Reproduce
Expected Results
An lvol to be created, or expanded, to fill all available space
Actual Results
Code of Conduct
The text was updated successfully, but these errors were encountered: