]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Update QEMU JSON balloon command handling
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 16 Feb 2010 16:31:19 +0000 (16:31 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 18 Feb 2010 11:17:14 +0000 (11:17 +0000)
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

index 49e037034463c800de11b857cb059c01e5e09e55..7b45594c5e45cbc5a209b0e4b05e92e6a9099ca9 100644 (file)
@@ -723,14 +723,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;
         }
     }
@@ -885,7 +885,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)