diff --git a/qubes/mgmt.py b/qubes/mgmt.py index 5ef8815c..47cde998 100644 --- a/qubes/mgmt.py +++ b/qubes/mgmt.py @@ -583,6 +583,9 @@ class QubesMgmt(AbstractQubesMgmt): type(self.app).add_handler('*', handler) qubes.vm.BaseVM.add_handler('*', handler) + # send artificial event as a confirmation that connection is established + self.send_event(self.app, 'connection-established') + try: yield from wait_for_cancel except asyncio.CancelledError: diff --git a/qubes/tests/mgmt.py b/qubes/tests/mgmt.py index 06b44dd4..e1c930f1 100644 --- a/qubes/tests/mgmt.py +++ b/qubes/tests/mgmt.py @@ -856,7 +856,10 @@ class TC_00_VMs(MgmtTestCase): self.assertEventFired(self.emitter, 'mgmt-permission:' + 'mgmt.Events') self.assertEqual(send_event.mock_calls, - [unittest.mock.call(self.vm, 'test-event', arg1='abc')]) + [ + unittest.mock.call(self.app, 'connection-established'), + unittest.mock.call(self.vm, 'test-event', arg1='abc') + ]) def test_990_vm_unexpected_payload(self):