Skip to content

Disable uuid checks on XFS #788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pkg/gce-pd-csi-driver/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ func (ns *GCENodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePub
}

klog.V(4).Infof("NodePublishVolume with filesystem %s", fstype)

for _, flag := range mnt.MountFlags {
options = append(options, flag)
}
options = append(options, collectMountOptions(fstype, mnt.MountFlags)...)

sourcePath = stagingTargetPath
if err := preparePublishPath(targetPath, ns.Mounter); err != nil {
Expand Down Expand Up @@ -307,9 +304,7 @@ func (ns *GCENodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStage
if mnt.FsType != "" {
fstype = mnt.FsType
}
for _, flag := range mnt.MountFlags {
options = append(options, flag)
}
options = collectMountOptions(fstype, mnt.MountFlags)
} else if blk := volumeCapability.GetBlock(); blk != nil {
// Noop for Block NodeStageVolume
klog.V(4).Infof("NodeStageVolume succeeded on %v to %s, capability is block so this is a no-op", volumeID, stagingTargetPath)
Expand Down
19 changes: 19 additions & 0 deletions pkg/gce-pd-csi-driver/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import (
"k8s.io/klog"
)

const (
fsTypeXFS = "xfs"
)

var ProbeCSIFullMethod = "/csi.v1.Identity/Probe"

func NewVolumeCapabilityAccessMode(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability_AccessMode {
Expand Down Expand Up @@ -155,3 +159,18 @@ func getMultiWriterFromCapabilities(vcs []*csi.VolumeCapability) (bool, error) {
}
return false, nil
}

func collectMountOptions(fsType string, mntFlags []string) []string {
var options []string

for _, opt := range mntFlags {
options = append(options, opt)
}

// By default, xfs does not allow mounting of two volumes with the same filesystem uuid.
// Force ignore this uuid to be able to mount volume + its clone / restored snapshot on the same node.
if fsType == fsTypeXFS {
options = append(options, "nouuid")
}
return options
}