mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-10 00:10:20 +00:00
cephfs: check only the stderror message for umount
if the cephfs mountpoint is not mounted the umount call will fail with both stderr and err, an error (exit status 32) and stdError (umount: /var/lib/kubelet/plugins/kubernetes.io/csi/pv/pvc-e622cd2b-0b87-4f49-a709-b89664ca6ec4/globalmount: not mounted. checking stderr is sufficient to find out the mountpoint is not mounted. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
parent
09c303c2cb
commit
83fbbd6d93
@ -258,7 +258,7 @@ func bindMount(ctx context.Context, from, to string, readOnly bool, mntOptions [
|
|||||||
|
|
||||||
func unmountVolume(ctx context.Context, mountPoint string) error {
|
func unmountVolume(ctx context.Context, mountPoint string) error {
|
||||||
if err := execCommandErr(ctx, "umount", mountPoint); err != nil {
|
if err := execCommandErr(ctx, "umount", mountPoint); err != nil {
|
||||||
if strings.Contains(err.Error(), fmt.Sprintf("exit status 32: umount: %s: not mounted", mountPoint)) ||
|
if strings.Contains(err.Error(), fmt.Sprintf("umount: %s: not mounted", mountPoint)) ||
|
||||||
strings.Contains(err.Error(), "No such file or directory") {
|
strings.Contains(err.Error(), "No such file or directory") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user