@@ -386,6 +386,7 @@ func (i *RealFsInfo) GetFsInfoForPath(mountSet map[string]struct{}) ([]Fs, error
386
386
if err != nil {
387
387
return nil , err
388
388
}
389
+ nfsInfo := make (map [string ]Fs , 0 )
389
390
for device , partition := range i .partitions {
390
391
_ , hasMount := mountSet [partition .mountpoint ]
391
392
_ , hasDevice := deviceSet [device ]
@@ -394,7 +395,11 @@ func (i *RealFsInfo) GetFsInfoForPath(mountSet map[string]struct{}) ([]Fs, error
394
395
err error
395
396
fs Fs
396
397
)
397
- switch partition .fsType {
398
+ fsType := partition .fsType
399
+ if strings .HasPrefix (partition .fsType , "nfs" ) {
400
+ fsType = "nfs"
401
+ }
402
+ switch fsType {
398
403
case DeviceMapper .String ():
399
404
fs .Capacity , fs .Free , fs .Available , err = getDMStats (device , partition .blockSize )
400
405
klog .V (5 ).Infof ("got devicemapper fs capacity stats: capacity: %v free: %v available: %v:" , fs .Capacity , fs .Free , fs .Available )
@@ -407,6 +412,22 @@ func (i *RealFsInfo) GetFsInfoForPath(mountSet map[string]struct{}) ([]Fs, error
407
412
}
408
413
// if /dev/zfs is not present default to VFS
409
414
fallthrough
415
+ case NFS .String ():
416
+ if ! utils .FileExists (partition .mountpoint ) {
417
+ klog .V (4 ).Infof ("the file system type is %s, partition mountpoint does not exist: %v" , partition .fsType , partition .mountpoint )
418
+ break
419
+ }
420
+ devId := fmt .Sprintf ("%d:%d" , partition .major , partition .minor )
421
+ if v , ok := nfsInfo [devId ]; ok {
422
+ fs = v
423
+ break
424
+ }
425
+ var inodes , inodesFree uint64
426
+ fs .Capacity , fs .Free , fs .Available , inodes , inodesFree , err = getVfsStats (partition .mountpoint )
427
+ fs .Inodes = & inodes
428
+ fs .InodesFree = & inodesFree
429
+ fs .Type = VFS
430
+ nfsInfo [devId ] = fs
410
431
default :
411
432
var inodes , inodesFree uint64
412
433
if utils .FileExists (partition .mountpoint ) {
0 commit comments