From 6887125778cfcc9e36d2e62cfc80b43abe35c102 Mon Sep 17 00:00:00 2001 From: Zexi Li Date: Mon, 20 Jan 2025 10:22:08 +0800 Subject: [PATCH] fix(host): handle error not mounted (#21958) --- pkg/util/mountutils/mount.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/util/mountutils/mount.go b/pkg/util/mountutils/mount.go index 644cf4e8ea..15d0ad9d44 100644 --- a/pkg/util/mountutils/mount.go +++ b/pkg/util/mountutils/mount.go @@ -129,6 +129,11 @@ func unmount(mountPoint string, useLazy bool) error { } out, err := procutils.NewRemoteCommandAsFarAsPossible("umount", args...).Output() if err != nil { + //if strings.Contains(err.Error(), fmt.Sprintf("umount: %s", mountPoint)) && strings.Contains(err.Error(), "not mounted") { + if strings.Contains(string(out), "not mounted") { + // handle error like: 'umount: /opt/cloud/workspace/servers/2bc8dabf-88c7-448a-8f9e-cbf557acfde2/volumes/6a7ccfcc-a591-4cdd-8d3f-40fde1110870/data/data/com.douban.frodo/: not mounted.' + return nil + } return errors.Wrapf(err, "umount %s failed %s", mountPoint, out) } }