From bca80e339f16e0ea4888715cbee3ecff314eac7b Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 12:48:31 +0100 Subject: [PATCH 01/10] updated docker base image to alpine:3.15 --- deploy/image/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index 9773a1e..14f9227 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -4,12 +4,13 @@ # # XXX: pin alpine to 3.8 with e2fsprogs-1.44 # e2fsprogs-1.45+ crashes my test vm when running mkfs.ext4 -FROM alpine:3.8 +FROM alpine:3.15 LABEL maintainers="SPDK-CSI Authors" LABEL description="SPDK-CSI Plugin" COPY spdkcsi /usr/local/bin/spdkcsi -RUN apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid +RUN apk update && \ + apk add --no-cache nvme-cli open-iscsi e2fsprogs xfsprogs blkid ENTRYPOINT ["/usr/local/bin/spdkcsi"] From fe7cefe865d5f25a2b3de5b88f79116d262f7f1a Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 15:50:06 +0100 Subject: [PATCH 02/10] added devicePath to volumeContext --- pkg/spdk/nodeserver.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/pkg/spdk/nodeserver.go b/pkg/spdk/nodeserver.go index 4b1e814..a8b5588 100644 --- a/pkg/spdk/nodeserver.go +++ b/pkg/spdk/nodeserver.go @@ -185,6 +185,8 @@ func (ns *nodeServer) NodeStageVolume(_ context.Context, req *csi.NodeStageVolum klog.Errorf("failed to stage volume, volumeID: %s devicePath:%s err: %v", volumeID, devicePath, err) return nil, status.Error(codes.Internal, err.Error()) } + + vc["devicePath"] = devicePath // stash VolumeContext to stagingParentPath (useful during Unstage as it has no // VolumeContext passed to the RPC as per the CSI spec) err = util.StashVolumeContext(req.GetVolumeContext(), stagingParentPath) @@ -297,6 +299,39 @@ func (ns *nodeServer) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapab func (ns *nodeServer) NodeExpandVolume(_ context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { klog.Infof("NodeExpandVolume: called with args %+v", *req) + + volumeID := req.GetVolumeId() + volumeMountPath := req.GetVolumePath() + + stagingParentPath := req.GetStagingTargetPath() + volumeContext, err := util.LookupVolumeContext(stagingParentPath) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to retrieve volume context for volume %s: %v", volumeID, err) + } + + devicePath, ok := volumeContext["devicePath"] + if !ok || devicePath == "" { + return nil, status.Errorf(codes.Internal, "could not find device path for volume %s", volumeID) + } + + resizer := mount.NewResizeFs(exec.New()) + needsResize, err := resizer.NeedResize(devicePath, volumeMountPath) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to check if volume %s needs resizing: %v", volumeID, err) + } + + if needsResize { + resized, err := resizer.Resize(devicePath, volumeMountPath) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to resize volume %s: %v", volumeID, err) + } + if resized { + klog.Infof("Successfully resized volume %s (device: %s, mount path: %s)", volumeID, devicePath, volumeMountPath) + } else { + klog.Warningf("Volume %s did not require resizing", volumeID) + } + } + return &csi.NodeExpandVolumeResponse{}, nil } From 6baca643f91ba4e39d46d0ac6452daaf17f85e96 Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 15:54:13 +0100 Subject: [PATCH 03/10] returned CapacityBytes after NodeExpansion --- pkg/spdk/nodeserver.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/spdk/nodeserver.go b/pkg/spdk/nodeserver.go index a8b5588..569a040 100644 --- a/pkg/spdk/nodeserver.go +++ b/pkg/spdk/nodeserver.go @@ -302,6 +302,7 @@ func (ns *nodeServer) NodeExpandVolume(_ context.Context, req *csi.NodeExpandVol volumeID := req.GetVolumeId() volumeMountPath := req.GetVolumePath() + updatedSize := req.GetCapacityRange().GetRequiredBytes() stagingParentPath := req.GetStagingTargetPath() volumeContext, err := util.LookupVolumeContext(stagingParentPath) @@ -332,7 +333,7 @@ func (ns *nodeServer) NodeExpandVolume(_ context.Context, req *csi.NodeExpandVol } } - return &csi.NodeExpandVolumeResponse{}, nil + return &csi.NodeExpandVolumeResponse{CapacityBytes: updatedSize}, nil } // must be idempotent From 7da6e8d4a2f46cd99fe67bce0992c63a9cd27c1f Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 16:08:50 +0100 Subject: [PATCH 04/10] updated docker base image to alpine:3.15 --- deploy/image/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index 14f9227..8dbfbbe 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -10,7 +10,6 @@ LABEL description="SPDK-CSI Plugin" COPY spdkcsi /usr/local/bin/spdkcsi -RUN apk update && \ - apk add --no-cache nvme-cli open-iscsi e2fsprogs xfsprogs blkid +RUN apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid ENTRYPOINT ["/usr/local/bin/spdkcsi"] From 130f00e92aeb0dfd4fe5a5e1cebff2aa9a3be511 Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 16:39:38 +0100 Subject: [PATCH 05/10] updated docker base image to ubuntu:20.04 --- deploy/image/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index 8dbfbbe..dba3b7c 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -4,12 +4,16 @@ # # XXX: pin alpine to 3.8 with e2fsprogs-1.44 # e2fsprogs-1.45+ crashes my test vm when running mkfs.ext4 -FROM alpine:3.15 +FROM ubuntu:20.04 LABEL maintainers="SPDK-CSI Authors" LABEL description="SPDK-CSI Plugin" COPY spdkcsi /usr/local/bin/spdkcsi -RUN apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid +# Update package lists and install necessary packages +RUN apt-get update && \ + apt-get install -y nvme-cli open-iscsi e2fsprogs xfsprogs blkid && \ + apt-get clean && rm -rf /var/lib/apt/lists/* ENTRYPOINT ["/usr/local/bin/spdkcsi"] + From 05927a09fea769023a9f1d0c78f6f7d304393ec2 Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 16:42:45 +0100 Subject: [PATCH 06/10] updated docker base image to alpine:3.18 --- deploy/image/Dockerfile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index dba3b7c..9ee3062 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -4,16 +4,12 @@ # # XXX: pin alpine to 3.8 with e2fsprogs-1.44 # e2fsprogs-1.45+ crashes my test vm when running mkfs.ext4 -FROM ubuntu:20.04 +FROM alpine:3.18 LABEL maintainers="SPDK-CSI Authors" LABEL description="SPDK-CSI Plugin" COPY spdkcsi /usr/local/bin/spdkcsi -# Update package lists and install necessary packages -RUN apt-get update && \ - apt-get install -y nvme-cli open-iscsi e2fsprogs xfsprogs blkid && \ - apt-get clean && rm -rf /var/lib/apt/lists/* +RUN apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid ENTRYPOINT ["/usr/local/bin/spdkcsi"] - From 5c9742b6a87a0c8fc0cf8c8868da11bcbf0fbda9 Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 16:49:40 +0100 Subject: [PATCH 07/10] updated docker base image to alpine:3.8 --- deploy/image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index 9ee3062..9773a1e 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -4,7 +4,7 @@ # # XXX: pin alpine to 3.8 with e2fsprogs-1.44 # e2fsprogs-1.45+ crashes my test vm when running mkfs.ext4 -FROM alpine:3.18 +FROM alpine:3.8 LABEL maintainers="SPDK-CSI Authors" LABEL description="SPDK-CSI Plugin" From de3934a11df823e28728e52bfa3d23a359a3084e Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 17:09:52 +0100 Subject: [PATCH 08/10] updated docker base image to alpine:3.18 --- deploy/image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index 9773a1e..9ee3062 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -4,7 +4,7 @@ # # XXX: pin alpine to 3.8 with e2fsprogs-1.44 # e2fsprogs-1.45+ crashes my test vm when running mkfs.ext4 -FROM alpine:3.8 +FROM alpine:3.18 LABEL maintainers="SPDK-CSI Authors" LABEL description="SPDK-CSI Plugin" From 5e4a8ce46efdd9de3219138cf47f9779d168eda4 Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 17:16:18 +0100 Subject: [PATCH 09/10] updated docker base image to alpine:3.18 --- deploy/image/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index 9ee3062..602af23 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -10,6 +10,7 @@ LABEL description="SPDK-CSI Plugin" COPY spdkcsi /usr/local/bin/spdkcsi -RUN apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid +RUN apk update && \ + apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid ENTRYPOINT ["/usr/local/bin/spdkcsi"] From 398cde215c764941d9ecffec07aa322ae732497b Mon Sep 17 00:00:00 2001 From: geoffrey1330 Date: Tue, 22 Oct 2024 17:24:28 +0100 Subject: [PATCH 10/10] updated docker base image to alpine:3.18 --- deploy/image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/image/Dockerfile b/deploy/image/Dockerfile index 602af23..d710046 100644 --- a/deploy/image/Dockerfile +++ b/deploy/image/Dockerfile @@ -11,6 +11,6 @@ LABEL description="SPDK-CSI Plugin" COPY spdkcsi /usr/local/bin/spdkcsi RUN apk update && \ - apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid + apk add nvme-cli open-iscsi e2fsprogs xfsprogs blkid xfsprogs-extra e2fsprogs-extra ENTRYPOINT ["/usr/local/bin/spdkcsi"]