On 01/07/2011 12:09 AM, Nikunj A. Dadhania wrote:
From: Nikunj A. Dadhania <nikunj(a)linux.vnet.ibm.com>
Display unlimited when the memory cgroup settings says so. Unlimited is
represented by INT64_MAX in memory cgroup.
Signed-off-by: Nikunj A. Dadhania <nikunj(a)linux.vnet.ibm.com>
Reported-by: Justin Clift <jclift(a)redhat.com>
---
tools/virsh.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 55e2a68..bee875c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -2987,9 +2987,15 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd)
params[i].value.l);
break;
case VIR_DOMAIN_MEMORY_PARAM_ULLONG:
- vshPrint(ctl, "%-15s: %llu\n", params[i].field,
- params[i].value.ul);
+ {
+ unsigned long long max_kbytes = INT64_MAX >> 10;
Yuck - why do the clients have to know the magic value? Why not patch
the source to actually return INT64_MAX rather than INT64_MAX>>10 when
returning unlimited?
Actually, due to the issue of cross-versioning between virsh and the
actual libvirt running, we may have to check for both values. But even
having a constant (VIR_DOMAIN_MEMORY_PARAM_UNLIMITED) rather than making
guests recompute things might be nice.
But overall, I like the idea of this patch.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org