From 3c4b60fa45b7554117b63365ef90456352940908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Fri, 23 Jun 2017 11:09:40 +0200 Subject: [PATCH] vm/adminvm: (re-)add vm.qdb property Dom0 also expose some information in QubesDB - like list of block devices. --- qubes/vm/adminvm.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/qubes/vm/adminvm.py b/qubes/vm/adminvm.py index a3246d097..6b8633a91 100644 --- a/qubes/vm/adminvm.py +++ b/qubes/vm/adminvm.py @@ -49,6 +49,11 @@ class AdminVM(qubes.vm.BaseVM): default='00000000-0000-0000-0000-000000000000', setter=qubes.property.forbidden) + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + + self._qdb_connection = None + def __str__(self): return self.name @@ -158,6 +163,15 @@ def suspend(self): def icon_path(self): return None + @property + def qdb(self): + '''QubesDB handle for this domain.''' + if self._qdb_connection is None: + import qubesdb # pylint: disable=import-error + self._qdb_connection = qubesdb.QubesDB(self.name) + return self._qdb_connection + + # def __init__(self, **kwargs): # super(QubesAdminVm, self).__init__(qid=0, name="dom0", netid=0, # dir_path=None,