]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix handling return value of qemuMonitorSetBalloon
authorRyota Ozaki <ozaki.ryota@gmail.com>
Wed, 7 Oct 2009 13:33:36 +0000 (15:33 +0200)
committerDaniel Veillard <veillard@redhat.com>
Wed, 7 Oct 2009 13:33:36 +0000 (15:33 +0200)
* src/qemu/qemu_driver.c: The positive return value of
  qemuMonitorSetBalloon should be handled as a success

src/qemu/qemu_driver.c

index f03f0543113b3ddf99bd7bda0ef4f0e415a3c19d..8aff874ab9836a237a5d02059c629e3e8f2bc6e9 100644 (file)
@@ -3020,17 +3020,20 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
     }
 
     if (virDomainIsActive(vm)) {
-        ret = qemuMonitorSetBalloon(vm, newmem);
-        /* Turn lack of balloon support into a fatal error */
-        if (ret == 0) {
+        int r = qemuMonitorSetBalloon(vm, newmem);
+        if (r < 0)
+            goto cleanup;
+
+        /* Lack of balloon support is a fatal error */
+        if (r == 0) {
             qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
                              "%s", _("cannot set memory of an active domain"));
-            ret = -1;
+            goto cleanup;
         }
     } else {
         vm->def->memory = newmem;
-        ret = 0;
     }
+    ret = 0;
 
 cleanup:
     if (vm)