[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making QEMU easier for management tools and applications
From: |
Kashyap Chamarthy |
Subject: |
Re: Making QEMU easier for management tools and applications |
Date: |
Mon, 20 Jan 2020 14:57:17 +0100 |
On Mon, Jan 20, 2020 at 09:55:54AM +0000, Stefan Hajnoczi wrote:
> On Thu, Jan 16, 2020 at 12:03:14PM +0100, Kashyap Chamarthy wrote:
[...]
> > I'm reasonably happy with it (particularly the persistent history
> > captured in ~/.qmp-shell_history), and it has some "known issues" that
> > can trip up a new user. The one that immediately jumps to mind:
> > asynchronous events won't be printed without a prompt from the user --
> > e.g. after a `blockdev-commit`, you won't see BLOCK_JOB_{READY,
> > COMPLETED} events printed unless you manually hit enter from the
> > 'qmp-shell'.
[...]
> John and I discussed async events in the past. qmp-shell currently uses
> the input() built-in function. If we modify it with a
> select(2)/poll(2)-style function that monitors both stdin and the QMP
> socket then it could print QMP events as soon as they are received.
>
> There might be a nicer way of doing it, but pseudo-code for the idea is:
>
> def input_with_events(prompt):
> while True:
> print(prompt, end='', flush=True)
> readable_files = select([sys.stdin, qmp_socket])
> if qmp_socket in readable_files:
> print_qmp_events()
>
> # stdin is ready, read a line
> return input()
Thanks for the suggestion. The Python 'select' module[1] indeed seems
to provide access to select() and poll() Linux system calls.
[1] https://docs.python.org/3/library/select.html
--
/kashyap
Re: Making QEMU easier for management tools and applications, Dr. David Alan Gilbert, 2020/01/02
Re: Making QEMU easier for management tools and applications, Dr. David Alan Gilbert, 2020/01/02
Re: Making QEMU easier for management tools and applications, Kevin Wolf, 2020/01/07
Re: Making QEMU easier for management tools and applications, Christophe de Dinechin, 2020/01/07