]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Don't fail virDomainGetInfo if we can't update balloon info
authorJiri Denemark <jdenemar@redhat.com>
Wed, 5 Oct 2011 14:07:36 +0000 (16:07 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 5 Oct 2011 14:41:48 +0000 (16:41 +0200)
Qemu driver tries to update balloon data in virDomainGetInfo and if it
can't do so because there is another monitor job running, it just
reports what's known in domain def. However, if there was no job running
but getting the data from qemu fails, we would fail the whole API. This
doesn't make sense. Let's make the failure nonfatal.

src/qemu/qemu_driver.c

index dc34e1d422fa6f80da9dd61767c1f43a200dc74b..276dc060bfc3454d2cf45b689a3a40a5bc4c6a39 100644 (file)
@@ -2083,13 +2083,18 @@ static int qemudDomainGetInfo(virDomainPtr dom,
                 goto cleanup;
             }
 
-            if (err < 0)
-                goto cleanup;
-            if (err == 0)
+            if (err < 0) {
+                /* We couldn't get current memory allocation but that's not
+                 * a show stopper; we wouldn't get it if there was a job
+                 * active either
+                 */
+                info->memory = vm->def->mem.cur_balloon;
+            } else if (err == 0) {
                 /* Balloon not supported, so maxmem is always the allocation */
                 info->memory = vm->def->mem.max_balloon;
-            else
+            } else {
                 info->memory = balloon;
+            }
         } else {
             info->memory = vm->def->mem.cur_balloon;
         }