-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
2.89.2
DiskSpaceMonitorDescriptor currently contains the check
public DiskSpace invoke(File f, VirtualChannel channel) throws IOException { long s = f.getUsableSpace(); if(s<=0) return null; return new DiskSpace(f.getCanonicalPath(), s); }
However, a return of 0 from File.getUsableSpace space is ambiguous. From the javadoc: "The number of available bytes on the partition or 0L if the abstract pathname does not name a partition. "
So a zero could mean "there is no partition" or that there are zero bytes left. In the /computer UI this shows up as "N/A" Free Disk Space.
Sample test program:
import java.io.File; public class Hello { public static void main(String[] args) { File f = new File("/root/data/jenkins"); System.out.println(f.getUsableSpace()); System.out.println(f.getTotalSpace()); } }
On a totally full partition
# df Filesystem 1K-blocks Used Available Use% Mounted on zones/2222ef86-bdff-495f-a1f1-d47658d93769 107937943 107937943 0 100% /
The test program will output:
0 110528453632
I think this points to a solution: DiskSpaceMonitorDescriptor can also call getTotalSpace to determine what a zero from getUsableSpace really means.