qmemman: don't load qubes.xml

Only qubesd should load qubes.xml directly. Put a TODO comments for now
in place of slow VM reporting, invent some better mechanism later.

This loading of qubes.xml caused deadlocks, because qmemnan kept open
file descriptor (in locked state).
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-25 06:17:49 +02:00
parent 5d9bc00885
commit 625c94d1f6
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -30,7 +30,6 @@ import functools
import xen.lowlevel.xc import xen.lowlevel.xc
import xen.lowlevel.xs import xen.lowlevel.xs
import qubes
import qubes.qmemman.algo import qubes.qmemman.algo
@ -141,24 +140,16 @@ class SystemState(object):
self.domdict[i].memory_actual <= self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/4: self.domdict[i].memory_actual <= self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/4:
dom_name = self.xs.read('', '/local/domain/%s/name' % str(i)) dom_name = self.xs.read('', '/local/domain/%s/name' % str(i))
if dom_name is not None: if dom_name is not None:
try: # TODO: report it somewhere, qubesd or elsewhere
qubes.Qubes().domains[str(dom_name)].fire_event( pass
'status:no-error', status='no-error',
msg=slow_memset_react_msg)
except LookupError:
pass
self.domdict[i].slow_memset_react = False self.domdict[i].slow_memset_react = False
if self.domdict[i].no_progress and \ if self.domdict[i].no_progress and \
self.domdict[i].memory_actual <= self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/4: self.domdict[i].memory_actual <= self.domdict[i].last_target + self.XEN_FREE_MEM_LEFT/4:
dom_name = self.xs.read('', '/local/domain/%s/name' % str(i)) dom_name = self.xs.read('', '/local/domain/%s/name' % str(i))
if dom_name is not None: if dom_name is not None:
try: # TODO: report it somewhere, qubesd or elsewhere
qubes.Qubes().domains[str(dom_name)].fire_event( pass
'status:no-error', status='no-error',
msg=no_progress_msg)
except LookupError:
pass
self.domdict[i].no_progress = False self.domdict[i].no_progress = False
#the below works (and is fast), but then 'xm list' shows unchanged memory value #the below works (and is fast), but then 'xm list' shows unchanged memory value
@ -343,13 +334,8 @@ class SystemState(object):
self.domdict[dom2].no_progress = True self.domdict[dom2].no_progress = True
dom_name = self.xs.read('', '/local/domain/%s/name' % str(dom2)) dom_name = self.xs.read('', '/local/domain/%s/name' % str(dom2))
if dom_name is not None: if dom_name is not None:
try: # TODO: report it somewhere, qubesd or elsewhere
qubes.Qubes().domains[str( pass
dom_name)].fire_event(
'status:error', status='error',
msg=no_progress_msg)
except LookupError:
pass
else: else:
self.log.warning('dom {!r} still hold more' self.log.warning('dom {!r} still hold more'
' memory than have assigned ({} > {})' ' memory than have assigned ({} > {})'
@ -359,13 +345,8 @@ class SystemState(object):
self.domdict[dom2].slow_memset_react = True self.domdict[dom2].slow_memset_react = True
dom_name = self.xs.read('', '/local/domain/%s/name' % str(dom2)) dom_name = self.xs.read('', '/local/domain/%s/name' % str(dom2))
if dom_name is not None: if dom_name is not None:
try: # TODO: report it somewhere, qubesd or elsewhere
qubes.Qubes().domains[str( pass
dom_name)].fire_event(
'status:error', status='error',
msg=slow_memset_react_msg)
except LookupError:
pass
self.mem_set(dom, self.get_free_xen_memory() + self.domdict[dom].memory_actual - self.XEN_FREE_MEM_LEFT) self.mem_set(dom, self.get_free_xen_memory() + self.domdict[dom].memory_actual - self.XEN_FREE_MEM_LEFT)
return return