qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH] python: add qmp-send program to send raw qmp commands to


From: Damien Hedde
Subject: Re: [RFC PATCH] python: add qmp-send program to send raw qmp commands to qemu
Date: Wed, 16 Mar 2022 15:16:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0



On 3/16/22 11:24, Daniel P. Berrangé wrote:
On Wed, Mar 16, 2022 at 10:54:55AM +0100, Damien Hedde wrote:
It takes an input file containing raw qmp commands (concatenated json
dicts) and send all commands one by one to a qmp server. When one
command fails, it exits.

As a convenience, it can also wrap the qemu process to avoid having
to start qemu in background. When wrapping qemu, the program returns
only when the qemu process terminates.

Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
---

Hi all,

Following our discussion, I've started this. What do you think ?

I tried to follow Daniel's qmp-shell-wrap. I think it is
better to have similar options (eg: logging). There is also room
for factorizing code if we want to keep them aligned and ease
maintenance.

Having CLI similarity to the existing scripts is a good idea.

As a proof of usefulness, it might be worth trying to illustrate
this qmp-send command by converting an I/O test.

Quite a few I/O tests have code that look like:

do_run_qemu()
{
     echo Testing: "$@" | _filter_imgfmt
     $QEMU -nographic -qmp stdio -serial none "$@"
     echo
}


run_qemu()
{
     do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp | 
_filter_qemu_io
}

run_qemu <<EOF
{ "execute": "qmp_capabilities" }
{ "execute": "blockdev-add",
    ....
}
{ "execute": "quit" }
EOF

(eg iotests 71)

I would hope this qmp-send command to be able to satisfy that
use case by modifying do_run_qemu like this:

do_run_qemu()
{
     echo Testing: "$@" | _filter_imgfmt
     qmp-send --wrap $QEMU -nographic -serial none "$@"
     echo
}

I need to add stdin handling, but it should be straightforward.

I'm more worried by what should happen if there is a failure that makes qemu hang, because then run_qemu won't exit. I'll take a look at the iotest. I expect the test will be killed at some point, I need to ensure that part is handled properly by qmp-send.

Thanks,
Damien



reply via email to

[Prev in Thread] Current Thread [Next in Thread]