From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Lukáš Doktor" <ldoktor@redhat.com>, qemu-devel@nongnu.org
Cc: ehabkost@redhat.com, crosa@redhat.com
Subject: Re: [PATCH] python: Treat None-return of greeting cmd
Date: Thu, 30 Jan 2020 23:16:30 +0100 [thread overview]
Message-ID: <a9c347a1-6ee5-af0c-c1e5-6b5883fbd787@redhat.com> (raw)
In-Reply-To: <20200120071202.30646-1-ldoktor@redhat.com>
On 1/20/20 8:12 AM, Lukáš Doktor wrote:
> In case qemu process dies the "monitor.cmd" returns None which gets
> passed to the "__negotiate_capabilities" and leads to unhandled
> exception. Let's only check the resp in case it has a value.
>
> Signed-off-by: Lukáš Doktor <ldoktor@redhat.com>
> ---
> python/qemu/qmp.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/qemu/qmp.py b/python/qemu/qmp.py
> index 5c8cf6a056..a3e5de718a 100644
> --- a/python/qemu/qmp.py
> +++ b/python/qemu/qmp.py
> @@ -73,7 +73,7 @@ class QEMUMonitorProtocol(object):
> raise QMPConnectError
> # Greeting seems ok, negotiate capabilities
> resp = self.cmd('qmp_capabilities')
> - if "return" in resp:
> + if resp and "return" in resp:
> return greeting
> raise QMPCapabilitiesError
>
>
Thanks, applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next
prev parent reply other threads:[~2020-01-30 22:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 7:12 [PATCH] python: Treat None-return of greeting cmd Lukáš Doktor
2020-01-20 8:22 ` Philippe Mathieu-Daudé
2020-01-29 20:24 ` Wainer dos Santos Moschetta
2020-01-30 22:16 ` Philippe Mathieu-Daudé [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a9c347a1-6ee5-af0c-c1e5-6b5883fbd787@redhat.com \
--to=philmd@redhat.com \
--cc=crosa@redhat.com \
--cc=ehabkost@redhat.com \
--cc=ldoktor@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).