Skip to content

Commit a325540

Browse files
committed
fix: avoid negative value in the FreeSpace Accounting
1 parent e204e55 commit a325540

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/DIRAC/ResourceStatusSystem/Command/FreeDiskSpaceCommand.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def _storeCommand(self, results):
121121
"Site": siteRes["Value"] if siteRes["Value"] else "unassigned",
122122
}
123123

124-
results["Used"] = results["Total"] - results["Free"]
124+
# There are sometimes small discrepencies which can lead to negative
125+
# used values.
126+
results["Used"] = max(0, results["Total"] - results["Free"])
125127

126128
for sType in ["Total", "Free", "Used"]:
127129
spaceTokenAccounting = StorageOccupancy()

0 commit comments

Comments
 (0)