diff --git a/go.mod b/go.mod index 9628e58e..86311bcc 100644 --- a/go.mod +++ b/go.mod @@ -15,9 +15,9 @@ require ( github.com/dell/dell-csi-extensions/volumeGroupSnapshot v1.6.0 github.com/dell/gobrick v1.11.5-0.20241014113235-06cfe9928229 github.com/dell/gocsi v1.11.0 - github.com/dell/gofsutil v1.16.2-0.20241024070128-65a51f273f8a + github.com/dell/gofsutil v1.16.2-0.20241025084148-087a7378a075 github.com/dell/goiscsi v1.9.0 - github.com/dell/gonvme v1.8.1 + github.com/dell/gonvme v1.8.2-0.20241025082321-e7b104b7df7c github.com/dell/gopowerstore v1.15.2-0.20241008144633-6990d1b86e5b github.com/fsnotify/fsnotify v1.7.0 github.com/go-openapi/strfmt v0.23.0 diff --git a/go.sum b/go.sum index 42606efd..1399b30d 100644 --- a/go.sum +++ b/go.sum @@ -131,12 +131,12 @@ github.com/dell/gobrick v1.11.5-0.20241014113235-06cfe9928229 h1:jer/8oHRkUe3Kgc github.com/dell/gobrick v1.11.5-0.20241014113235-06cfe9928229/go.mod h1:+qnDjbft08dV0s5BWG/R6KUFnS3nxJRqfALV1ficbWI= github.com/dell/gocsi v1.11.0 h1:P84VOPd1V55JQjx4tfd/6QOlVQRQkYUqmGqbzPKeyUQ= github.com/dell/gocsi v1.11.0/go.mod h1:LzGAsEIjBxVXJuabzsG3/MsdCOczxDE1IWOBxzXIUhw= -github.com/dell/gofsutil v1.16.2-0.20241024070128-65a51f273f8a h1:20B30iO7h5cv/DtC5Hts3iPxMOsrL/V+uHiAyQRfnlY= -github.com/dell/gofsutil v1.16.2-0.20241024070128-65a51f273f8a/go.mod h1:PN2hWl/pVLQiTsFR0X1x+GfhfOrfW8pGgH5xGcGMeFs= +github.com/dell/gofsutil v1.16.2-0.20241025084148-087a7378a075 h1:c1Hk/MW7pPP/9OnzNl1PceeI8QkQaqRsCzu0OegTtR4= +github.com/dell/gofsutil v1.16.2-0.20241025084148-087a7378a075/go.mod h1:PN2hWl/pVLQiTsFR0X1x+GfhfOrfW8pGgH5xGcGMeFs= github.com/dell/goiscsi v1.9.0 h1:VvMHbAO4vk80oc/TAbQPYlxysscCqVBW78GyPoUxgik= github.com/dell/goiscsi v1.9.0/go.mod h1:NI/W/0O1UrMW2zVdMxy4z395Jn0r7utH6RQDFSZiFyQ= -github.com/dell/gonvme v1.8.1 h1:46M5lPqj7+Xjen+qxooRN9cx/+uJG4xtK9TpwduWDgE= -github.com/dell/gonvme v1.8.1/go.mod h1:ajbuF+fswq+ty2tRTG5FN4ecIMJsG7aDu/bkMynTKAs= +github.com/dell/gonvme v1.8.2-0.20241025082321-e7b104b7df7c h1:ftk2SoZT0lHeIHrDrfK9XWblcXoL2NIjQU+Ux6Qld+w= +github.com/dell/gonvme v1.8.2-0.20241025082321-e7b104b7df7c/go.mod h1:5IgWNLcuffHzuXSa6YH3APHiET/hROouuj3mg7GPoqQ= github.com/dell/gopowerstore v1.15.2-0.20241008144633-6990d1b86e5b h1:wVpvFdhc4FIl7w73fm9aTGtE3iTfoO5Ag7/WQUNdHUU= github.com/dell/gopowerstore v1.15.2-0.20241008144633-6990d1b86e5b/go.mod h1:EQEsDdulHtvpDIe2tMCW/2swr1enisuzW4Zmw6c2SKc= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= diff --git a/pkg/common/fs/fs.go b/pkg/common/fs/fs.go index 489908ad..9119702f 100644 --- a/pkg/common/fs/fs.go +++ b/pkg/common/fs/fs.go @@ -98,6 +98,7 @@ type UtilInterface interface { ResizeMultipath(ctx context.Context, deviceName string) error FindFSType(ctx context.Context, mountpoint string) (fsType string, err error) GetMpathNameFromDevice(ctx context.Context, device string) (string, error) + GetNVMeController(device string) (string, error) } // Fs implementation of FsInterface that uses default os/file calls diff --git a/pkg/node/base.go b/pkg/node/base.go index ecf6f707..df2c4ac4 100644 --- a/pkg/node/base.go +++ b/pkg/node/base.go @@ -44,6 +44,7 @@ const ( powerStoreMaxNodeNameLength = 64 blockVolumePathMarker = "/csi/volumeDevices/publish/" sysBlock = "/sys/block/" + dev = "/dev/" defaultNodeNamePrefix = "csi-node" defaultNodeChrootPath = "/noderoot" diff --git a/pkg/node/node.go b/pkg/node/node.go index eb556212..245e517c 100644 --- a/pkg/node/node.go +++ b/pkg/node/node.go @@ -993,14 +993,31 @@ func (s *Service) nodeExpandRawBlockVolume(ctx context.Context, volumeWWN string if len(deviceNames) > 0 { var devName string for _, deviceName := range deviceNames { - devicePath := sysBlock + deviceName - log.Infof("Rescanning unmounted (raw block) device %s to expand size", deviceName) - err = s.Fs.GetUtil().DeviceRescan(context.Background(), devicePath) - if err != nil { - log.Errorf("Failed to rescan device (%s) with error (%s)", devicePath, err.Error()) - return nil, status.Error(codes.Internal, err.Error()) + if strings.HasPrefix(deviceName, "nvme") { + nvmeControllerDevice, err := s.Fs.GetUtil().GetNVMeController(deviceName) + if err != nil { + log.Errorf("Failed to rescan device (%s) with error (%s)", deviceName, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) + } + if nvmeControllerDevice != "" { + log.Infof("Rescanning unmounted (raw block) device %s to expand size", deviceName) + devicePath := dev + nvmeControllerDevice + err = s.nvmeLib.DeviceRescan(devicePath) + if err != nil { + log.Errorf("Failed to rescan device (%s) with error (%s)", devicePath, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) + } + } + } else { + devicePath := sysBlock + deviceName + log.Infof("Rescanning unmounted (raw block) device %s to expand size", deviceName) + err = s.Fs.GetUtil().DeviceRescan(context.Background(), devicePath) + if err != nil { + log.Errorf("Failed to rescan device (%s) with error (%s)", devicePath, err.Error()) + return nil, status.Error(codes.Internal, err.Error()) + } + devName = deviceName } - devName = deviceName } mpathDev, err := s.Fs.GetUtil().GetMpathNameFromDevice(ctx, devName)