From: Mark Hatle <[email protected]>

Some vendor versions of QEMU may be on older versions that do not have
qmp.legacy, but instead of qmp.  Default to the integrated library
versions, fall back to the older one and then if neither is available
catch the exception and provide a more human readable error.

Signed-off-by: Mark Hatle <[email protected]>
Signed-off-by: Mark Hatle <[email protected]>
---
 meta/lib/oeqa/utils/qemurunner.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oeqa/utils/qemurunner.py 
b/meta/lib/oeqa/utils/qemurunner.py
index f175f8a1de..436caef273 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -328,8 +328,14 @@ class QemuRunner:
         try:
             os.chdir(os.path.dirname(qmp_port))
             try:
-               from qmp.legacy import QEMUMonitorProtocol
+               try:
+                   from qmp.legacy import QEMUMonitorProtocol
+               except ModuleNotFoundError:
+                   from qmp import QEMUMonitorProtocol
                self.qmp = QEMUMonitorProtocol(os.path.basename(qmp_port))
+            except ModuleNotFoundError as msg:
+                self.logger.warning("Failed to load QEMUMonitorProtocol from 
qmp.legacy or qmp: %s" % (msg))
+                return False
             except OSError as msg:
                 self.logger.warning("Failed to initialize qemu monitor socket: 
%s File: %s" % (msg, msg.filename))
                 return False
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173661): 
https://lists.openembedded.org/g/openembedded-core/message/173661
Mute This Topic: https://lists.openembedded.org/mt/95180018/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to