vm/adminvm: (re-)add vm.qdb property

Dom0 also expose some information in QubesDB - like list of block
devices.
This commit is contained in:
Marek Marczykowski-Górecki 2017-06-23 11:09:40 +02:00
parent 3748eb3e2b
commit 3c4b60fa45
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -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 @@ class AdminVM(qubes.vm.BaseVM):
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,