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

Daniel P. Berrange berrange at redhat.com
Tue Feb 16 16:32:34 UTC 2010


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"));
                 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)
-- 
1.6.2.5




More information about the libvir-list mailing list