diff --git a/pkg/driver/node.go b/pkg/driver/node.go index b05a61af12..b2b2fde4b1 100644 --- a/pkg/driver/node.go +++ b/pkg/driver/node.go @@ -235,12 +235,21 @@ func (d *nodeService) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV // TODO: range specified } - r := resizefs.NewResizeFs(d.mounter) - - // TODO: get the mount path that's required for XFS - _, err := r.Resize(req.GetVolumePath(), "" /* mount path for xfs */) + args := []string{"-o", "source", "--noheadings", "--target", req.GetVolumePath()} + output, err := d.mounter.Exec.Run("findmnt", args...) if err != nil { - return nil, err + return nil, status.Errorf(codes.Internal, "Could not determine device path: %v", err) + + } + + devicePath := strings.TrimSpace(string(output)) + if len(devicePath) == 0 { + return nil, status.Errorf(codes.Internal, "Could not get valid device for mount path: %q", req.GetVolumePath()) + } + + r := resizefs.NewResizeFs(d.mounter) + if _, err := r.Resize(devicePath, req.GetVolumePath()); err != nil { + return nil, status.Errorf(codes.Internal, "Could not resize volume %q: %v", volumeID, err) } return &csi.NodeExpandVolumeResponse{}, nil