Skip to contentSkip to conversation

oeqa: drop support of listing machines in QEMU_USE_KVM

PATCH Superseded Chen Qi 2 participants 3 messages Dec 5, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chen Qi

author
#0 lore raw

cover oeqa: drop support of listing machines in QEMU_USE_KVM

Hi Yeoh Ee Peng,

meta/lib/oeqa/manual/bsp-qemu.json might need to be modified after this patch. But I don't know how it is used. Could you please help take care of it?

Best Regards,
Chen Qi

The following changes since commit 016e3dda2d6acc9b457079d11b5346a5352a431d:

btrfs-tools: update to 4.19 (2018-12-03 12:20:01 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/qemu_use_kvm
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/qemu_use_kvm

Chen Qi (1):
oeqa: drop support of listing machines in QEMU_USE_KVM

 meta/classes/testimage.bbclass | 12 ++++++------
 meta/lib/oeqa/targetcontrol.py | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/1 oeqa: drop support of listing machines in QEMU_USE_KVM

We want QEMU_USE_KVM to only set to some boolean value, with possible MACHINE override. Drop the support of listing machines in this variable, and give users error message if they still do so.

Error message below is an example.

ERROR: core-image-minimal-1.0-r0 do_testimage: Invalid boolean value 'intel-corei7-64 intel-core2-32 qemux86 qemux86-64' QEMU_USE_KVM needs to be set to a boolean value. It no longer supports accepting a list of machines.
e.g.
QEMU_USE_KVM_qemux86-64 = '1'
ERROR: core-image-minimal-1.0-r0 do_testimage: Function failed: do_testimage

---
 meta/classes/testimage.bbclass | 12 ++++++------
 meta/lib/oeqa/targetcontrol.py | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
meta/classes/testimage.bbclass +6 -6
index 82cbb06..7c3bc0a 100644
@@ -229,12 +229,12 @@ def testimage_main(d):
 
     # Get use_kvm
     qemu_use_kvm = d.getVar("QEMU_USE_KVM")
-    if qemu_use_kvm and \
-       (d.getVar('MACHINE') in qemu_use_kvm.split() or \
-        oe.types.boolean(qemu_use_kvm) and 'x86' in machine):
-        kvm = True
-    else:
-        kvm = False
+    try:
+        kvm = oe.types.boolean(qemu_use_kvm)
+    except ValueError as e:
+        bb.fatal("%s\nQEMU_USE_KVM needs to be set to a boolean value. It no longer supports accepting a list of machines.\n"
+                 "  e.g.\n"
+                 "  QEMU_USE_KVM_qemux86-64 = '1'" % e)
 
     slirp = False
     if d.getVar("QEMU_USE_SLIRP"):
meta/lib/oeqa/targetcontrol.py +6 -6
index 59a9c35..158a8b0 100644
@@ -108,12 +108,12 @@ class QemuTarget(BaseTarget):
         dump_host_cmds = d.getVar("testimage_dump_host")
         dump_dir = d.getVar("TESTIMAGE_DUMP_DIR")
         qemu_use_kvm = d.getVar("QEMU_USE_KVM")
-        if qemu_use_kvm and \
-           (oe.types.boolean(qemu_use_kvm) and "x86" in d.getVar("MACHINE") or \
-            d.getVar("MACHINE") in qemu_use_kvm.split()):
-            use_kvm = True
-        else:
-            use_kvm = False
+        try:
+            use_kvm = oe.types.boolean(qemu_use_kvm)
+        except ValueError as e:
+            bb.fatal("%s\nQEMU_USE_KVM needs to be set to a boolean value. It no longer supports accepting a list of machines.\n"
+                     "  e.g.\n"
+                     "  QEMU_USE_KVM_qemux86-64 = '1'" % e)
 
         # Log QemuRunner log output to a file
         import oe.path
Signature · 1 line
1.9.1
#2 lore raw
Quoted 42 lines · Chen Qi

We want QEMU_USE_KVM to only set to some boolean value, with possible MACHINE override. Drop the support of listing machines in this variable,
and give users error message if they still do so.

Error message below is an example.

ERROR: core-image-minimal-1.0-r0 do_testimage: Invalid boolean value 'intel-corei7-64 intel-core2-32 qemux86 qemux86-64' QEMU_USE_KVM needs to be set to a boolean value. It no longer supports accepting a list of machines.
e.g.
QEMU_USE_KVM_qemux86-64 = '1'
ERROR: core-image-minimal-1.0-r0 do_testimage: Function failed:
do_testimage

---
 meta/classes/testimage.bbclass | 12 ++++++------
 meta/lib/oeqa/targetcontrol.py | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)
meta/classes/testimage.bbclass +4 -6
index 82cbb06..7c3bc0a 100644
@@ -229,12 +229,12 @@ def testimage_main(d):
 
     # Get use_kvm
     qemu_use_kvm = d.getVar("QEMU_USE_KVM")
-    if qemu_use_kvm and \
-       (d.getVar('MACHINE') in qemu_use_kvm.split() or \
-        oe.types.boolean(qemu_use_kvm) and 'x86' in machine):
-        kvm = True
-    else:
-        kvm = False
+    try:
+        kvm = oe.types.boolean(qemu_use_kvm)
+    except ValueError as e:
+        bb.fatal("%s\nQEMU_USE_KVM needs to be set to a boolean

value. It no longer supports accepting a list of machines.\n"

meta/classes/testimage.bbclass

Quoted 2 lines
meta/classes/testimage.bbclass +2 -0
+                 "  e.g.\n"
+                 "  QEMU_USE_KVM_qemux86-64 = '1'" % e)

This drops the x86 piece above. The autobuilder sets:

QEMU_USE_KVM = "True"

which then fails for say qemuarm.

The x86 check is incorrect anyway, it needs to check the BUILD_ARCH is compatible with TARGET_ARCH.

We can't quite merge this as is though due to the autobuilder breakage.

Cheers,

Richard