Load Qubes DB python module only when needed.

This is temporary band aid for the python module problems.
This should also slightly speed up some tools (not all uses Qubes DB).
This commit is contained in:
Marek Marczykowski-Górecki 2013-07-30 11:59:24 +02:00
parent e8715cd561
commit 2457a705d0

View File

@ -39,7 +39,6 @@ from qubes import qmemman_algo
import libvirt import libvirt
import warnings import warnings
from qubes.qdb import QubesDB
from qubes.qubes import dry_run,vmm from qubes.qubes import dry_run,vmm
from qubes.qubes import register_qubes_vm_class from qubes.qubes import register_qubes_vm_class
from qubes.qubes import QubesVmCollection,QubesException,QubesHost,QubesVmLabels from qubes.qubes import QubesVmCollection,QubesException,QubesHost,QubesVmLabels
@ -664,6 +663,7 @@ class QubesVm(object):
def qdb(self): def qdb(self):
if self._qdb_connection is None: if self._qdb_connection is None:
if self.is_running(): if self.is_running():
from qubes.qdb import QubesDB
self._qdb_connection = QubesDB(self.name) self._qdb_connection = QubesDB(self.name)
return self._qdb_connection return self._qdb_connection