]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Revert "LXC: show used memory as 0 when domain is not active"
authorJim Fehlig <jfehlig@suse.com>
Mon, 10 Aug 2015 18:49:55 +0000 (12:49 -0600)
committerJim Fehlig <jfehlig@suse.com>
Fri, 28 Aug 2015 16:44:07 +0000 (10:44 -0600)
This reverts commit 1ce7c1d20cfd5afb26d2dbc88201085d52415d0e,
which introduced a significant semantic change to the
virDomainGetInfo() API. Additionally, the change was only
made to 2 of the 15 virt drivers.

Conflicts:
src/qemu/qemu_driver.c

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
(cherry picked from commit 60acb38abbee1636a9cddf8d296f700d115c8f77)

src/lxc/lxc_driver.c
src/qemu/qemu_driver.c

index cc1277bddc594fd983608feaea3c971b5c8e666f..5929df5f9f511031206729e0390fc8faab7f02bb 100644 (file)
@@ -597,7 +597,7 @@ static int lxcDomainGetInfo(virDomainPtr dom,
 
     if (!virDomainObjIsActive(vm)) {
         info->cpuTime = 0;
-        info->memory = 0;
+        info->memory = vm->def->mem.cur_balloon;
     } else {
         if (virCgroupGetCpuacctUsage(priv->cgroup, &(info->cpuTime)) < 0) {
             virReportError(VIR_ERR_OPERATION_FAILED,
index 7a04e6720b5043897e12de00be584c929b70b63b..54a61fc9d80e67409fd37315e8ac3b2363ad077e 100644 (file)
@@ -2641,13 +2641,13 @@ qemuDomainGetInfo(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (virDomainObjIsActive(vm)) {
-        if (VIR_ASSIGN_IS_OVERFLOW(info->memory, vm->def->mem.cur_balloon)) {
-            virReportError(VIR_ERR_OVERFLOW, "%s",
-                           _("Current memory size too large"));
-            goto cleanup;
-        }
+    if (VIR_ASSIGN_IS_OVERFLOW(info->memory, vm->def->mem.cur_balloon)) {
+        virReportError(VIR_ERR_OVERFLOW, "%s",
+                       _("Current memory size too large"));
+        goto cleanup;
+    }
 
+    if (virDomainObjIsActive(vm)) {
         if (qemuGetProcessInfo(&(info->cpuTime), NULL, NULL, vm->pid, 0) < 0) {
             virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                            _("cannot read cputime for domain"));