mirror of
https://github.com/TECHNOFAB11/zfs-localpv.git
synced 2025-12-12 06:20:11 +01:00
fix(mount): fixing idempotency check for the mount path
Signed-off-by: Pawan <pawan@mayadata.io>
This commit is contained in:
parent
43553d6077
commit
b42893ce47
2 changed files with 21 additions and 16 deletions
1
changelogs/unreleased/260-pawanpraka1
Normal file
1
changelogs/unreleased/260-pawanpraka1
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
fixing idempotency check for the mount path
|
||||||
|
|
@ -144,8 +144,6 @@ func verifyMountRequest(vol *apis.ZFSVolume, mountpath string) (bool, error) {
|
||||||
return false, status.Errorf(codes.Internal, "verifyMount: GetVolumePath failed %s", err.Error())
|
return false, status.Errorf(codes.Internal, "verifyMount: GetVolumePath failed %s", err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
// if it is not a shared volume, then make sure it is not mounted to more than one path
|
|
||||||
if vol.Spec.Shared != "yes" {
|
|
||||||
/*
|
/*
|
||||||
* This check is the famous *Wall Of North*
|
* This check is the famous *Wall Of North*
|
||||||
* It will not let the volume to be mounted
|
* It will not let the volume to be mounted
|
||||||
|
|
@ -159,9 +157,15 @@ func verifyMountRequest(vol *apis.ZFSVolume, mountpath string) (bool, error) {
|
||||||
vol.Name, devicePath, err.Error())
|
vol.Name, devicePath, err.Error())
|
||||||
return false, status.Errorf(codes.Internal, "verifyMount: Getmounts failed %s", err.Error())
|
return false, status.Errorf(codes.Internal, "verifyMount: Getmounts failed %s", err.Error())
|
||||||
} else if len(currentMounts) >= 1 {
|
} else if len(currentMounts) >= 1 {
|
||||||
if currentMounts[0] == mountpath {
|
// if device is already mounted at the mount point, return successful
|
||||||
|
for _, mp := range currentMounts {
|
||||||
|
if mp == mountpath {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it is not a shared volume, then it should not mounted to more than one path
|
||||||
|
if vol.Spec.Shared != "yes" {
|
||||||
klog.Errorf(
|
klog.Errorf(
|
||||||
"can not mount, volume:%s already mounted dev %s mounts: %v",
|
"can not mount, volume:%s already mounted dev %s mounts: %v",
|
||||||
vol.Name, devicePath, currentMounts,
|
vol.Name, devicePath, currentMounts,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue