-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
lvol module is not idempotent #29201
Comments
From @angystardust on 2015-04-27T00:15:27Z I forgot to tell that if I use the patched module found at https://github.com/psa/ansible/commit/00e19d1780fdec57e6c51f727f29472d64b51f05, it works as expected |
From @angystardust on 2015-04-27T00:15:27Z Hi @angystardust: Thanks for submitting this bug report. Apologies for taking so long to triage it. :) Since this bug has been open for a while, we would appreciate if you can verify if you are still seeing the reported behavior in the latest version. If you are seeing the reported behavior, just let us know and we will leave the bug open and notify the module maintainer. If you are no longer seeing the reported behavior, please let us know and we will close the bug report. Thanks! :) |
From @angystardust on 2015-04-27T00:15:27Z If this is stil an issue, it's because the lvol module is assuming that an operation on an existing LV is intended to change the size (which is only the case if the size argument differs from the actual LV's size), and lvreduce (my guess is the module is checking size <= the current LV's size to decide to use reduce) returns failure when the LV is already the requested size. |
From @angystardust on 2015-04-27T00:15:27Z @robynbergeron, this is still an issue for me 😞 |
From @angystardust on 2015-04-27T00:15:27Z @analogbyte See if #1382 magically fixes this. The check to see if size different was incorrect, I added a int() wrapper which should make it work now. Give it a shot |
From @angystardust on 2015-04-27T00:15:27Z Do you still have the commit of psa/ansible@00e19d1, it is gone. Could you please send me a copy? |
From @angystardust on 2015-04-27T00:15:27Z this problem is still not fixed in latest ansible v2.0.1 and v2.1 |
From @angystardust on 2015-04-27T00:15:27Z I think your issue is fixed with #2220 You can influence the shrink behaviour using |
From @angystardust on 2015-04-27T00:15:27Z This is a problem for me if I use 100%FREE, the first time work, the second I get "Sorry, no shrinking of 'volume name' to 0 permitted.", this was working in the version 2.0 but now in 2.1 doesn't work. And "shrink=" do not exists in 2.1. |
From @angystardust on 2015-04-27T00:15:27Z @pega2k I would suggest downloading the module and putting it in your |
From @angystardust on 2015-04-27T00:15:27Z @dagwieers it works using shrink=no. |
From @angystardust on 2015-04-27T00:15:27Z @pega2k Thanks for reporting back ! |
From @angystardust on 2015-04-27T00:15:27Z Glad to see someone found this option usefull :) |
From @angystardust on 2015-04-27T00:15:27Z It works around the bug, but I think there is still a weird assumption about the %FREE option. It seems that every time the module is run, the %FREE is taken from the remaining space. So every single time it would run, your volume size would be different. 90% free the first time you get the remaining 90% of space. Second time you get a tiny VM that is 90% of the remaining 10% of space. Then up, then down, etc... In reality the math should probably work out so that it subtracts the current size of the volume from the used space and then does the % check. So if you say you want 90% free, and no changes are made between two runs, you'd get the exact same size both times. In the mean time, we'll just vendor the module until 2.2 comes out and set |
This comment has been minimized.
This comment has been minimized.
From @angystardust on 2015-04-27T00:15:27Z @dagwieers I am curious if there are any plans to set a flag such that if the lv exists, leave it be, if it doesn't create it using size specified? I am sure there are cases we'd want to give it space if some existed, but this may not always be the case. I cannot upgrade to 2.2 yet, so shrink=no is not an option for me, and I am not sure where to get this module that makes the creation idempotent with 100%FREE. Thanks for any help. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
3 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
From @angystardust on 2015-04-27T00:15:27Z just upgraded to 2.2.0.2 and confirm 100%FREE lvols are still causing this error |
This comment has been minimized.
This comment has been minimized.
From @angystardust on 2015-04-27T00:15:27Z Coming here from #3527, i don't agree with @j2sol, the math is right here.. if we use %FREE, semantically for me that means '% of remaining free space', if you want a 'percentage of the total space of the vg', use %VG, which just works, and is idempotent. I don't know when %VG was added, but it works for me with 2.1.1 and 2.2.1. |
I've been working around the non-idempotence of the %FREE thing by just adding a conditional like:
|
Hello, Is this also valid for Ansible 2.3.1 an what is the best way for a work around? |
I would like to implement such a check like |
Any update on this? |
@angystardust To me this seems to be a rounding error. If you provide a size which doesn't map on a multiple of the extent-size, the LVM tools will round it up or down to the nearest possible value. If you run it again, the new value may be higher or lower, and this will cause an error like yours. If you would like to fix this, you need to get the extent-size, and use modulo extent-size on the size value, then use this value for the number of extents. Contributions are welcome. waiting_on_contributor And BTW the fact that using 100%FREE (or X%FREE) is not idempotent is pretty obvious. If you base your size on the availability of the free space, a subsequent run will declare a different value from the previous run. |
Using ansible 2.8.3 AND
Even worse, i understand that 100%FREE is no idempotent, but 100%PVS or 100%VG should be idempotent always, even with shrink=yes, as the value do not change |
Thank you very much for your interest in Ansible. Ansible has migrated much of the content into separate repositories to allow for more rapid, independent development. We are closing this issue/PR because this content has been moved to one or more collection repositories.
For further information, please see: |
From @angystardust on 2015-04-27T00:15:27Z
Issue Type:
Bug Report
Component Name
lvol module
Ansible Version:
ansible 1.9.0.1
Environment:
Management Station OS: Ubuntu 12.04.04
Managed OS: Centos 6.5 (i386)
Summary:
'lvol' module is not idempotent so every time I re-run a playbook with no changes to the variabiles file, it fails.
Steps To Reproduce:
Create a playbook with this vars file:
and this task:
On the first run, everything is ok but on the second one, the 'lvol' task triggers this bad error:
It seems that the 'lvol' module wants to shrink the logical volume even if i didn't change the size in my vars. (I also tried to set the force=yes but it crashes miserably...maybe i have to fill another bug)
It works as expected if i increase the values of the 'lvsize' in the vars file.
As a work-around, I invoke the 'lvcreate' by using the 'command' (idempotency is provided by the 'creates' arguments) :
Expected Results:
I expected the 'lvol' module to be idempotency-aware (as all others ansible modules)
Actual Results:
Idemopotency is not enforced.
Copied from original issue: ansible/ansible-modules-extras#428
The text was updated successfully, but these errors were encountered: