Skip to contentSkip to conversation

qemurunner.py: Support fallback to older QEMU qmp library

PATCH Mark Hatle 1 participant 1 message Dec 2, 2022 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Mark Hatle

author
#1 lore raw

Ping, any comments on this?

Quoted 44 lines · Mark Hatle

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.

---
  meta/lib/oeqa/utils/qemurunner.py | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
meta/lib/oeqa/utils/qemurunner.py +7 -2
index f175f8a1de..436caef273 100644
@@ -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
 
 
 
-=-=-=-=-=-=-=-=-=-=-=-

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/3616948
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-