]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix memory reporting for inactive domains in the qemu driver.
authorCole Robinson <crobinso@redhat.com>
Mon, 22 Jun 2009 16:35:03 +0000 (16:35 +0000)
committerCole Robinson <crobinso@redhat.com>
Mon, 22 Jun 2009 16:35:03 +0000 (16:35 +0000)
Currently, 'info' will always report that mem = max mem. Make sure we
actually return the correct mem value.

ChangeLog
src/qemu_driver.c

index 28c3fe6eafbacc85d2ac0cb612bdc843ae2abed8..e462c5e233c4b0f262477193cba5001dff7ef2b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Jun 22 12:33:37 EDT 2009 Cole Robinson <crobinso@redhat.com>
+
+       * src/qemu_driver.c: Fix memory reporting for inactive domains
+       in the qemu driver.
+
+Currently, 'info' will always report that mem = max mem. Make sure we
+actually return the correct mem value.
+
 Mon Jun 22 12:31:38 EDT 2009 Cole Robinson <crobinso@redhat.com>
 
        * src/storage_backend_fs.c src/storage_driver.c:
index d3eb3adafdd272400f7551cd6fd5797e8d767bc9..4e3e531b4e755f6023e3371b4133c057b3577eb0 100644 (file)
@@ -2553,16 +2553,22 @@ static int qemudDomainGetInfo(virDomainPtr dom,
         }
     }
 
-    err = qemudDomainGetMemoryBalloon(dom->conn, vm, &balloon);
-    if (err < 0)
-        goto cleanup;
-
     info->maxMem = vm->def->maxmem;
-    if (err == 0)
-        /* Balloon not supported, so maxmem is always the allocation */
-        info->memory = vm->def->maxmem;
-    else
-        info->memory = balloon;
+
+    if (virDomainIsActive(vm)) {
+        err = qemudDomainGetMemoryBalloon(dom->conn, vm, &balloon);
+        if (err < 0)
+            goto cleanup;
+
+        if (err == 0)
+            /* Balloon not supported, so maxmem is always the allocation */
+            info->memory = vm->def->maxmem;
+        else
+            info->memory = balloon;
+    } else {
+        info->memory = vm->def->memory;
+    }
+
     info->nrVirtCpu = vm->def->vcpus;
     ret = 0;