Browse Source

tests: register libvirt events

This is especially needed to have proper domain-shutdown event.
Marek Marczykowski-Górecki 7 years ago
parent
commit
6a85592b51
1 changed files with 5 additions and 0 deletions
  1. 5 0
      qubes/tests/__init__.py

+ 5 - 0
qubes/tests/__init__.py

@@ -94,6 +94,9 @@ try:
 except libvirt.libvirtError:
     pass
 
+if in_dom0:
+    import libvirtaio
+
 try:
     in_git = subprocess.check_output(
         ['git', 'rev-parse', '--show-toplevel']).decode().strip()
@@ -590,6 +593,7 @@ class SystemTestCase(QubesTestCase):
         if not in_dom0:
             self.skipTest('outside dom0')
         super(SystemTestCase, self).setUp()
+        libvirtaio.virEventRegisterAsyncIOImpl(loop=self.loop)
         self.remove_test_vms()
 
         # need some information from the real qubes.xml - at least installed
@@ -603,6 +607,7 @@ class SystemTestCase(QubesTestCase):
             shutil.copy(self.host_app.store, XMLPATH)
         self.app = qubes.Qubes(XMLPATH)
         os.environ['QUBES_XML_PATH'] = XMLPATH
+        self.app.vmm.register_event_handlers(self.app)
 
         self.qubesd = self.loop.run_until_complete(
             qubes.api.create_servers(