Skip to content
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

fix: Inconsistent total capacity in CGI and statfs #309

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

uristdwarf
Copy link
Collaborator

@uristdwarf uristdwarf commented Feb 26, 2025

The CGI and statfs system call where reporting different total capacities of the filesystem.

The CGI monitoring was showing the total capacity of all hard drives, regardless of limits in HDD_LEAVE_SPACE_DEFAULT option. Meanwhile, statfs was showing total capacity as space available on all hard drives + actual used bytes for chunks (or the reported total capacity on all hard drives, whichever was lower).

This commit tries to get rid of these discrepancies by discounting the HDD_LEAVE_SPACE_DEFAULT value towards the final capacity of a drive in the chunkserver. Both statfs and CGI will now show this capacity in the same way.

The CGI and statfs system call where reporting different total
capacities of the filesystem.

The CGI monitoring was showing the total capacity of all hard drives,
regardless of limits in HDD_LEAVE_SPACE_DEFAULT option. Meanwhile,
statfs was showing total capacity as space available on all hard drives
+ actual used bytes for chunks (or the reported total capacity on all
hard drives, whichever was lower).

This commit tries to get rid of these discrepancies by discounting the
HDD_LEAVE_SPACE_DEFAULT value towards the final capacity of a drive in
the chunkserver. Both statfs and CGI will now show this capacity in the
same way.

Signed-off-by: Urmas Rist <[email protected]>
Copy link
Collaborator

@rolysr rolysr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@@ -84,6 +84,11 @@ void CmrDisk::refreshDataDiskUsage() {
} else {
setAvailableSpace(availableSpace() - leaveFreeSpace());
}
if (totalSpace() < leaveFreeSpace()) {
setTotalSpace(0ULL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider setting the value passed here as a constant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants