This patch adds better checking on the CPU flags (explicit AMD CPU flag is checked, rather than assumed as a fallback).
Thus, when constructing the list of KVM modules to load (kvm, kvm-<cpu>), a test error is raised if the CPU was not properly detected. Signed-off-by: Cleber Rosa <cr...@redhat.com> --- client/tests/kvm/installer.py | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/client/tests/kvm/installer.py b/client/tests/kvm/installer.py index a757223..4f863f9 100644 --- a/client/tests/kvm/installer.py +++ b/client/tests/kvm/installer.py @@ -38,11 +38,16 @@ def kill_qemu_processes(): def cpu_vendor(): - vendor = "intel" - if os.system("grep vmx /proc/cpuinfo 1>/dev/null") != 0: - vendor = "amd" - logging.debug("Detected CPU vendor as '%s'", vendor) - return vendor + flag_vendor_map = { "vmx" : "intel", + "svm" : "amd" } + + for flag, vendor in flag_vendor_map.items(): + if os.system("grep %s /proc/cpuinfo 1>/dev/null" % flag) == 0: + logging.debug("Detected CPU vendor as '%s'", vendor) + return vendor + + logging.error("Could not detect CPU vendor: returning it as 'unknown'") + return "unknown" def _unload_kvm_modules(mod_list): @@ -244,6 +249,10 @@ class BaseInstaller(object): def _module_list(self): """Generate the list of modules that need to be loaded """ + if self.cpu_vendor == 'unknown': + raise error.TestError("CPU vendor is unknown: unable to generate " + "kvm module list") + yield 'kvm' yield 'kvm-%s' % (self.cpu_vendor) if self.extra_modules: -- 1.7.1 _______________________________________________ Autotest mailing list Autotest@test.kernel.org http://test.kernel.org/cgi-bin/mailman/listinfo/autotest