From 51d4f402c8e4974c7d7c7d949b4ed7b906491075 Mon Sep 17 00:00:00 2001 From: Nitesh Konkar Date: Mon, 29 Oct 2018 18:56:26 +0530 Subject: [PATCH] ppc64le: kata-env fails due to missing vendor field There is no vendor field in /proc/cpuinfo contents on ppc64le. Make sure the check is only for arm and amd64. Fixes: #864 Signed-off-by: Nitesh Konkar niteshkonkar@in.ibm.com --- cli/kata-check.go | 9 +-------- cli/kata-check_ppc64le.go | 4 ++-- cli/utils.go | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/cli/kata-check.go b/cli/kata-check.go index 8f6b1057c1..6bae3e1307 100644 --- a/cli/kata-check.go +++ b/cli/kata-check.go @@ -75,14 +75,7 @@ func getCPUInfo(cpuInfoFile string) (string, error) { return "", err } - cpus := strings.SplitAfter(text, "\n\n") - - trimmed := strings.TrimSpace(cpus[0]) - if trimmed == "" { - return "", fmt.Errorf("Cannot determine CPU details") - } - - return trimmed, nil + return text, nil } // findAnchoredString searches haystack for needle and returns true if found diff --git a/cli/kata-check_ppc64le.go b/cli/kata-check_ppc64le.go index 627a7e9dde..f33ec09f82 100644 --- a/cli/kata-check_ppc64le.go +++ b/cli/kata-check_ppc64le.go @@ -15,8 +15,8 @@ import ( const ( cpuFlagsTag = genericCPUFlagsTag - archCPUVendorField = genericCPUVendorField - archCPUModelField = genericCPUModelField + archCPUVendorField = "" + archCPUModelField = "model" ) var ( diff --git a/cli/utils.go b/cli/utils.go index b13dff9338..1cdae0810e 100644 --- a/cli/utils.go +++ b/cli/utils.go @@ -150,7 +150,7 @@ func genericGetCPUDetails() (vendor, model string, err error) { } } - if vendor == "" { + if archCPUVendorField != "" && vendor == "" { return "", "", fmt.Errorf("cannot find vendor field in file %v", procCPUInfo) }