Clean up the guid-conf file on domain stop
This commit is contained in:
parent
3540f04a42
commit
7616a8913a
@ -575,12 +575,29 @@ class DAEMONLauncher:
|
|||||||
asyncio.ensure_future(
|
asyncio.ensure_future(
|
||||||
self.start_gui_for_stubdomain(vm))
|
self.start_gui_for_stubdomain(vm))
|
||||||
|
|
||||||
|
def on_domain_stopped(self, vm, _event, **_kwargs):
|
||||||
|
"""Handler of 'domain-stopped' event, cleans up"""
|
||||||
|
self.cleanup_guid(vm.xid)
|
||||||
|
if vm.virt_mode == 'hvm':
|
||||||
|
self.cleanup_guid(vm.stubdom_xid)
|
||||||
|
|
||||||
|
def cleanup_guid(self, xid):
|
||||||
|
"""
|
||||||
|
Clean up after qubes-guid. Removes the auto-generated configuration
|
||||||
|
file, if any.
|
||||||
|
"""
|
||||||
|
|
||||||
|
config_path = self.guid_config_file(xid)
|
||||||
|
if os.path.exists(config_path):
|
||||||
|
os.unlink(config_path)
|
||||||
|
|
||||||
def register_events(self, events):
|
def register_events(self, events):
|
||||||
"""Register domain startup events in app.events dispatcher"""
|
"""Register domain startup events in app.events dispatcher"""
|
||||||
events.add_handler('domain-spawn', self.on_domain_spawn)
|
events.add_handler('domain-spawn', self.on_domain_spawn)
|
||||||
events.add_handler('domain-start', self.on_domain_start)
|
events.add_handler('domain-start', self.on_domain_start)
|
||||||
events.add_handler('connection-established',
|
events.add_handler('connection-established',
|
||||||
self.on_connection_established)
|
self.on_connection_established)
|
||||||
|
events.add_handler('domain-stopped', self.on_domain_stopped)
|
||||||
|
|
||||||
|
|
||||||
def x_reader(conn, callback):
|
def x_reader(conn, callback):
|
||||||
|
Loading…
Reference in New Issue
Block a user