Fix gui-daemon cleanup
The cleanup requires XID of the domain, but when it's shut off already, it's too late to retrieve it. Cache value retrieved when the domain was still running (either domain-start event, or program startup).
This commit is contained in:
parent
8be74249df
commit
638dbf6143
@ -326,6 +326,10 @@ class DAEMONLauncher:
|
|||||||
self.vm_names = vm_names
|
self.vm_names = vm_names
|
||||||
self.kde = kde
|
self.kde = kde
|
||||||
|
|
||||||
|
# cache XID values when the VM was still running -
|
||||||
|
# for cleanup purpose
|
||||||
|
self.xid_cache = {}
|
||||||
|
|
||||||
async def send_monitor_layout(self, vm, layout=None, startup=False):
|
async def send_monitor_layout(self, vm, layout=None, startup=False):
|
||||||
"""Send monitor layout to a given VM
|
"""Send monitor layout to a given VM
|
||||||
|
|
||||||
@ -607,6 +611,8 @@ class DAEMONLauncher:
|
|||||||
if not self.is_watched(vm):
|
if not self.is_watched(vm):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.xid_cache[vm.name] = vm.xid, vm.stubdom_xid
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if getattr(vm, 'guivm', None) == vm.app.local_name and \
|
if getattr(vm, 'guivm', None) == vm.app.local_name and \
|
||||||
vm.features.check_with_template('gui', True) and \
|
vm.features.check_with_template('gui', True) and \
|
||||||
@ -641,6 +647,7 @@ class DAEMONLauncher:
|
|||||||
asyncio.ensure_future(
|
asyncio.ensure_future(
|
||||||
self.start_gui(vm, monitor_layout=monitor_layout))
|
self.start_gui(vm, monitor_layout=monitor_layout))
|
||||||
asyncio.ensure_future(self.start_audio(vm))
|
asyncio.ensure_future(self.start_audio(vm))
|
||||||
|
self.xid_cache[vm.name] = vm.xid, vm.stubdom_xid
|
||||||
elif power_state == 'Transient':
|
elif power_state == 'Transient':
|
||||||
# it is still starting, we'll get 'domain-start'
|
# it is still starting, we'll get 'domain-start'
|
||||||
# event when fully started
|
# event when fully started
|
||||||
@ -654,9 +661,16 @@ class DAEMONLauncher:
|
|||||||
if not self.is_watched(vm):
|
if not self.is_watched(vm):
|
||||||
return
|
return
|
||||||
|
|
||||||
self.cleanup_guid(vm.xid)
|
# read XID from cache, as stopped domain reports it already as -1
|
||||||
if vm.virt_mode == 'hvm':
|
try:
|
||||||
self.cleanup_guid(vm.stubdom_xid)
|
xid, stubdom_xid = self.xid_cache[vm.name]
|
||||||
|
del self.xid_cache[vm.name]
|
||||||
|
except KeyError:
|
||||||
|
return
|
||||||
|
if xid != -1:
|
||||||
|
self.cleanup_guid(xid)
|
||||||
|
if stubdom_xid != -1:
|
||||||
|
self.cleanup_guid(stubdom_xid)
|
||||||
|
|
||||||
def cleanup_guid(self, xid):
|
def cleanup_guid(self, xid):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user