Skip to content

Commit

Permalink
NVMe Volume Expansion (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
harshitap26 authored Mar 2, 2022
1 parent 54aba58 commit 2b529e2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gofsutil_mount_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,19 +350,24 @@ func (fs *FS) getMountInfoFromDevice(
return nil, fmt.Errorf("Device not found")
}
sdDeviceRegx := regexp.MustCompile(`NAME=\"sd\S+\"`)
nvmeDeviceRegx := regexp.MustCompile(`NAME=\"nvme\S+\"`)
mpathDeviceRegx := regexp.MustCompile(`NAME=\"mpath\S+\"`)
mountRegx := regexp.MustCompile(`MOUNTPOINT=\"\S+\"`)
deviceTypeRegx := regexp.MustCompile(`TYPE=\"mpath"`)
deviceNameRegx := regexp.MustCompile(`NAME=\"\S+\"`)
mountPoint := mountRegx.FindString(output)
devices := sdDeviceRegx.FindAllString(output, 99999)
nvmeDevices := nvmeDeviceRegx.FindAllString(output, 99999)
mpath := mpathDeviceRegx.FindString(output)
mountInfo := new(DeviceMountInfo)
mountInfo.MountPoint = strings.Split(mountPoint, "\"")[1]

for _, device := range devices {
mountInfo.DeviceNames = append(mountInfo.DeviceNames, strings.Split(device, "\"")[1])
}
for _, device := range nvmeDevices {
mountInfo.DeviceNames = append(mountInfo.DeviceNames, strings.Split(device, "\"")[1])
}
if mpath != "" {
mountInfo.MPathName = strings.Split(mpath, "\"")[1]
} else {
Expand Down

0 comments on commit 2b529e2

Please sign in to comment.