mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Correct detection of 'not mounted' behavior -- umount will exit with a non-zero code.
This commit is contained in:
parent
9c151bb31a
commit
6b44c0debb
@ -247,16 +247,14 @@ func detectSafeNotMountedBehavior() bool {
|
|||||||
cmd := exec.Command("umount", path)
|
cmd := exec.Command("umount", path)
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
klog.V(2).Infof("Cannot run umount to detect safe 'not mounted' behavior: %v", err)
|
if strings.Contains(string(output), errNotMounted) {
|
||||||
klog.V(4).Infof("'umount %s' output: %s, failed with: %v", path, string(output), err)
|
klog.V(2).Infof("Detected umount with safe 'not mounted' behavior")
|
||||||
return false
|
return true
|
||||||
|
}
|
||||||
|
klog.V(4).Infof("'umount %s' failed with: %v, output: %s", path, err, string(output))
|
||||||
}
|
}
|
||||||
if !strings.Contains(string(output), errNotMounted) {
|
klog.V(2).Infof("Detected umount with unsafe 'not mounted' behavior")
|
||||||
klog.V(2).Infof("Detected umount with unsafe 'not mounted' behavior")
|
return false
|
||||||
return false
|
|
||||||
}
|
|
||||||
klog.V(2).Infof("Detected umount with safe 'not mounted' behavior")
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MakeMountArgs makes the arguments to the mount(8) command.
|
// MakeMountArgs makes the arguments to the mount(8) command.
|
||||||
|
Loading…
Reference in New Issue
Block a user