Skip to content

Commit

Permalink
Bugfix/nvme volume expansion (#64)
Browse files Browse the repository at this point in the history
* NVMe Volume Expansion

* NVMe Volume Expansion
  • Loading branch information
harshitap26 authored Mar 3, 2022
1 parent 0cd39fd commit 9102846
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/dell/dell-csi-extensions/volumeGroupSnapshot v1.0.0
github.com/dell/gobrick v1.2.1-0.20220224111903-717383a5e97e
github.com/dell/gocsi v1.5.1-0.20220218201557-b18545e234c3
github.com/dell/gofsutil v1.7.1-0.20220222054218-54aba58afa13
github.com/dell/gofsutil v1.7.1-0.20220302093137-8dccd83747e2
github.com/dell/goiscsi v1.2.1-0.20220222054507-9cc2d02a05dd
github.com/dell/gonvme v0.0.0-20220224072409-dcb82cef802a
github.com/dell/gopowerstore v1.6.1-0.20220217053906-266b40ccdb6e
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ github.com/dell/gocsi v1.5.1-0.20220218201557-b18545e234c3 h1:kxuw6ZTvkhTGPuz8AN
github.com/dell/gocsi v1.5.1-0.20220218201557-b18545e234c3/go.mod h1:GoNFNluCYj7i9AcPQy4CLFF1FQoLsD5rlnDttVesnzk=
github.com/dell/gofsutil v1.7.1-0.20220222054218-54aba58afa13 h1:6chFUTevM2q+CwN/X8jO9nE7A/IvpgDjkHTlh66qYz4=
github.com/dell/gofsutil v1.7.1-0.20220222054218-54aba58afa13/go.mod h1:oWLiV7FmBurEie3An11SNqQ1ReyOiqjSZaXDRhm7tMc=
github.com/dell/gofsutil v1.7.1-0.20220302093137-8dccd83747e2 h1:avM1qrtUQnSbyk7kuwXGK80xavX/hL2IlAzJafh4Wbg=
github.com/dell/gofsutil v1.7.1-0.20220302093137-8dccd83747e2/go.mod h1:oWLiV7FmBurEie3An11SNqQ1ReyOiqjSZaXDRhm7tMc=
github.com/dell/goiscsi v1.1.0/go.mod h1:MfuMjbKWsh/MOb0VDW20C+LFYRIOfWKGiAxWkeM5TKo=
github.com/dell/goiscsi v1.2.1-0.20220222054507-9cc2d02a05dd h1:PgxNq8K1lXQSvUXLZ7sLZdcITXjszeZxmn1uHVrvLO0=
github.com/dell/goiscsi v1.2.1-0.20220222054507-9cc2d02a05dd/go.mod h1:4H4vlwEh9ujB+4kgAMNzRT8w17Gsen/BusH49k99bPE=
Expand Down
16 changes: 9 additions & 7 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -809,13 +809,15 @@ func (s *Service) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolum
}
log.WithFields(f).Info("Calling resize the file system")

// Rescan the device for the volume expanded on the array
for _, device := range devMnt.DeviceNames {
devicePath := sysBlock + device
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 s.useFC || s.useISCSI {
// Rescan the device for the volume expanded on the array
for _, device := range devMnt.DeviceNames {
devicePath := sysBlock + device
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())
}
}
}
// Expand the filesystem with the actual expanded volume size.
Expand Down
1 change: 1 addition & 0 deletions pkg/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,7 @@ var _ = Describe("CSINodeService", func() {
MPathName: "/dev/mpatha",
MountPoint: stagingPath,
}, nil).Times(1)
nodeSvc.useISCSI = true
utilMock.On("DeviceRescan", mock.Anything, mock.Anything).Return(errors.New("Failed to rescan device"))
_, err := nodeSvc.NodeExpandVolume(context.Background(), getNodeVolumeExpandValidRequest(validBlockVolumeID, false))
Ω(err.Error()).To(ContainSubstring("Failed to rescan device"))
Expand Down

0 comments on commit 9102846

Please sign in to comment.