Ignore error when 'xen.lowlevel.xs' doesn't exists

There are still few uses of direct xenstore access, most of them are
xen-specific (so doesn't need to be portable). For now simply don't
connect to xenstore when no 'xen.lowlevel.xs' module present. It will
break such xen-specific accesses - it must be somehow reworked - either
by adding appropriate conditionals, or moving such code somewhere else
(custom methods of libvirt driver?).
This commit is contained in:
Marek Marczykowski-Górecki 2013-07-22 04:40:24 +02:00
parent bc58ca5edb
commit a8bee8d978

View File

@ -42,7 +42,10 @@ dry_run = False
if not dry_run:
import libvirt
import xen.lowlevel.xs
try:
import xen.lowlevel.xs
except ImportError:
pass
qubes_base_dir = "/var/lib/qubes"
@ -138,7 +141,8 @@ class QubesVMMConnection(object):
# Do not initialize in offline mode
return
self._xs = xen.lowlevel.xs.xs()
if 'xen.lowlevel.xs' in sys.modules:
self._xs = xen.lowlevel.xs.xs()
self._libvirt_conn = libvirt.open(defaults['libvirt_uri'])
if self._libvirt_conn == None:
raise QubesException("Failed connect to libvirt driver")
@ -160,7 +164,10 @@ class QubesVMMConnection(object):
@property
def xs(self):
return self._common_getter('_xs')
if 'xen.lowlevel.xs' in sys.modules:
return self._common_getter('_xs')
else:
return None
##### VMM global variable definition #####