Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/331'
Browse files Browse the repository at this point in the history
* origin/pr/331:
  Fix multiple qmemman issues
  • Loading branch information
marmarek committed Apr 10, 2020
2 parents 46f09f8 + dd50e30 commit 3b96303
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions qubes/tools/qmemmand.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,18 @@ def domain_list_changed(self, refresh_only=False):
self.handle.unwatch(get_domain_meminfo_key(i), self.watch_token_dict[i])
self.watch_token_dict.pop(i)
system_state.del_domain(i)
except:
self.log.exception('Updating domain list failed')
finally:
if got_lock:
global_lock.release()
self.log.debug('global_lock released')

if not refresh_only:
system_state.do_balance()
try:
system_state.do_balance()
except:
self.log.exception('do_balance() failed')


def meminfo_changed(self, domain_id):
Expand All @@ -143,10 +148,17 @@ def meminfo_changed(self, domain_id):
global_lock.acquire()
self.log.debug('global_lock acquired')
try:
global force_refresh_domain_list
if force_refresh_domain_list:
self.domain_list_changed(refresh_only=True)
force_refresh_domain_list = False
if domain_id not in self.watch_token_dict:
# domain just destroyed
return

system_state.refresh_meminfo(domain_id, untrusted_meminfo_key)
except:
self.log.exception('Updating meminfo for %d failed', domain_id)
finally:
global_lock.release()
self.log.debug('global_lock released')
Expand Down Expand Up @@ -180,7 +192,7 @@ def handle(self):
self.data = self.request.recv(1024).strip()
self.log.debug('data={!r}'.format(self.data))
if len(self.data) == 0:
self.log.info('EOF')
self.log.info('client disconnected, resuming membalance')
if got_lock:
global force_refresh_domain_list
force_refresh_domain_list = True
Expand Down

0 comments on commit 3b96303

Please sign in to comment.