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

Daniel Veillard veillard at redhat.com
Tue Sep 29 10:12:23 UTC 2009


On Thu, Sep 24, 2009 at 04:00:02PM +0100, Daniel P. Berrange wrote:
> 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
> 
> LIBVIRT_LOG_OUTPUTS="1:stderr" LIBVIRT_LOG_FILTERS="1:qemu_monitor"
> 
> And you'll get the command & reply of each monitor interaction
> printed
> 
> 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 !

  ACK, I see that Mark made a detailed code review already,
  this all looks fine to me !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list