Merge pull request #548 from cheng--zhang/CA-149851

CA-149851: Show hyphen if used memory have negative value
This commit is contained in:
Mihaela Stoica 2015-07-15 09:26:13 +01:00
commit 77bd9188ef

View File

@ -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));