Skip to content

Commit

Permalink
vm/adminvm: (re-)add vm.qdb property
Browse files Browse the repository at this point in the history
Dom0 also expose some information in QubesDB - like list of block
devices.
  • Loading branch information
marmarek committed Jul 4, 2017
1 parent 3748eb3 commit 3c4b60f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions qubes/vm/adminvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 3c4b60f

Please sign in to comment.