Skip to content

Commit

Permalink
fix xfs mount issues
Browse files Browse the repository at this point in the history
  • Loading branch information
happytreees committed May 13, 2024
1 parent 6c4c38f commit f461919
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 308 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM alpine:latest
FROM alpine:3.18

RUN apk update
RUN apk add --no-cache ca-certificates e2fsprogs findmnt bind-tools e2fsprogs-extra xfsprogs blkid
RUN apk add --no-cache ca-certificates e2fsprogs findmnt bind-tools e2fsprogs-extra xfsprogs xfsprogs-extra blkid

ADD csi-vultr-plugin /
ENTRYPOINT ["/csi-vultr-plugin"]
3 changes: 1 addition & 2 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ type VultrDriver struct {
isController bool
waitTimeout time.Duration

log *logrus.Entry
vMounter Mounter
log *logrus.Entry

mounter *mount.SafeFormatAndMount
resizer *mount.ResizeFs
Expand Down
300 changes: 0 additions & 300 deletions driver/mounter.go

This file was deleted.

12 changes: 8 additions & 4 deletions driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const (
diskPath = "/dev/disk/by-id"
diskPrefix = "virtio-"

mkDirMode = 0750

maxVolumesPerNode = 11

volumeModeBlock = "block"
Expand Down Expand Up @@ -65,22 +67,24 @@ func (n *VultrNodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStag
source := getDeviceByPath(volumeID)
target := req.StagingTargetPath
mountBlk := req.VolumeCapability.GetMount()
options := mountBlk.MountFlags
// options := mountBlk.MountFlags

fsTpe := "ext4"
fsType := "ext4"
if mountBlk.FsType != "" {
fsTpe = mountBlk.FsType
fsType = mountBlk.FsType
}

n.Driver.log.WithFields(logrus.Fields{
"volume": req.VolumeId,
"target": req.StagingTargetPath,
"capacity": req.VolumeCapability,
}).Infof("Node Stage Volume: creating directory target %s\n", target)

err := os.MkdirAll(target, mkDirMode)
if err != nil {
return nil, status.Error(codes.Internal, err.Error())
}

n.Driver.log.WithFields(logrus.Fields{
"volume": req.VolumeId,
"target": req.StagingTargetPath,
Expand All @@ -93,7 +97,7 @@ func (n *VultrNodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStag
"capacity": req.VolumeCapability,
}).Info("Node Stage Volume: attempting format and mount")

if err := n.Driver.mounter.FormatAndMount(source, target, fsTpe, options); err != nil {
if err := n.Driver.mounter.FormatAndMount(source, target, fsType, nil); err != nil {
return nil, status.Error(codes.Internal, err.Error())
}

Expand Down

0 comments on commit f461919

Please sign in to comment.