dom0/qmemman: call do_balance after each domain list change notification (#246)
For unknown reason watch '@releaseDomain' is called twice: first when domain disappeared from xenstore, second when resources (including memory) are freed. So call do_balance after each of this event to redistribute freed memory.
This commit is contained in:
parent
aa08f555c3
commit
d456ec4575
@ -29,7 +29,6 @@ class SystemState:
|
||||
|
||||
def del_domain(self, id):
|
||||
self.domdict.pop(id)
|
||||
self.do_balance()
|
||||
|
||||
def get_free_xen_memory(self):
|
||||
return self.xc.physinfo()['free_memory']*1024
|
||||
|
@ -29,11 +29,11 @@ class WatchType:
|
||||
class XS_Watcher:
|
||||
def __init__(self):
|
||||
self.handle = xen.lowlevel.xs.xs()
|
||||
self.handle.watch('/local/domain', WatchType(XS_Watcher.domain_list_changed, None))
|
||||
self.handle.watch('@introduceDomain', WatchType(XS_Watcher.domain_list_changed, None))
|
||||
self.handle.watch('@releaseDomain', WatchType(XS_Watcher.domain_list_changed, None))
|
||||
self.watch_token_dict = {}
|
||||
|
||||
def domain_list_changed(self, param):
|
||||
time.sleep(0.05)
|
||||
curr = self.handle.ls('', '/local/domain')
|
||||
if curr == None:
|
||||
return
|
||||
@ -50,6 +50,7 @@ class XS_Watcher:
|
||||
self.watch_token_dict.pop(i)
|
||||
system_state.del_domain(i)
|
||||
global_lock.release()
|
||||
system_state.do_balance()
|
||||
|
||||
def meminfo_changed(self, domain_id):
|
||||
untrusted_meminfo_key = self.handle.read('', get_domain_meminfo_key(domain_id))
|
||||
|
Loading…
Reference in New Issue
Block a user