From 2b529e262361be571772f3144ac1772147d3086e Mon Sep 17 00:00:00 2001 From: Harshita Pandey <88329939+harshitap26@users.noreply.github.com> Date: Wed, 2 Mar 2022 20:34:19 +0530 Subject: [PATCH] NVMe Volume Expansion (#15) --- gofsutil_mount_linux.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gofsutil_mount_linux.go b/gofsutil_mount_linux.go index 651eac0..33fedf5 100644 --- a/gofsutil_mount_linux.go +++ b/gofsutil_mount_linux.go @@ -350,12 +350,14 @@ 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] @@ -363,6 +365,9 @@ func (fs *FS) getMountInfoFromDevice( 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 {