From 025520f7fd3aeb5ed53b468b5e494b1bbb6674ae Mon Sep 17 00:00:00 2001 From: jiangpengfei Date: Sat, 25 Jul 2020 11:25:34 +0800 Subject: [PATCH 04/50] kata-runtime: keep the process name of qemu same as configured path reason: inorder to make testcase scripts can use the same hypervisor name no matter what version hypervisor use, keep the process name of hypervisor same as configured path in the configuration.toml file instead of the resolved path of symbol link. Signed-off-by: jiangpengfei --- pkg/katautils/config.go | 8 +++++++- pkg/katautils/config_test.go | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/pkg/katautils/config.go b/pkg/katautils/config.go index 14794a24..349e667f 100644 --- a/pkg/katautils/config.go +++ b/pkg/katautils/config.go @@ -10,6 +10,7 @@ import ( "errors" "fmt" "io/ioutil" + "path/filepath" goruntime "runtime" "strings" @@ -172,7 +173,12 @@ func (h hypervisor) path() (string, error) { p = defaultHypervisorPath } - return ResolvePath(p) + absolutePath, err := filepath.Abs(p) + if err != nil { + return "", err + } + + return absolutePath, nil } func (h hypervisor) ctlpath() (string, error) { diff --git a/pkg/katautils/config_test.go b/pkg/katautils/config_test.go index 221a4b55..2eae1f6a 100644 --- a/pkg/katautils/config_test.go +++ b/pkg/katautils/config_test.go @@ -1061,12 +1061,12 @@ func TestHypervisorDefaultsHypervisor(t *testing.T) { assert.NoError(err) assert.Equal(p, defaultHypervisorPath, "default hypervisor path wrong") - // test path resolution + // test path resolution, just return the absolute path instead of resolved path defaultHypervisorPath = testHypervisorLinkPath h = hypervisor{} p, err = h.path() assert.NoError(err) - assert.Equal(p, testHypervisorPath) + assert.Equal(p, testHypervisorLinkPath) } func TestHypervisorDefaultsKernel(t *testing.T) { -- 2.14.3 (Apple Git-98)