From: Steven Sistare <steven.sistare@oracle.com>
To: John Snow <jsnow@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH V2] python/machine: QEMUMachine reopen_qmp_connection
Date: Tue, 7 Feb 2023 16:04:26 -0500 [thread overview]
Message-ID: <020941fe-f01f-ed97-6fd1-9ad217c698eb@oracle.com> (raw)
In-Reply-To: <CAFn=p-ZCA42VAMEkg8xQeTQBTMqn1AA7RjptkWD72uwBX+iKPA@mail.gmail.com>
On 2/7/2023 3:28 PM, John Snow wrote:
> On Tue, Feb 7, 2023 at 2:03 PM Steve Sistare <steven.sistare@oracle.com> wrote:
>>
>> Provide reopen_qmp_connection() to reopen a closed monitor connection.
>> This will be needed by cpr, because qemu exec closes the monitor socket.
>>
>> Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
>> Reviewed-by: John Snow <jsnow@redhat.com>
>> ---
>> python/qemu/machine/machine.py | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/python/qemu/machine/machine.py b/python/qemu/machine/machine.py
>> index ef94dcf..557209a 100644
>> --- a/python/qemu/machine/machine.py
>> +++ b/python/qemu/machine/machine.py
>> @@ -501,6 +501,16 @@ def _close_qmp_connection(self) -> None:
>> finally:
>> self._qmp_connection = None
>>
>> + def reopen_qmp_connection(self) -> None:
>> + """Close and re-open the QMP connection."""
>> + self._close_qmp_connection()
>> + self._qmp_connection = QEMUMonitorProtocol(
>> + self._monitor_address,
>> + server=True,
>> + nickname=self._name
>> + )
>> + self._qmp.accept(self._qmp_timer)
>> +
>> def _early_cleanup(self) -> None:
>> """
>> Perform any cleanup that needs to happen before the VM exits.
>> --
>> 1.8.3.1
>>
>
> This code is still mechanically fine as far as I can tell, but I lost
> the plot on why it's needed - Can you please elaborate for me on what
> you mean by "qemu exec will close the socket"?
>
> (R-B still stands, but since I am rewriting machine.py to be natively
> async, I should be aware of your new use case.)
Sure, thanks for asking.
During cpr (aka live update), the old qemu process directly execv's the new
qemu binary. The monitor socket fd is marked cloexec, so the kernel closes it
during execv.
- Steve
next prev parent reply other threads:[~2023-02-07 21:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 19:03 [PATCH V2] python/machine: QEMUMachine reopen_qmp_connection Steve Sistare
2023-02-07 20:28 ` John Snow
2023-02-07 21:04 ` Steven Sistare [this message]
2023-02-07 21:23 ` John Snow
2023-02-07 21:32 ` Steven Sistare
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=020941fe-f01f-ed97-6fd1-9ad217c698eb@oracle.com \
--to=steven.sistare@oracle.com \
--cc=jsnow@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).