python/machine: Handle QMP errors on close more meticulously
authorJohn Snow <jsnow@redhat.com>
Tue, 26 Oct 2021 17:56:06 +0000 (13:56 -0400)
committerJohn Snow <jsnow@redhat.com>
Mon, 1 Nov 2021 15:54:59 +0000 (11:54 -0400)
commit49a608b8c22db72d47e7676ff9c3b87d1d408736
treec1eaa16e66fc8d1d887e3d45dfd16ba5d849fa98
parentb9420e4f4b899c96221fa5a1f7f025214e756c50
python/machine: Handle QMP errors on close more meticulously

To use the AQMP backend, Machine just needs to be a little more diligent
about what happens when closing a QMP connection. The operation is no
longer a freebie in the async world; it may return errors encountered in
the async bottom half on incoming message receipt, etc.

(AQMP's disconnect, ultimately, serves as the quiescence point where all
async contexts are gathered together, and any final errors reported at
that point.)

Because async QMP continues to check for messages asynchronously, it's
almost certainly likely that the loop will have exited due to EOF after
issuing the last 'quit' command. That error will ultimately be bubbled
up when attempting to close the QMP connection. The manager class here
then is free to discard it -- if it was expected.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Hanna Reitz <hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Message-id: 20211026175612.4127598-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
python/qemu/machine/machine.py