-
Notifications
You must be signed in to change notification settings - Fork 20
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
[DPE-5301] Add check for low storage space on pgdata volume #685
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #685 +/- ##
==========================================
- Coverage 70.72% 70.65% -0.07%
==========================================
Files 11 11
Lines 2951 2968 +17
Branches 514 517 +3
==========================================
+ Hits 2087 2097 +10
- Misses 754 760 +6
- Partials 110 111 +1 ☔ View full report in Codecov by Sentry. |
src/charm.py
Outdated
elif self.unit.status.message == INSUFFICIENT_SIZE_WARNING: | ||
self._set_active_status() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should most probably don't change the status in _set_active_status()
if the message is INSUFFICIENT_SIZE_WARNING
and then reset the status here before running _set_active_status()
.
This is because if another hook runs _set_active_status()
the status will be overwritten unite the next update status. @marceloneppel what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand your point. Could you elaborate? My motivation for this check is to resolve the blocked status in case the storage space got released (to >10%)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the check for INSUFFICIENT_SIZE_WARNING
is just to make sure that, if the charm was blocked due to insufficient size but the user has released enough space, then resolve. Maybe there's a better way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good idea, @dragomirp.
@lucasgameiroborges, the idea is to just set something else in the status at this point, like the Active Status, and put a condition in the _set_active_status
method not to change the status to Active if the current status is INSUFFICIENT_SIZE_WARNING
. This way, we avoid some other places overring this status incorrectly (maybe here).
I see that this will need to be handled correctly later by improving how we manage the unit's statuses across the entire charm code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get the reasoning for including a check inside _set_active_status
so the blocked status doesn't get overwritten in other places, as for just set something else in the status at this point, like the Active Status
do you mean using self.unit.status = ActiveStatus()
directly? why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The elif should be something like:
elif self.unit.status.message == INSUFFICIENT_SIZE_WARNING:
self.unit.status = ActiveStatus()
self._set_active_status()
if _set_active_status()
preserves INSUFFICIENT_SIZE_WARNING
it should be unset before calling it. Otherwise it won't unset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: are we moving the right way here?
It smells like Status/Message manipulation is going outside of our control.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh! Now I see the problem! Yes of course, thanks @dragomirp and @marceloneppel !
@taurus-forever : I agree that status management is a bit all over the place. AFAIK this is a problem in other charms too. Interesting discussion here: https://chat.canonical.com/canonical/pl/ncbsrryk378jux5r8cxjjngzna
Issue
The charm gives no indication of low storage space on
pgdata
folder, which can cause unexpected failuresSolution
Added check on
update_status
hook + integration test.