[libvirt] [PATCH 07/15] Wrap text mode monitor APIs, pass qemuMonitorPtr directly to APIs
Daniel Veillard
veillard at redhat.com
Wed Nov 4 16:23:30 UTC 2009
On Tue, Nov 03, 2009 at 02:50:01PM -0500, Daniel P. Berrange wrote:
> Change the QEMU driver to not directly invoke the text mode monitor
> APIs. Instead add a generic wrapper layer, which will eventually
> invoke either the text or JSON protocol code as needed. Pass an
> qemuMonitorPtr object into the monitor APIs instead of virDomainObjPtr
> to complete the de-coupling of the monitor impl from virDomainObj
> data structures
>
> * src/qemu/qemu_conf.h: Remove qemuDomainObjPrivate definition
> * src/qemu/qemu_driver.c: Add qemuDomainObjPrivate definition.
> Pass qemuMonitorPtr into all monitor APIs instead of the
> virDomainObjPtr instance.
> * src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h: Add thin
> wrappers for all qemuMonitorXXX command APIs, calling into
> qemu_monitor_text.c/h
> * src/qemu/qemu_monitor_text.c, src/qemu/qemu_monitor_text.h:
> Rename qemuMonitor -> qemuMonitorText & update to accept
> qemuMonitorPtr instead of virDomainObjPtr
[...]
> @@ -1192,7 +1199,7 @@ qemudInitCpus(virConnectPtr conn,
>
> if (migrateFrom == NULL) {
> /* Allow the CPUS to start executing */
> - if (qemuMonitorStartCPUs(conn, vm) < 0) {
> + if (qemuMonitorStartCPUs(priv->mon, conn) < 0) {
err args are really swapped now ? I gues steh compiled would complain
loudly if this wasn't the case ...
> - (qemuMonitorSetBalloon(vm, vm->def->memory) < 0) ||
> + (qemuMonitorSetBalloon(((qemuDomainObjPrivatePtr)vm->privateData)->mon, vm->def->memory) < 0) ||
any possibility to wrap to 80 ?
> if (vm->state == VIR_DOMAIN_PAUSED) {
> - if (qemuMonitorStartCPUs(dom->conn, vm) < 0) {
> + qemuDomainObjPrivatePtr priv = vm->privateData;
> + if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) {
apparently yes swapped now ...
> +
> +int
> +qemuMonitorStartCPUs(qemuMonitorPtr mon,
> + virConnectPtr conn)
> +{
> + DEBUG("mon=%p, fd=%d", mon, mon->fd);
> +
> + return qemuMonitorTextStartCPUs(mon, conn);
> +}
Okay ... qemuMonitorPtr is the first arg for all those entry points
now, makes sense...
ACK a fairly long patch but mostly automatic change and the addition
of the indirection, nothing really surprizing :-)
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