δΊ 2013/3/26 2:37, Lucas Meneghel Rodrigues ει:
On Fri, Mar 22, 2013 at 5:36 AM, Mike Qiu <[email protected]> wrote:
From: Mike Qiu <[email protected]>
Currently, autotest support amd and intel's X86 cpu type, IBM Power
cpus will be configure as 'unknown'.
Add pattern to deal with the cpuinfo of power, so that can figure
out the vendor IBM.
Signed-off-by: Mike Qiu <[email protected]>
---
virttest/utils_misc.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/virttest/utils_misc.py b/virttest/utils_misc.py
index 2eba264..f1904dc 100644
--- a/virttest/utils_misc.py
+++ b/virttest/utils_misc.py
@@ -556,11 +556,14 @@ def get_cpu_flags():
"""
Returns a list of the CPU flags
"""
- flags_re = re.compile(r'^flags\s*:(.*)')
+ flags_re = re.compile(r'^flags\s*:(.*)|^cpu\s*:(.*)')
for line in open('/proc/cpuinfo').readlines():
match = flags_re.match(line)
if match:
- return match.groups()[0].split()
+ if match.groups()[0]:
+ return match.groups()[0].split()
+ else:
+ return match.groups()[1].strip().split(', ')
return []
^ Indentation is off, here's a diff of what it needs to be fixed:
diff --git a/virttest/utils_misc.py b/virttest/utils_misc.py
index f1904dc..19f985a 100644
--- a/virttest/utils_misc.py
+++ b/virttest/utils_misc.py
@@ -561,9 +561,9 @@ def get_cpu_flags():
match = flags_re.match(line)
if match:
if match.groups()[0]:
- return match.groups()[0].split()
+ return match.groups()[0].split()
else:
- return match.groups()[1].strip().split(', ')
+ return match.groups()[1].strip().split(', ')
return []
@@ -575,6 +578,8 @@ def get_cpu_vendor(cpu_flags=[], verbose=True):
vendor = 'intel'
elif 'svm' in cpu_flags:
vendor = 'amd'
+ elif 'POWER' in cpu_flags:
+ vendor = 'IBM'
^ As far as I know, CPU flags don't come capitalized, do they?
Yes, for ppc64 especially POWER7 cpus, it haven't the CPU flags, as it
can get the vendor,
I just try to find out the string can show the ARCH.
Anyway, I will send out the new patch to add the new api to decide the
platform, and makes it
workable for both ppc64( now just support POWER7 cpu) and x86_64.
Also, if you verify, in some parts of the code where we call
get_cpu_vendor, you'll notice that the code expects a result in lower
case:
check_modules = ["kvm", "kvm-%s" % utils_misc.get_cpu_vendor(verbose=False)]
This will be fixed in next version.
In the code above, is the name of the kvm module on ppc64 kvm-IBM? I
don't think so.
So you need to take into account all callers here. Also, I'd like you
to add a unittest to utils_misc_unittest with the cpu flags expected
to be found on a power 7 machine, then calling the function and have
it return the proper value.
As Power cpus does not have cpu flags, so I think no need to do some
change to the
utils_misc_unittest.
_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel