On Tue, Sep 29, 2009 at 12:12:23PM +0200, Daniel Veillard wrote: > 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 ! Ok, I've pushed all this stuff Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list