qubeswatch: use always "dom0" name for dom0
Libvirt reports dom0 as "Domain-0". Which is incompatible with how Qubes and libxl toolstack names it ("dom0"). So handle this as a special case. Otherwise reconnection retries leaks event object every iteration. Fixes QubesOS/qubes-issues#860 Thanks @alex-mazzariol for help with debugging!
This commit is contained in:
parent
78437f7012
commit
7e9c816b7b
@ -729,6 +729,10 @@ class QubesWatch(object):
|
|||||||
return '/local/domain/%s/memory/meminfo' % xid
|
return '/local/domain/%s/memory/meminfo' % xid
|
||||||
|
|
||||||
def _register_watches(self, libvirt_domain):
|
def _register_watches(self, libvirt_domain):
|
||||||
|
if libvirt_domain and libvirt_domain.ID() == 0:
|
||||||
|
# don't use libvirt object for dom0, to always have the same
|
||||||
|
# hardcoded "dom0" name
|
||||||
|
libvirt_domain = None
|
||||||
if libvirt_domain:
|
if libvirt_domain:
|
||||||
name = libvirt_domain.name()
|
name = libvirt_domain.name()
|
||||||
if name in self._qdb:
|
if name in self._qdb:
|
||||||
@ -769,7 +773,10 @@ class QubesWatch(object):
|
|||||||
self._register_watches(libvirt_domain)
|
self._register_watches(libvirt_domain)
|
||||||
|
|
||||||
def _unregister_watches(self, libvirt_domain):
|
def _unregister_watches(self, libvirt_domain):
|
||||||
name = libvirt_domain.name()
|
if libvirt_domain and libvirt_domain.ID() == 0:
|
||||||
|
name = "dom0"
|
||||||
|
else:
|
||||||
|
name = libvirt_domain.name()
|
||||||
if name in self._qdb_events:
|
if name in self._qdb_events:
|
||||||
libvirt.virEventRemoveHandle(self._qdb_events[name])
|
libvirt.virEventRemoveHandle(self._qdb_events[name])
|
||||||
del(self._qdb_events[name])
|
del(self._qdb_events[name])
|
||||||
|
Loading…
Reference in New Issue
Block a user