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

[libvirt] [PATCH 00/27] Refactor QEMU monitor command handling

In the QEMU driver source code the methods which talk to the QEMU
monitor currently all just call qemudMonitorCommand() directly
with the raw command string, and then parse the raw reply.

In the not too distant future QEMU is introducing a new machine
parsable monitor syntax. With the current way the code is structured
supporting this new mode will be seriously unpleasant.

This large series of patches, moves all the monitor command 
formatting and parsing code out into a separate source file
src/qemu/qemu_monitor_text.c.  There is one API in that file
for each logical monitor command we wish to issue, accepting
(mostly) strongly typed arguments. The exception is the NIC
hotplug method which still takes the raw NIC string for now.

The main qemu_driver.c file now directly calls the appropriate
monitor command APIs, making logic there much cleaner.

When we add support for the new QEMU monitor syntax we'll gain
another file src/qemu/qemu_monitor_json.c  which implements all
the same APIs as src/qemu/qemu_monitor_text.c, but using the
new JSON syntax instead of raw text strings

This patch series is soooooo large, because I did it in many
small steps, one command at a time.

It is also now much easier to debug the monitor by just setting
the env variables


And you'll get the command & reply of each monitor interaction

I've tested basic handling of every new method with the exception
of the migration ones, since I don't have a convenient target host
when on my laptop.

Overall we get a small increase in code size, but huge increase
in readability !

 Makefile.am              |    1 
 libvirt_private.syms     |    1 
 qemu/qemu_conf.c         |   20 
 qemu/qemu_conf.h         |    2 
 qemu/qemu_driver.c       | 1669 +++++---------------------------------------
 qemu/qemu_monitor_text.c | 1777 +++++++++++++++++++++++++++++++++++++++++++++++
 qemu/qemu_monitor_text.h |  173 ++++
 7 files changed, 2171 insertions(+), 1472 deletions(-)


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