From dd75e4d4f90bd1f2721e33e4939891aa38d75d6f Mon Sep 17 00:00:00 2001 From: wanyaoqi <18528551+wanyaoqi@users.noreply.github.com> Date: Sun, 26 Jan 2025 19:57:54 +0800 Subject: [PATCH] fix(glance): donot umount s3fs on glance exit (#22037) --- pkg/image/service/service.go | 6 +++--- pkg/util/procutils/cmdsetenv_others.go | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/pkg/image/service/service.go b/pkg/image/service/service.go index 09579e38cf..77a57006d8 100644 --- a/pkg/image/service/service.go +++ b/pkg/image/service/service.go @@ -176,9 +176,9 @@ func StartService() { if options.Options.EnableTorrentService { torrent.StopTorrents() } - if options.Options.StorageDriver == api.IMAGE_STORAGE_DRIVER_S3 { - procutils.NewCommand("umount", options.Options.S3MountPoint).Run() - } + //if options.Options.StorageDriver == api.IMAGE_STORAGE_DRIVER_S3 { + // procutils.NewCommand("umount", options.Options.S3MountPoint).Run() + //} }) } diff --git a/pkg/util/procutils/cmdsetenv_others.go b/pkg/util/procutils/cmdsetenv_others.go index 58a3d0a79d..3aa7f4e99c 100644 --- a/pkg/util/procutils/cmdsetenv_others.go +++ b/pkg/util/procutils/cmdsetenv_others.go @@ -18,8 +18,10 @@ package procutils import ( + "fmt" "os" "os/exec" + "strings" "yunion.io/x/executor/client" ) @@ -37,9 +39,19 @@ func cmdSetEnv(cmd *exec.Cmd) { ) } +var paths = []string{ + "/usr/bin", + "/usr/sbin", + "/usr/local/sbin", + "/usr/local/bin", + "/sbin", + "/bin", + "/opt/yunion/bin", +} + func remoteCmdSetEnv(cmd *client.Cmd) { - cmd.Env = append( - os.Environ(), - presetEnv..., - ) + envs := []string{ + fmt.Sprintf("PATH=%s", strings.Join(paths, ":")), + } + cmd.Env = append(envs, presetEnv...) }