On 02/06/2018 09:29 AM, Vladimir Sementsov-Ogievskiy wrote:
most of commands, ported to hmp are done in same style: they just call
corresponding qmp command.
Isn't it better to provide common interface for calling qmp commands
through
HMP monitor, to never
create hmp versions of new commands? they will be available
automatically.
It would be nice to do that, but they're not that consistent in how they
convert parameters and options, but I occasionally wonder if we could
automate more of it.
What about allowing some new syntax in hmp, directly mapped to qmp?
something like
>>> blockdev-add id disk driver qcow2 cache {writeback true direct
true} aio native discard unmap file {driver file filename /tmp/somedisk}
Personally, if I'm testing blockdev-add, I'll use QMP directly (or even
scripts/qmp/qmp-shell or virsh qemu-monitor-command), not an HMP wrapper
where I have to learn a new syntax of how to write something that will
convert to QMP. We already have enough different ways to write things
that I don't need to learn yet another syntax wrapper. Or maybe what
I'm saying is that instead of inventing a new syntax, that if you DO add
an HMP command that forwards to QMP, please reuse an existing syntax
(whether direct JSON as used by QMP, or the syntax used by qmp-shell).
If you think writing a new HMP command is worth it, I won't stop you
from writing it. But at this point, our current approach of writing a
manual wrapper per command as we have interest, rather than a generic
wrap-anything, has worked for the cases that HMP users have cared about.
Remember, QMP is the interface that MUST work, while HMP is only for
convenience, and if it is not trivial to make HMP do everything that QMP
can do, it is no real loss.
?
Or it may be realized as a separate hmp command "qmp" (looks more safe
as a first step, however, I think previous variant (direct call) is
better):
>>> qmp blockdev-add id disk driver qcow2 cache {writeback true direct
true} aio native discard unmap file {driver file filename /tmp/somedisk}
what do think? This looks simple to implement and should be useful.
Up to you if you want to tackle anything like that, but it would be a
new thread (a generic way to invoke QMP from HMP is independent of
nbd-server-remove).
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org