[Libvir] [PATCH] Fix dom0 maxmem display for memmax not set case

Atsushi SAKAI sakaia at jp.fujitsu.com
Thu Mar 15 12:36:12 UTC 2007


Hi, 

This patch intends to fix dom0 maxmem display.

If we do NOT set maximum memory, 
max_pages (in Xen) are set maximum value(0xFFFFFFFF). 
This display confuses user.
For x86 cases, following data are shown on "virsh dominfo 0"
(please case 4kb page size This case max_pages x 4 is output).
Max memory:    4294967292 kB
This patch fix as follows
Max memory:    no limit
(This comment is taken from xentop :-))

This problem is already cared on xentop (Xen performance tool).

Signed-off-by: Atsushi SAKAI <sakaia at jp.fujitsu.com>


Thanks
Atsushi SAKAI


diff -urpN libvirt.orig/src/virsh.c libvirt/src/virsh.c
--- libvirt.orig/src/virsh.c	2007-03-09 22:44:24.000000000 +0900
+++ libvirt/src/virsh.c	2007-03-15 20:13:04.000000000 +0900
@@ -1186,8 +1186,13 @@ cmdDominfo(vshControl * ctl, vshCmd * cm
             vshPrint(ctl, "%-15s %.1lfs\n", _("CPU time:"), cpuUsed);
         }
 
-        vshPrint(ctl, "%-15s %lu kB\n", _("Max memory:"),
+        if (info.maxMem != UINT_MAX)
+            vshPrint(ctl, "%-15s %lu kB\n", _("Max memory:"),
                  info.maxMem);
+        else
+            vshPrint(ctl, "%-15s %-15s\n", _("Max memory:"),
+                 _("no limit"));
+
         vshPrint(ctl, "%-15s %lu kB\n", _("Used memory:"),
                  info.memory);
 
diff -urpN libvirt.orig/src/xen_internal.c libvirt/src/xen_internal.c
--- libvirt.orig/src/xen_internal.c	2007-03-15 16:43:16.000000000 +0900
+++ libvirt/src/xen_internal.c	2007-03-15 19:38:17.000000000 +0900
@@ -1598,7 +1598,9 @@ xenHypervisorGetDomInfo(virConnectPtr co
      */
     info->cpuTime = XEN_GETDOMAININFO_CPUTIME(dominfo);
     info->memory = XEN_GETDOMAININFO_TOT_PAGES(dominfo) * kb_per_pages;
-    info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo) * kb_per_pages;
+    info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo);
+    if(info->maxMem != UINT_MAX)
+        info->maxMem *= kb_per_pages;
     info->nrVirtCpu = XEN_GETDOMAININFO_CPUCOUNT(dominfo);
     return (0);
 }






More information about the libvir-list mailing list