kata-containers/runtime/patches/0004-kata-runtime-keep-the-process-name-of-qemu-same-as-c.patch
jiangpengfei 9a08f603ad kata-containers: move all kata related source repo into one repo kata-containers
reason: in order to make manage kata-containers related source code more easy,
we decide to move all kata related source repo into kata-containers repo.

Signed-off-by: jiangpengfei <jiangpengfei9@huawei.com>
2020-12-31 17:34:19 +08:00

66 lines
1.9 KiB
Diff

From 025520f7fd3aeb5ed53b468b5e494b1bbb6674ae Mon Sep 17 00:00:00 2001
From: jiangpengfei <jiangpengfei9@huawei.com>
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 <jiangpengfei9@huawei.com>
---
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)