mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
add failure check on umount when kubeadm reset, and on service stop
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
This commit is contained in:
parent
1e9344e9cc
commit
06a6ec2181
@ -124,12 +124,17 @@ func (r *Reset) Run(out io.Writer) error {
|
|||||||
fmt.Printf("%v", err)
|
fmt.Printf("%v", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Stopping the %s service...\n", serviceToStop)
|
fmt.Printf("Stopping the %s service...\n", serviceToStop)
|
||||||
initSystem.ServiceStop(serviceToStop)
|
if err := initSystem.ServiceStop(serviceToStop); err != nil {
|
||||||
|
fmt.Printf("failed to stop the %s service", serviceToStop)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Unmounting directories in /var/lib/kubelet...\n")
|
fmt.Printf("Unmounting directories in /var/lib/kubelet...\n")
|
||||||
// Don't check for errors here, since umount will return a non-zero exit code if there is no directories to umount
|
umountDirsCmd := "cat /proc/mounts | awk '{print $2}' | grep '/var/lib/kubelet' | xargs -r umount"
|
||||||
exec.Command("sh", "-c", "cat /proc/mounts | awk '{print $2}' | grep '/var/lib/kubelet' | xargs umount").Run()
|
umountOutputBytes, err := exec.Command("sh", "-c", umountDirsCmd).Output()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Printf("failed to unmount directories in /var/lib/kubelet, %s", string(umountOutputBytes))
|
||||||
|
}
|
||||||
|
|
||||||
resetConfigDir("/etc/kubernetes/")
|
resetConfigDir("/etc/kubernetes/")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user