extend debug page to show assigned domain quota#2989
Merged
andryyy merged 5 commits intomailcow:masterfrom Oct 2, 2019
Merged
Conversation
adding the amount of assigned domain quota to the disk usage display as potentially used disk space
now only summing up the assigned domain quota for active domains, and not subtracting disc base occupied by mailboxes of inactive domains (inactive_bytes)
- changed dockerapi to not return human readable values for df - all caluclations now in KiB - moved code from domain_admin to mailbox functions - using actual occupied bytes as used quota - all outputs now in *iB using formatBytes()
Member
|
Neat, possible to change the color of the bar(s) if you hit a certain threshold of like 75%/90% disk usage? |
Contributor
|
What if you assigned more than 100%? |
heavygale
commented
Oct 2, 2019
| $quota_stats = mailbox('get','quota_stats'); | ||
| $quotaPercent1 = round(($quota_stats['total_quota']/$vmail_df[3])*100); | ||
| $quotaPercent2 = round((($quota_stats['total_quota']-$quota_stats['used_bytes'])/$vmail_df[3])*100); | ||
| $quotaPercent2 = ($quotaPercent2+$used_percent>100) ? 100-$used_percent : $quotaPercent2; |
Contributor
Author
There was a problem hiding this comment.
Handling overcommitment -> progressbar is capped to 100%
Contributor
heavygale
commented
Oct 2, 2019
| if 'dir' in request.json: | ||
| for container in docker_client.containers.list(filters={"id": container_id}): | ||
| df_return = container.exec_run(["/bin/bash", "-c", "/bin/df -H '" + request.json['dir'].replace("'", "'\\''") + "' | /usr/bin/tail -n1 | /usr/bin/tr -s [:blank:] | /usr/bin/tr ' ' ','"], user='nobody') | ||
| df_return = container.exec_run(["/bin/bash", "-c", "/bin/df '" + request.json['dir'].replace("'", "'\\''") + "' | /usr/bin/tail -n1 | /usr/bin/tr -s [:blank:] | /usr/bin/tr ' ' ','"], user='nobody') |
Contributor
Author
There was a problem hiding this comment.
@andryyy We need a new build of dockerapi, as I removed the -H.
Contributor
There was a problem hiding this comment.
I did locally, but the view is broken anyway.
My VM has 100G, the other stuff is wrong, too.
Contributor
Member
|
@andryyy Possible to revert? We discuss some stuff in IRC |
andryyy
added a commit
that referenced
this pull request
Oct 2, 2019
fix for "available ≠ total" error in #2989
andryyy
added a commit
that referenced
this pull request
Oct 2, 2019
andryyy
added a commit
that referenced
this pull request
Oct 2, 2019
Revert "fix for "available ≠ total" error in #2989"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This PR extends the disk usage display on the admin's debug page, adding a second progress bar for the total amount of assigned domain quota. This way, the admin can see how much of the available disk space has already been assined to domains, since this disk space must be considered as potentially used. The code can handle disk space overcommitmend, as the progressbar is capped to 100%.
before:


after:
I changed the dockerapi container to not return human readable values for df, so that the values can be used for calculations. Looks like "df" from dockerapi isn't used elsewhere in mailcow.