From 6a99b0b2ba9ca2bd8eafbd2cb3cce61cdb133171 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Thu, 14 Jan 2016 03:15:38 +0100 Subject: [PATCH] qmemman: add some useful logging for #1389 QubesOS/qubes-issues#1389 --- qmemman/qmemman.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qmemman/qmemman.py b/qmemman/qmemman.py index 57d27370..8d1d60c7 100755 --- a/qmemman/qmemman.py +++ b/qmemman/qmemman.py @@ -47,6 +47,9 @@ class DomainState: self.no_progress = False #no react to memset self.slow_memset_react = False #slow react to memset (after few tries still above target) + def __repr__(self): + return self.__dict__.__repr__() + class SystemState(object): def __init__(self): self.log = logging.getLogger('qmemman.systemstate') @@ -89,6 +92,17 @@ class SystemState(object): self.domdict.values(), 0 ) + # If, at any time, Xen have less memory than XEN_FREE_MEM_MIN, + # it is a failure of qmemman. Collect as much data as possible to + # debug it + if xen_free < self.XEN_FREE_MEM_MIN: + self.log.error("Xen free = {!r} below acceptable value! " + "assigned_but_unused={!r}, domdict={!r}".format( + xen_free, assigned_but_unused, self.domdict)) + elif xen_free < assigned_but_unused+self.XEN_FREE_MEM_MIN: + self.log.error("Xen free = {!r} too small for satisfy assignments! " + "assigned_but_unused={!r}, domdict={!r}".format( + xen_free, assigned_but_unused, self.domdict)) return xen_free - assigned_but_unused #refresh information on memory assigned to all domains