From 1720b8788dc32e6f7979f67595dcf75b71b9b85f Mon Sep 17 00:00:00 2001 From: Cheng Zhang Date: Wed, 15 Jul 2015 15:24:03 +0800 Subject: [PATCH] CA-149851: Show hyphen if used memory have negative value Signed-off-by: Cheng Zhang --- XenModel/XenSearch/PropertyAccessorHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/XenModel/XenSearch/PropertyAccessorHelper.cs b/XenModel/XenSearch/PropertyAccessorHelper.cs index ad68939fd..336c61f84 100644 --- a/XenModel/XenSearch/PropertyAccessorHelper.cs +++ b/XenModel/XenSearch/PropertyAccessorHelper.cs @@ -103,7 +103,7 @@ namespace XenAdmin.XenSearch double free = MetricUpdater.GetValue(vm, "memory_internal_free"); double total = MetricUpdater.GetValue(vm, "memory"); - if (total == 0 || Double.IsNaN(total) || Double.IsNaN(free)) + if (total == 0 || Double.IsNaN(total) || Double.IsNaN(free) || total < (free * Util.BINARY_KILO)) return Messages.HYPHEN; return String.Format(Messages.QUERY_MEMORY_USAGE, Util.MemorySizeStringWithoutUnits((total - (free * Util.BINARY_KILO))), Util.MemorySizeString(total));