Skip to content

Commit

Permalink
Add Driver and Name in DiskStat struct
Browse files Browse the repository at this point in the history
Name: exact disk name of a block device
Driver: driver of a block device

Longhorn 7672

Signed-off-by: Derek Su <[email protected]>
  • Loading branch information
derekbit committed Mar 7, 2024
1 parent 2ef7d01 commit 86ccb7d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions io/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ func GetDiskStat(path string) (diskStat types.DiskStat, err error) {
DiskID: fsidFormatted,
Path: path,
Type: usage.Fstype,
Driver: types.DiskDriverNone,
FreeBlocks: int64(statfs.Bfree),
TotalBlocks: int64(statfs.Blocks),
BlockSize: statfs.Bsize,
Expand Down
1 change: 1 addition & 0 deletions io/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,7 @@ func getDiskStat(path string) (*types.DiskStat, error) {
DiskID: fsStat.Fsid,
Path: fsStat.Path,
Type: fsStat.Type,
Driver: types.DiskDriverNone,
FreeBlocks: fsStat.FreeBlock,
TotalBlocks: fsStat.TotalBlock,
BlockSize: fsStat.BlockSize,
Expand Down
12 changes: 12 additions & 0 deletions types/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,22 @@ import (

var FileLockDefaultTimeout = 24 * time.Hour

type DiskDriver string

const (
DiskDriverNone = DiskDriver("")
DiskDriverAio = DiskDriver("aio")
DiskDriverNvme = DiskDriver("nvme")
DiskDriverVirtioScsi = DiskDriver("virtio-scsi")
DiskDriverVirtioBlk = DiskDriver("virtio-blk")
)

type DiskStat struct {
DiskID string
Name string
Path string
Type string
Driver DiskDriver
FreeBlocks int64
TotalBlocks int64
BlockSize int64
Expand Down

0 comments on commit 86ccb7d

Please sign in to comment.