Parcourir la source

qmemman: fix maxmem handling (#736)

'static-max' as read from xenstore is string, so needs to be converted
to int. Additionally units needs to be adjusted (MB vs kB).
Marek Marczykowski-Górecki il y a 10 ans
Parent
commit
71960d83cc
1 fichiers modifiés avec 3 ajouts et 1 suppressions
  1. 3 1
      qmemman/qmemman.py

+ 3 - 1
qmemman/qmemman.py

@@ -51,7 +51,9 @@ class SystemState:
             if self.domdict.has_key(id):
                 self.domdict[id].memory_actual = domain['mem_kb']*1024
                 self.domdict[id].memory_maximum = self.xs.read('', '/local/domain/%s/memory/static-max' % str(id))
-                if not self.domdict[id].memory_maximum:
+                if self.domdict[id].memory_maximum:
+                    self.domdict[id].memory_maximum = int(self.domdict[id].memory_maximum)*1024
+                else:
                     self.domdict[id].memory_maximum = self.ALL_PHYS_MEM
 # the previous line used to be
 #                    self.domdict[id].memory_maximum = domain['maxmem_kb']*1024