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;
+ if (params[i].value.ul == max_kbytes)
+ vshPrint(ctl, "%-15s: unlimited\n", params[i].field);
+ else
+ vshPrint(ctl, "%-15s: %llu\n", params[i].field,
+ params[i].value.ul);
break;
+ }
case VIR_DOMAIN_MEMORY_PARAM_DOUBLE:
vshPrint(ctl, "%-15s: %f\n", params[i].field,
params[i].value.d);