[libvirt] [PATCH] Update QEMU JSON balloon command handling

Daniel P. Berrange berrange at redhat.com
Thu Feb 18 11:09:11 UTC 2010


On Tue, Feb 16, 2010 at 05:48:41PM +0100, Daniel Veillard wrote:
> On Tue, Feb 16, 2010 at 04:32:34PM +0000, Daniel P. Berrange wrote:
> > The QEMU JSON monitor changed balloon commands to return/accept
> > bytes instead of kilobytes. Update libvirt to cope with this
> > 
> > * src/qemu/qemu_monitor_json.c: Expect/use bytes for ballooning
> > ---
> >  src/qemu/qemu_monitor_json.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> > index c20d063..4d52ad0 100644
> > --- a/src/qemu/qemu_monitor_json.c
> > +++ b/src/qemu/qemu_monitor_json.c
> > @@ -729,14 +729,14 @@ int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon,
> >                  goto cleanup;
> >              }
> >  
> > -            if (virJSONValueObjectGetNumberUlong(data, "balloon", &mem) < 0) {
> > +            if (virJSONValueObjectGetNumberUlong(data, "actual", &mem) < 0) {
> >                  qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> >                                  _("info balloon reply was missing balloon data"));
> 
>   shouldn't we also update the error message ?

Hehe, it was co-incidence that the word 'balloon' matching the data item
previously - I hadn't intended it that way :-)

> 
> >                  ret = -1;
> >                  goto cleanup;
> >              }
> >  
> > -            *currmem = mem;
> > +            *currmem = (mem/1024);
> >              ret = 1;
> >          }
> >      }
> > @@ -891,7 +891,7 @@ int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
> >  {
> >      int ret;
> >      virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("balloon",
> > -                                                     "U:value", (unsigned long long)newmem,
> > +                                                     "U:value", ((unsigned long long)newmem)*1024,
> >                                                       NULL);
> >      virJSONValuePtr reply = NULL;
> >      if (!cmd)
> 
> ACK,

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 :|




More information about the libvir-list mailing list