linux-system-roles / storage

Ansible role for linux storage management
https://linux-system-roles.github.io/storage/
MIT License
101 stars 58 forks source link

fix: Do not remove swap at every run #396

Closed scaronni closed 10 months ago

scaronni commented 10 months ago

Enhancement: The role is not idempotent if the system has swap. At every execution, the swap entries are remove and re-added in the next task.

Reason: There is specific code that deletes swap unconditionally. I could not find any apparent real reason for this piece of code to exist.

Result: Role is idempotent.

codecov[bot] commented 10 months ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (551be65) 13.67% compared to head (7b9b594) 13.69%. Report is 4 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #396 +/- ## ========================================== + Coverage 13.67% 13.69% +0.01% ========================================== Files 8 8 Lines 1733 1731 -2 Branches 79 79 ========================================== Hits 237 237 + Misses 1496 1494 -2 ``` | [Flag](https://app.codecov.io/gh/linux-system-roles/storage/pull/396/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=linux-system-roles) | Coverage Δ | | |---|---|---| | [sanity](https://app.codecov.io/gh/linux-system-roles/storage/pull/396/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=linux-system-roles) | `16.54% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=linux-system-roles#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/linux-system-roles/storage/pull/396?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=linux-system-roles) | Coverage Δ | | |---|---|---| | [library/blivet.py](https://app.codecov.io/gh/linux-system-roles/storage/pull/396?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=linux-system-roles#diff-bGlicmFyeS9ibGl2ZXQucHk=) | `0.00% <ø> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

richm commented 10 months ago

[citest]

richm commented 10 months ago

well, the swap tests pass on el8 and el9 - as far as correctness I'll have to defer to @vojtechtrefny and @japokorn

scaronni commented 10 months ago

Just to be clear, the blivet module removes the swap on the live system and then re-adds it back in the subsequent one, which means if a system is using swap heavily there might be some serious issues.

The swap is removed anyway correctly if people specify it as absent in the variables.

vojtechtrefny commented 10 months ago

The special condition for swap was added in #90 @dwlehman do you remember why? Looking at the code I don't see a reason for always removing the swap entry.

dwlehman commented 10 months ago

Sadly I do not have any record or memory of why to do that, but I think that if all the tests are passing this change is probably good.

vojtechtrefny commented 10 months ago

Sadly I do not have any record or memory of why to do that, but I think that if all the tests are passing this change is probably good.

Ok, I think we can merge this. The tests are passing and we definitely don't want to always remove and then re-add the swap entry and I don't see another reason for having this condition.